| 1 |
/* File : dirent.i */ |
| 2 |
//%module dirent |
| 3 |
|
| 4 |
%include "typemaps.i" |
| 5 |
%include "std_wstring.i" |
| 6 |
%apply char { unsigned char}; |
| 7 |
|
| 8 |
//%typemap(in) Fl_CString { |
| 9 |
// PyObject $1 = PyUnicode_FromObject($input); |
| 10 |
// } |
| 11 |
|
| 12 |
%{ |
| 13 |
#include "FL/fl_utf8.h" |
| 14 |
%} |
| 15 |
|
| 16 |
%ignore fl_stat; |
| 17 |
|
| 18 |
FL_EXPORT int fl_utf8bytes(unsigned ucs); |
| 19 |
|
| 20 |
FL_EXPORT int fl_utf8len(char c); |
| 21 |
|
| 22 |
/* OD: returns the number of Unicode chars in the UTF-8 string */ |
| 23 |
FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len); |
| 24 |
|
| 25 |
/* F2: Convert the next UTF8 char-sequence into a Unicode value (and say how many bytes were used) */ |
| 26 |
FL_EXPORT unsigned fl_utf8decode(const char* p, const char* end, int* len); |
| 27 |
|
| 28 |
/* F2: Encode a Unicode value into a UTF8 sequence, return the number of bytes used */ |
| 29 |
FL_EXPORT int fl_utf8encode(unsigned ucs, char* OUTPUT); |
| 30 |
|
| 31 |
/* F2: Move forward to the next valid UTF8 sequence start betwen start and end */ |
| 32 |
FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* end); |
| 33 |
|
| 34 |
/* F2: Move backward to the previous valid UTF8 sequence start */ |
| 35 |
FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end); |
| 36 |
|
| 37 |
/* F2: Convert a UTF8 string into UTF16 */ |
| 38 |
FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* OUTPUT, unsigned dstlen); |
| 39 |
|
| 40 |
/* F2: Convert a UTF8 string into a wide character string - makes UTF16 on win32, "UCS4" elsewhere */ |
| 41 |
//FL_EXPORT unsigned fl_utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen); |
| 42 |
|
| 43 |
/* F2: Convert a wide character string to UTF8 - takes in UTF16 on win32, "UCS4" elsewhere */ |
| 44 |
//FL_EXPORT unsigned fl_utf8fromwc(char *OUTPUT, unsigned OUTPUT, const wchar_t *INPUT, unsigned INPUT); |
| 45 |
|
| 46 |
/* F2: Convert a UTF8 string into ASCII, eliding untranslatable glyphs */ |
| 47 |
FL_EXPORT unsigned fl_utf8toa (const char *src, unsigned srclen, char *OUTPUT, unsigned OUTPUT); |
| 48 |
/* OD: convert UTF-8 string to latin1 */ |
| 49 |
/* FL_EXPORT int fl_utf2latin1(const unsigned char *src, int srclen, char *dst); */ |
| 50 |
|
| 51 |
/* F2: Convert 8859-1 string to UTF8 */ |
| 52 |
FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen); |
| 53 |
/* OD: convert latin1 str to UTF-8 */ |
| 54 |
/* FL_EXPORT int fl_latin12utf(const unsigned char *src, int srclen, char *dst); */ |
| 55 |
|
| 56 |
/* F2: Returns true if the current O/S locale is UTF8 */ |
| 57 |
FL_EXPORT int fl_utf8locale(); |
| 58 |
|
| 59 |
/* F2: Examine the first len characters of src, to determine if the input text is UTF8 or not |
| 60 |
* NOTE: The value returned is not simply boolean - it contains information about the probable |
| 61 |
* type of the src text. */ |
| 62 |
FL_EXPORT int fl_utf8test(const char *src, unsigned len); |
| 63 |
|
| 64 |
/* OD: Return true if the character is non-spacing */ |
| 65 |
FL_EXPORT unsigned int fl_nonspacing(unsigned int ucs); |
| 66 |
|
| 67 |
/* F2: Convert UTF8 to a local multi-byte encoding - mainly for win32? */ |
| 68 |
FL_EXPORT unsigned fl_utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen); |
| 69 |
/* OD: Convert UTF8 to a local multi-byte encoding */ |
| 70 |
FL_EXPORT char* fl_utf2mbcs(const char *src); |
| 71 |
|
| 72 |
/* F2: Convert a local multi-byte encoding to UTF8 - mainly for win32? */ |
| 73 |
FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen); |
| 74 |
/* OD: Convert a local multi-byte encoding to UTF8 */ |
| 75 |
/* FL_EXPORT char* fl_mbcs2utf(const char *src); */ |
| 76 |
|
| 77 |
/*****************************************************************************/ |
| 78 |
#ifdef WIN32 |
| 79 |
/* OD: Attempt to convert the UTF8 string to the current locale */ |
| 80 |
FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage); |
| 81 |
|
| 82 |
/* OD: Attempt to convert a string in the current locale to UTF8 */ |
| 83 |
FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage); |
| 84 |
#endif |
| 85 |
|
| 86 |
/***************************************************************************** |
| 87 |
* The following functions are intended to provide portable, UTF8 aware |
| 88 |
* versions of standard functions |
| 89 |
*/ |
| 90 |
|
| 91 |
/* OD: UTF8 aware strncasecmp - converts to lower case Unicode and tests */ |
| 92 |
FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n); |
| 93 |
|
| 94 |
/* OD: UTF8 aware strcasecmp - converts to Unicode and tests */ |
| 95 |
FL_EXPORT int fl_utf_strcasecmp(const char *s1, const char *s2); |
| 96 |
|
| 97 |
/* OD: return the Unicode lower case value of ucs */ |
| 98 |
FL_EXPORT int fl_tolower(unsigned int ucs); |
| 99 |
|
| 100 |
/* OD: return the Unicode upper case value of ucs */ |
| 101 |
FL_EXPORT int fl_toupper(unsigned int ucs); |
| 102 |
|
| 103 |
/* OD: converts the UTF8 string to the lower case equivalent */ |
| 104 |
FL_EXPORT int fl_utf_tolower(const unsigned char *str, int len, char *OUTPUT); |
| 105 |
|
| 106 |
/* OD: converts the UTF8 string to the upper case equivalent */ |
| 107 |
FL_EXPORT int fl_utf_toupper(const unsigned char *str, int len, char *buf); |
| 108 |
|
| 109 |
/* OD: Portable UTF8 aware chmod wrapper */ |
| 110 |
FL_EXPORT int fl_chmod(const char* f, int mode); |
| 111 |
|
| 112 |
/* OD: Portable UTF8 aware access wrapper */ |
| 113 |
FL_EXPORT int fl_access(const char* f, int mode); |
| 114 |
|
| 115 |
/* OD: Portable UTF8 aware stat wrapper */ |
| 116 |
FL_EXPORT int fl_stat( const char *path, struct stat *buffer ); |
| 117 |
|
| 118 |
/* OD: Portable UTF8 aware getcwd wrapper */ |
| 119 |
FL_EXPORT char* fl_getcwd( char *buf, int maxlen); |
| 120 |
|
| 121 |
/* OD: Portable UTF8 aware fopen wrapper */ |
| 122 |
FL_EXPORT FILE *fl_fopen(const char *f, const char *mode); |
| 123 |
|
| 124 |
/* OD: Portable UTF8 aware system wrapper */ |
| 125 |
FL_EXPORT int fl_system(const char* f); |
| 126 |
|
| 127 |
/* OD: Portable UTF8 aware execvp wrapper */ |
| 128 |
FL_EXPORT int fl_execvp(const char *file, char *const *argv); |
| 129 |
|
| 130 |
/* OD: Portable UTF8 aware open wrapper */ |
| 131 |
FL_EXPORT int fl_open(const char* f, int o, ...); |
| 132 |
|
| 133 |
/* OD: Portable UTF8 aware unlink wrapper */ |
| 134 |
FL_EXPORT int fl_unlink(const char *f); |
| 135 |
|
| 136 |
/* OD: Portable UTF8 aware rmdir wrapper */ |
| 137 |
FL_EXPORT int fl_rmdir(const char *f); |
| 138 |
|
| 139 |
/* OD: Portable UTF8 aware getenv wrapper */ |
| 140 |
FL_EXPORT char* fl_getenv(const char *name); |
| 141 |
|
| 142 |
/* OD: Portable UTF8 aware execvp wrapper */ |
| 143 |
FL_EXPORT int fl_mkdir(const char* f, int mode); |
| 144 |
|
| 145 |
/* OD: Portable UTF8 aware rename wrapper */ |
| 146 |
FL_EXPORT int fl_rename(const char* f, const char *t); |
| 147 |
|
| 148 |
|
| 149 |
/* OD: Given a full pathname, this will create the directory path needed to hold the file named */ |
| 150 |
FL_EXPORT void fl_make_path_for_file( const char *path ); |
| 151 |
|
| 152 |
/* OD: recursively create a path in the file system */ |
| 153 |
FL_EXPORT char fl_make_path( const char *path ); |
| 154 |
|