28#ifndef _HAVE_FL_UTF8_HDR_
29#define _HAVE_FL_UTF8_HDR_
39# include <sys/types.h>
44# if !defined(FL_DLL) && !defined(__CYGWIN__)
46# define strdup _strdup
48# define putenv _putenv
50# define stricmp _stricmp
52# define strnicmp _strnicmp
56#elif defined(__APPLE__)
61# include <sys/types.h>
63# if defined(FL_LIBRARY)
64# include <X11/Xlocale.h>
68# define xchar unsigned short
99FL_EXPORT
unsigned fl_utf8decode(
const char* p,
const char* end,
int* len);
105FL_EXPORT
const char*
fl_utf8fwd(
const char* p,
const char* start,
const char* end);
108FL_EXPORT
const char*
fl_utf8back(
const char* p,
const char* start,
const char* end);
111FL_EXPORT
unsigned fl_ucs_to_Utf16(
const unsigned ucs,
unsigned short *dst,
const unsigned dstlen);
114FL_EXPORT
unsigned fl_utf8toUtf16(
const char* src,
unsigned srclen,
unsigned short* dst,
unsigned dstlen);
117FL_EXPORT
unsigned fl_utf8towc(
const char *src,
unsigned srclen,
wchar_t *dst,
unsigned dstlen);
120FL_EXPORT
unsigned fl_utf8fromwc(
char *dst,
unsigned dstlen,
const wchar_t *src,
unsigned srclen);
123FL_EXPORT
unsigned fl_utf8toa (
const char *src,
unsigned srclen,
char *dst,
unsigned dstlen);
126FL_EXPORT
unsigned fl_utf8froma (
char *dst,
unsigned dstlen,
const char *src,
unsigned srclen);
134FL_EXPORT
int fl_utf8test(
const char *src,
unsigned len);
149FL_EXPORT
unsigned fl_utf8to_mb(
const char *src,
unsigned srclen,
char *dst,
unsigned dstlen);
154FL_EXPORT
unsigned fl_utf8from_mb(
char *dst,
unsigned dstlen,
const char *src,
unsigned srclen);
159FL_EXPORT
char *fl_utf8_to_locale(
const char *s,
int len,
unsigned int codepage);
162FL_EXPORT
char *fl_locale_to_utf8(
const char *s,
int len,
unsigned int codepage);
183FL_EXPORT
int fl_utf_tolower(
const unsigned char *str,
int len,
char *buf);
186FL_EXPORT
int fl_utf_toupper(
const unsigned char *str,
int len,
char *buf);
189FL_EXPORT
int fl_chmod(
const char* f,
int mode);
192FL_EXPORT
int fl_access(
const char* f,
int mode);
195FL_EXPORT
int fl_stat(
const char *path,
struct stat *buffer );
198FL_EXPORT
char*
fl_getcwd(
char *buf,
int maxlen);
201FL_EXPORT FILE *
fl_fopen(
const char *f,
const char *mode);
207FL_EXPORT
int fl_execvp(
const char *file,
char *
const *argv);
210FL_EXPORT
int fl_open(
const char* f,
int o, ...);
216FL_EXPORT
int fl_rmdir(
const char *f);
219FL_EXPORT
char*
fl_getenv(
const char *name);
222FL_EXPORT
int fl_mkdir(
const char* f,
int mode);
225FL_EXPORT
int fl_rename(
const char* f,
const char *t);
This file contains simple "C"-style type definitions.
FL_EXPORT char * fl_getenv(const char *name)
Cross-platform function to get environment variables with a UTF-8 encoded name or value.
Definition: fl_utf8.cxx:421
FL_EXPORT int fl_unlink(const char *f)
Cross-platform function to unlink() (that is, delete) a file using a UTF-8 encoded filename.
Definition: fl_utf8.cxx:738
FL_EXPORT char * fl_getcwd(char *buf, int maxlen)
Cross-platform function to get the current working directory as a UTF-8 encoded value.
Definition: fl_utf8.cxx:699
FL_EXPORT unsigned fl_utf8toa(const char *src, unsigned srclen, char *dst, unsigned dstlen)
Definition: fl_utf.c:556
FL_EXPORT int fl_chmod(const char *f, int mode)
Cross-platform function to set a files mode() with a UTF-8 encoded name or value.
Definition: fl_utf8.cxx:609
FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n)
UTF-8 aware strncasecmp - converts to lower case Unicode and tests.
Definition: fl_utf8.cxx:193
FL_EXPORT int fl_utf8bytes(unsigned ucs)
Return the number of bytes needed to encode the given UCS4 character in UTF-8.
Definition: fl_utf.c:279
FL_EXPORT int fl_utf8len(char c)
Returns the byte length of the UTF-8 sequence with first byte c, or -1 if c is not valid.
Definition: fl_utf8.cxx:111
FL_EXPORT int fl_wcwidth(const char *src)
extended wrapper around fl_wcwidth_(unsigned int ucs) function.
Definition: fl_utf.c:980
FL_EXPORT int fl_utf_toupper(const unsigned char *str, int len, char *buf)
Converts the string str to its upper case equivalent into buf.
Definition: fl_utf8.cxx:275
FL_EXPORT unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen)
Definition: fl_utf.c:617
FL_EXPORT int fl_open(const char *f, int o,...)
Cross-platform function to open files with a UTF-8 encoded name.
Definition: fl_utf8.cxx:461
FL_EXPORT int fl_system(const char *f)
Cross-platform function to run a system command with a UTF-8 encoded string.
Definition: fl_utf8.cxx:534
FL_EXPORT int fl_stat(const char *path, struct stat *buffer)
Cross-platform function to stat() a file using a UTF-8 encoded name or value.
Definition: fl_utf8.cxx:669
FL_EXPORT unsigned fl_utf8toUtf16(const char *src, unsigned srclen, unsigned short *dst, unsigned dstlen)
Definition: fl_utf.c:432
FL_EXPORT int fl_utf8locale(void)
Definition: fl_utf.c:751
FL_EXPORT int fl_rename(const char *f, const char *t)
Cross-platform function to rename a filesystem object using UTF-8 encoded names.
Definition: fl_utf8.cxx:827
FL_EXPORT unsigned fl_utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen)
Definition: fl_utf.c:784
FL_EXPORT int fl_tolower(unsigned int ucs)
Returns the Unicode lower case value of ucs.
Definition: fl_utf8.cxx:229
FL_EXPORT unsigned int fl_nonspacing(unsigned int ucs)
Returns true if the Unicode character ucs is non-spacing.
Definition: fl_utf8.cxx:313
FL_EXPORT int fl_mkdir(const char *f, int mode)
Cross-platform function to create a directory with a UTF-8 encoded name.
Definition: fl_utf8.cxx:768
FL_EXPORT int fl_access(const char *f, int mode)
Cross-platform function to test a files access() with a UTF-8 encoded name or value.
Definition: fl_utf8.cxx:639
FL_EXPORT int fl_wcwidth_(unsigned int ucs)
wrapper to adapt Markus Kuhn's implementation of wcwidth() for FLTK
Definition: fl_utf.c:963
FL_EXPORT const char * fl_utf8fwd(const char *p, const char *start, const char *end)
Definition: fl_utf.c:229
FL_EXPORT FILE * fl_fopen(const char *f, const char *mode)
Cross-platform function to open files with a UTF-8 encoded name.
Definition: fl_utf8.cxx:498
FL_EXPORT char * fl_utf2mbcs(const char *src)
Converts UTF-8 string s to a local multi-byte character string.
Definition: fl_utf8.cxx:384
FL_EXPORT char fl_make_path(const char *path)
Cross-platform function to recursively create a path in the file system.
Definition: fl_utf8.cxx:857
FL_EXPORT int fl_utf8test(const char *src, unsigned len)
Definition: fl_utf.c:925
FL_EXPORT int fl_toupper(unsigned int ucs)
Returns the Unicode upper case value of ucs.
Definition: fl_utf8.cxx:237
FL_EXPORT unsigned fl_utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen)
Converts a UTF-8 string into a wide character string.
Definition: fl_utf.c:500
FL_EXPORT int fl_utf_tolower(const unsigned char *str, int len, char *buf)
Converts the string str to its lower case equivalent into buf.
Definition: fl_utf8.cxx:246
FL_EXPORT int fl_rmdir(const char *f)
Cross-platform function to remove a directory with a UTF-8 encoded name.
Definition: fl_utf8.cxx:797
FL_EXPORT const char * fl_utf8back(const char *p, const char *start, const char *end)
Definition: fl_utf.c:260
FL_EXPORT int fl_utf_strcasecmp(const char *s1, const char *s2)
UTF-8 aware strcasecmp - converts to Unicode and tests.
Definition: fl_utf8.cxx:221
FL_EXPORT unsigned fl_utf8decode(const char *p, const char *end, int *len)
Definition: fl_utf.c:137
FL_EXPORT unsigned fl_ucs_to_Utf16(const unsigned ucs, unsigned short *dst, const unsigned dstlen)
Definition: fl_utf.c:363
FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen)
Definition: fl_utf.c:858
FL_EXPORT int fl_utf8encode(unsigned ucs, char *buf)
Definition: fl_utf.c:309
FL_EXPORT unsigned fl_utf8froma(char *dst, unsigned dstlen, const char *src, unsigned srclen)
Definition: fl_utf.c:705
FL_EXPORT void fl_make_path_for_file(const char *path)
Cross-platform function to create a path for the file in the file system.
Definition: fl_utf8.cxx:878
FL_EXPORT int fl_utf8len1(char c)
Returns the byte length of the UTF-8 sequence with first byte c, or 1 if c is not valid.
Definition: fl_utf8.cxx:141
FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len)
Returns the number of Unicode chars in the UTF-8 string.
Definition: fl_utf8.cxx:167