fltk
1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Fossies Dox: fltk-1.3.5-source.tar.bz2 ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 24 #if defined(WIN32) || defined(__CYGWIN__) 32 # include <sys/types.h> 33 # include <sys/stat.h> 43 #elif defined(__APPLE__) 51 # include <sys/types.h> 52 # include <sys/stat.h> 59 #else // X-windows platform 62 # include <sys/types.h> 63 # include <sys/stat.h> 82 #define NBC 0xFFFF + 1 90 sizeof(
unsigned short) * (
NBC));
91 for (i = 0; i <
NBC; i++) {
92 table[i] = (
unsigned short) i;
94 for (i = 0; i <
NBC; i++) {
97 if (l != i)
table[l] = (
unsigned short) i;
100 if (ucs >=
NBC || ucs < 0)
return ucs;
113 if (!(c & 0x80))
return 1;
143 if (!(c & 0x80))
return 1;
168 const unsigned char *
buf,
196 for (i = 0; i < n; i++) {
200 if (*s1==0 && *s2==0)
return 0;
250 char *end = (
char *)&str[len];
251 for (i = 0; i < len;) {
279 char *end = (
char *)&str[len];
280 for (i = 0; i < len;) {
322 #if defined (WIN32) && !defined(__CYGWIN__) 334 static int buf_len = 0;
335 static unsigned short *wbufa =
NULL;
338 char *fl_utf8_to_locale(
const char *s,
int len, UINT codepage)
340 if (!s)
return (
char *)
"";
344 if (wn >= (
unsigned)buf_len) {
346 buf = (
char*) realloc(
buf, buf_len);
347 wbufa = (
unsigned short*) realloc(wbufa, buf_len *
sizeof(
short));
353 l = WideCharToMultiByte(codepage, 0, (WCHAR*)wbufa, l,
buf, buf_len,
NULL,
NULL);
360 char *fl_locale_to_utf8(
const char *s,
int len, UINT codepage)
362 if (!s)
return (
char *)
"";
364 if (buf_len < len * 5 + 1) {
365 buf_len = len * 5 + 1;
366 buf = (
char*) realloc(
buf, buf_len);
367 wbufa = (
unsigned short*) realloc(wbufa, buf_len *
sizeof(
short));
372 l = MultiByteToWideChar(codepage, 0, s, len, (WCHAR*)wbufa, buf_len);
388 #if defined(WIN32) && !defined(__CYGWIN__) 390 size_t l = strlen(s);
394 mbwbuf = (
xchar*)realloc(mbwbuf,
sizeof(
xchar)*wn);
395 l =
fl_utf8toUtf16(s, (
unsigned) l, (
unsigned short *)mbwbuf, wn);
398 buf = (
char*)realloc(
buf, (
unsigned) (l * 6 + 1));
399 l = (unsigned) wcstombs(
buf, mbwbuf, (
unsigned) l * 6);
423 #if defined (WIN32) && !defined(__CYGWIN__) 425 size_t l = strlen(v);
427 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
430 xchar *ret = _wgetenv(wbuf);
433 l = (unsigned) wcslen(ret);
435 buf = (
char*) realloc(
buf, wn);
465 va_start(ap, oflags);
466 pmode = va_arg (ap,
int);
469 #if defined (WIN32) && !defined(__CYGWIN__) 471 unsigned l = (unsigned) strlen(
f);
473 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
476 if (pmode == -1)
return _wopen(wbuf, oflags);
477 else return _wopen(wbuf, oflags, pmode);
481 if (pmode == -1)
return open(
f, oflags);
482 else return open(
f, oflags, pmode);
500 #if defined (WIN32) && !defined(__CYGWIN__) 502 size_t l = strlen(
f);
504 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
509 wbuf1 = (
xchar*)realloc(wbuf1,
sizeof(
xchar)*wn);
510 wn =
fl_utf8toUtf16(mode, (
unsigned) l, (
unsigned short *)wbuf1, wn);
512 return _wfopen(wbuf, wbuf1);
516 return fopen(
f, mode);
536 #if defined(WIN32) && !defined(__CYGWIN__) 541 size_t l = strlen(cmd);
543 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
544 wn =
fl_utf8toUtf16(cmd, (
unsigned) l, (
unsigned short *)wbuf, wn);
546 return _wsystem(wbuf);
556 #if defined(WIN32) && !defined(__CYGWIN__) // Windows 561 size_t l = strlen(file);
565 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
566 wn =
fl_utf8toUtf16(file, (
unsigned) l, (
unsigned short *)wbuf, wn);
570 while (argv[i]) {i++; n++;}
578 wn =
fl_utf8toUtf16(argv[i], (
unsigned) l, (
unsigned short *)ar[i], wn);
593 #else // other platforms 594 return execvp(file, argv);
611 #if defined(WIN32) && !defined(__CYGWIN__) // Windows 613 size_t l = strlen(
f);
615 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
618 return _wchmod(wbuf, mode);
620 #else // other platforms 622 return chmod(
f, mode);
641 #if defined (WIN32) && !defined(__CYGWIN__) // Windows 643 size_t l = strlen(
f);
645 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
648 return _waccess(wbuf, mode);
650 #else // other platforms 652 return access(
f, mode);
671 #if defined(WIN32) && !defined(__CYGWIN__) // Windows 673 size_t l = strlen(
f);
675 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
678 return _wstat(wbuf, (
struct _stat*)
b);
680 #else // other platforms 705 #if defined(WIN32) && !defined(__CYGWIN__) // Windows 708 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar) * (l+1));
709 xchar *ret = _wgetcwd(wbuf, l);
712 l = (int) wcslen(wbuf);
720 #else // other platforms 740 #if defined(WIN32) && !defined(__CYGWIN__) // Windows 742 size_t l = strlen(
f);
744 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
747 return _wunlink(wbuf);
749 #else // other platforms 770 #if defined(WIN32) && !defined(__CYGWIN__) // Windows 772 size_t l = strlen(
f);
774 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
777 return _wmkdir(wbuf);
779 #else // other platforms 781 return mkdir(
f, mode);
799 #if defined (WIN32) && !defined(__CYGWIN__) // Windows 801 size_t l = strlen(
f);
803 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
806 return _wrmdir(wbuf);
829 #if defined (WIN32) && !defined(__CYGWIN__) // Windows 831 size_t l = strlen(
f);
833 wbuf = (
xchar*)realloc(wbuf,
sizeof(
xchar)*wn);
838 wbuf1 = (
xchar*)realloc(wbuf1,
sizeof(
xchar)*wn);
839 wn =
fl_utf8toUtf16(n, (
unsigned) l, (
unsigned short *)wbuf1, wn);
841 return _wrename(wbuf, wbuf1);
859 const char *s = strrchr( path,
'/' );
861 size_t len = (size_t) (s-path);
862 char *
p = (
char*)
malloc( len+1 );
863 memcpy(
p, path, len );
880 const char *s = strrchr( path,
'/' );
882 size_t len = (s-path);
883 char *
p = (
char*)
malloc( len+1 );
884 memcpy(
p, path, len );
char * fl_getcwd(char *buf, int maxlen)
int fl_system(const char *f)
unsigned fl_utf8toUtf16(const char *src, unsigned srclen, unsigned short *dst, unsigned dstlen)
int fl_utf_tolower(const unsigned char *str, int len, char *buf)
unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen)
int fl_utf_toupper(const unsigned char *str, int len, char *buf)
FILE * fl_fopen(const char *f, const char *mode)
int fl_open(const char *f, int o,...)
unsigned fl_utf8decode(const char *p, const char *end, int *len)
unsigned short XUtf8IsNonSpacing(unsigned int ucs)
header for Unicode and UTF-8 character handling
int XUtf8Tolower(int ucs)
int fl_chmod(const char *f, int mode)
int fl_stat(const char *path, struct stat *buffer)
int fl_rename(const char *f, const char *t)
char * fl_getenv(const char *name)
void fl_make_path_for_file(const char *path)
static int Toupper(int ucs)
int fl_utf_strncasecmp(const char *s1, const char *s2, int n)
int fl_utf_strcasecmp(const char *s1, const char *s2)
int fl_utf_nb_char(const unsigned char *buf, int len)
int fl_mkdir(const char *f, int mode)
int fl_access(const char *f, int mode)
int fl_utf8encode(unsigned ucs, char *buf)
int fl_toupper(unsigned int ucs)
unsigned int fl_nonspacing(unsigned int ucs)
int fl_rmdir(const char *f)
char * fl_utf2mbcs(const char *src)
char fl_make_path(const char *path)
int fl_tolower(unsigned int ucs)
int fl_unlink(const char *f)
int fl_execvp(const char *file, char *const *argv)