diff options
| author | Manolo Gouy <Manolo> | 2016-03-29 19:41:14 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-29 19:41:14 +0000 |
| commit | fd600aa2396cc7fa0d4cd020cd318fbe6ef6e9b4 (patch) | |
| tree | 493be8570207f5c634e65679b9c610e4d3c4667d /FL | |
| parent | eff92c82110b379e3c6bace9719e1bd0c35ce2f6 (diff) | |
Rewrite fl_utf8.cxx under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11467 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_System_Driver.H | 15 | ||||
| -rw-r--r-- | FL/fl_utf8.h | 58 |
2 files changed, 18 insertions, 55 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index 4ace8411d..ec5972e3e 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -93,6 +93,21 @@ public: // implement to support drag-n-drop. use_selection = 1 means the GUI is welcome to display // the selected text during the D&D operation virtual int dnd(int use_selection = 0) {return 0;} + + virtual char *utf2mbcs(const char *s) {return (char*)s;} + virtual char *getenv(const char* v); + virtual int open(const char* f, int oflags, int pmode) {return -1;} + virtual FILE *fopen(const char* f, const char *mode) {return NULL;} + virtual int system(const char* cmd) {return -1;} + virtual int execvp(const char *file, char *const *argv) {return -1;} + virtual int chmod(const char* f, int mode) {return -1;} + virtual int access(const char* f, int mode) { return -1;} + virtual int stat(const char* f, struct stat *b) { return -1;} + virtual char *getcwd(char* b, int l) {return NULL;} + virtual int unlink(const char* f) {return -1;} + virtual int mkdir(const char* f, int mode) {return -1;} + virtual int rmdir(const char* f) {return -1;} + virtual int rename(const char* f, const char *n) {return -1;} }; #endif // FL_SYSTEM_DRIVER_H diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h index b4a55e62c..5bce88b3a 100644 --- a/FL/fl_utf8.h +++ b/FL/fl_utf8.h @@ -3,6 +3,7 @@ * * Author: Jean-Marc Lienher ( http://oksid.ch ) * Copyright 2000-2010 by O'ksi'D. + * Copyright 2016 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this @@ -30,58 +31,10 @@ #include "Fl_Export.H" #include "fl_types.h" - #include <stdio.h> #include <string.h> #include <stdlib.h> -/* - *FIXME* -- PORTME: should not be in the header -- - Many, if not all of the included headers below should not be included - here, because this pollutes user space definitions. - Note: FL/fl_utf8.h is included in many other header files! -*/ - -#ifdef WIN32 -# include <sys/types.h> -# include <sys/stat.h> -# include <locale.h> -# include <ctype.h> -//# define xchar wchar_t -# if !defined(FL_DLL) && !defined(__CYGWIN__) -# undef strdup -# define strdup _strdup -# undef putenv -# define putenv _putenv -# undef stricmp -# define stricmp _stricmp -# undef strnicmp -# define strnicmp _strnicmp -# undef chdir -# define chdir _chdir -# endif -#elif defined(__APPLE__) /* PORTME: should not be in the header */ -# include <wchar.h> -# include <sys/stat.h> -//# define xchar wchar_t -#elif defined(ANDROID) -# include <wchar.h> -//# define xchar wchar_t -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: include UTF-8 support files and define UTF-8 types" -//# define xchar unsigned short -/* TODO: the condition below is not portable! */ -#else /* X11 */ -# include <sys/types.h> -# include <sys/stat.h> -# if defined(FL_LIBRARY) /* don't expose X11 headers in user space */ -# include <X11/Xlocale.h> -//# include <X11/Xlib.h> -# endif /* defined(FL_LIBRARY) -- don't expose X11 headers in user space */ -# include <locale.h> -//# define xchar unsigned short -#endif - #ifdef __cplusplus extern "C" { #endif @@ -169,18 +122,13 @@ FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, u /*****************************************************************************/ #ifdef WIN32 +/* these two WIN32-only functions are kept for API compatibility */ /* OD: Attempt to convert the UTF-8 string to the current locale */ FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage); /* OD: Attempt to convert a string in the current locale to UTF-8 */ FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage); -#elif defined(__APPLE__) /* PORTME: Fl_Screen_Driver ? - platform text encoding and conversion */ - /* not needed */ -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: do you want to be able to convert from a local charset to UTF-8?" -#else /* X11 */ - /* not needed */ -#endif +#endif /* WIN32 */ /***************************************************************************** * The following functions are intended to provide portable, UTF-8 aware |
