00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00038 #ifndef _HAVE_FL_UTF8_HDR_
00039 #define _HAVE_FL_UTF8_HDR_
00040
00041 #include "Fl_Export.H"
00042 #include "fl_types.h"
00043
00044 #include <stdio.h>
00045 #include <string.h>
00046 #include <stdlib.h>
00047
00048 #ifdef WIN32
00049 # include <sys/types.h>
00050 # include <sys/stat.h>
00051 # include <locale.h>
00052 # include <ctype.h>
00053 # define xchar wchar_t
00054 # if !defined(FL_DLL) && !defined(__CYGWIN__)
00055 # undef strdup
00056 # define strdup _strdup
00057 # undef putenv
00058 # define putenv _putenv
00059 # undef stricmp
00060 # define stricmp _stricmp
00061 # undef strnicmp
00062 # define strnicmp _strnicmp
00063 # undef hypot
00064 # define hypot _hypot
00065 # undef chdir
00066 # define chdir _chdir
00067 # endif
00068 #elif defined(__APPLE__)
00069 # include <wchar.h>
00070 # include <sys/stat.h>
00071 # define xchar wchar_t
00072 #else
00073 # include <sys/types.h>
00074 # include <sys/stat.h>
00075 # include "Xutf8.h"
00076 # include <X11/Xlocale.h>
00077 # include <X11/Xlib.h>
00078 # include <locale.h>
00079 # define xchar unsigned short
00080 #endif
00081
00082 # ifdef __cplusplus
00083 extern "C" {
00084 # endif
00085
00090
00091
00092
00098 FL_EXPORT int fl_utf8bytes(unsigned ucs);
00099
00100
00101 FL_EXPORT int fl_utf8len(char c);
00102
00103
00104 FL_EXPORT int fl_utf8len1(char c);
00105
00106
00107 FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len);
00108
00109
00110 FL_EXPORT unsigned fl_utf8decode(const char* p, const char* end, int* len);
00111
00112
00113 FL_EXPORT int fl_utf8encode(unsigned ucs, char* buf);
00114
00115
00116 FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* end);
00117
00118
00119 FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end);
00120
00121
00122 FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen);
00123
00124
00125 FL_EXPORT unsigned fl_utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen);
00126
00127
00128 FL_EXPORT unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen);
00129
00130
00131 FL_EXPORT unsigned fl_utf8toa (const char *src, unsigned srclen, char *dst, unsigned dstlen);
00132
00133
00134
00135
00136 FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen);
00137
00138
00139
00140
00141 FL_EXPORT int fl_utf8locale();
00142
00143
00144
00145
00146 FL_EXPORT int fl_utf8test(const char *src, unsigned len);
00147
00148
00149
00150 FL_EXPORT int fl_wcwidth_(unsigned int ucs);
00151
00152
00153
00154
00155 FL_EXPORT int fl_wcwidth(const char *src);
00156
00157
00158 FL_EXPORT unsigned int fl_nonspacing(unsigned int ucs);
00159
00160
00161 FL_EXPORT unsigned fl_utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen);
00162
00163 FL_EXPORT char* fl_utf2mbcs(const char *src);
00164
00165
00166 FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen);
00167
00168
00169
00170
00171 #ifdef WIN32
00172
00173 FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage);
00174
00175
00176 FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage);
00177 #endif
00178
00179
00180
00181
00182
00183
00184
00185 FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n);
00186
00187
00188 FL_EXPORT int fl_utf_strcasecmp(const char *s1, const char *s2);
00189
00190
00191 FL_EXPORT int fl_tolower(unsigned int ucs);
00192
00193
00194 FL_EXPORT int fl_toupper(unsigned int ucs);
00195
00196
00197 FL_EXPORT int fl_utf_tolower(const unsigned char *str, int len, char *buf);
00198
00199
00200 FL_EXPORT int fl_utf_toupper(const unsigned char *str, int len, char *buf);
00201
00202
00203 FL_EXPORT int fl_chmod(const char* f, int mode);
00204
00205
00206 FL_EXPORT int fl_access(const char* f, int mode);
00207
00208
00209 FL_EXPORT int fl_stat( const char *path, struct stat *buffer );
00210
00211
00212 FL_EXPORT char* fl_getcwd( char *buf, int maxlen);
00213
00214
00215 FL_EXPORT FILE *fl_fopen(const char *f, const char *mode);
00216
00217
00218 FL_EXPORT int fl_system(const char* f);
00219
00220
00221 FL_EXPORT int fl_execvp(const char *file, char *const *argv);
00222
00223
00224 FL_EXPORT int fl_open(const char* f, int o, ...);
00225
00226
00227 FL_EXPORT int fl_unlink(const char *f);
00228
00229
00230 FL_EXPORT int fl_rmdir(const char *f);
00231
00232
00233 FL_EXPORT char* fl_getenv(const char *name);
00234
00235
00236 FL_EXPORT int fl_mkdir(const char* f, int mode);
00237
00238
00239 FL_EXPORT int fl_rename(const char* f, const char *t);
00240
00241
00242
00243 FL_EXPORT void fl_make_path_for_file( const char *path );
00244
00245
00246 FL_EXPORT char fl_make_path( const char *path );
00247
00248
00251
00252
00253 #ifdef __cplusplus
00254 }
00255 #endif
00256
00257
00258 #endif
00259
00260
00261
00262