Fixes for SGI builds (STR#2174)

1) C++ style comments in C files converted to /* */
   2) #warning's had to be #ifdef'ed out (#if !defined(sgi)..)
With these mods, 1.3.x compiles on IRIX 6.5 with no failures.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6680 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2009-03-14 02:11:31 +00:00
parent 923479622f
commit 50a92455fe
16 changed files with 236 additions and 224 deletions

View File

@ -33,7 +33,7 @@
/** \addtogroup filenames File names and URI utility functions
@{ */
# define FL_PATH_MAX 256 ///< all path buffers should use this length
# define FL_PATH_MAX 256 /**< all path buffers should use this length */
/** Gets the file name from a path. \return a pointer to the char after the last slash, or to \a filename if there is none. */
FL_EXPORT const char *fl_filename_name(const char * filename);
FL_EXPORT const char *fl_filename_ext(const char *);
@ -105,7 +105,7 @@ FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
# endif
typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); ///< File sorting function. \see fl_filename_list()
typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); /**< File sorting function. \see fl_filename_list() */
# if defined(__cplusplus)
}

View File

@ -1,29 +1,29 @@
//
// "$Id: fl_types.h 6299 2008-09-18 19:09:34Z fabien $"
//
// Simple "C"-style types for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
/*
* "$Id: fl_types.h 6299 2008-09-18 19:09:34Z fabien $"
*
* Simple "C"-style types for the Fast Light Tool Kit (FLTK).
*
* Copyright 1998-2009 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
/** \file
* This file contains simple "C"-style type definitions.
@ -33,7 +33,7 @@
#define FL_TYPES_H
/** \name Miscellaneous */
/*@{*/ // group: Miscellaneous
/*@{*/ /* group: Miscellaneous */
/** unsigned char */
typedef unsigned char uchar;
@ -54,10 +54,10 @@ typedef const char *Fl_CString;
/** 24-bit Unicode character + 8-bit indicator for keyboard flags */
typedef unsigned int Fl_Unichar;
/*@}*/ // group: Miscellaneous
/*@}*/ /* group: Miscellaneous */
#endif
//
// End of "$Id: fl_types.h 6299 2008-09-18 19:09:34Z fabien $".
//
/*
* End of "$Id: fl_types.h 6299 2008-09-18 19:09:34Z fabien $".
*/

View File

@ -1,31 +1,32 @@
// "$Id: $"
//
// Author: Jean-Marc Lienher ( http://oksid.ch )
// Copyright 2000-2009 by O'ksi'D.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
/* "$Id: $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2009 by O'ksi'D.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
// Merged in some functionality from the fltk-2 version. IMM.
// The following code is an attempt to merge the functions incorporated in FLTK2
// with the functions provided in OksiD's fltk-1.1.6-utf8 port
/* Merged in some functionality from the fltk-2 version. IMM.
* The following code is an attempt to merge the functions incorporated in FLTK2
* with the functions provided in OksiD's fltk-1.1.6-utf8 port
*/
/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/
@ -115,12 +116,12 @@ FL_EXPORT unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src,
/* F2: Convert a UTF8 string into ASCII, eliding untranslatable glyphs */
FL_EXPORT unsigned fl_utf8toa (const char *src, unsigned srclen, char *dst, unsigned dstlen);
/* OD: convert UTF-8 string to latin1 */
//FL_EXPORT int fl_utf2latin1(const unsigned char *src, int srclen, char *dst);
/* FL_EXPORT int fl_utf2latin1(const unsigned char *src, int srclen, char *dst); */
/* F2: Convert 8859-1 string to UTF8 */
FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen);
/* OD: convert latin1 str to UTF-8 */
//FL_EXPORT int fl_latin12utf(const unsigned char *src, int srclen, char *dst);
/* FL_EXPORT int fl_latin12utf(const unsigned char *src, int srclen, char *dst); */
/* F2: Returns true if the current O/S locale is UTF8 */
FL_EXPORT int fl_utf8locale();
@ -141,7 +142,7 @@ FL_EXPORT char* fl_utf2mbcs(const char *src);
/* F2: Convert a local multi-byte encoding to UTF8 - mainly for win32? */
FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen);
/* OD: Convert a local multi-byte encoding to UTF8 */
//FL_EXPORT char* fl_mbcs2utf(const char *src);
/* FL_EXPORT char* fl_mbcs2utf(const char *src); */
/*****************************************************************************/
#ifdef WIN32
@ -152,9 +153,10 @@ FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage)
FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage);
#endif
/*****************************************************************************/
// The following functions are intended to provide portable, UTF8 aware
// versions of standard functions
/*****************************************************************************
* The following functions are intended to provide portable, UTF8 aware
* versions of standard functions
*/
/* OD: UTF8 aware strncasecmp - converts to lower case Unicode and tests */
FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n);
@ -227,8 +229,8 @@ FL_EXPORT char fl_make_path( const char *path );
#endif /* __cplusplus */
#endif // _HAVE_FL_UTF8_HDR_
#endif /* _HAVE_FL_UTF8_HDR_ */
//
// End of "$Id: $".
//
/*
* End of "$Id: $".
*/

View File

@ -64,7 +64,7 @@ extern int main(int, char *[]);
# define __argv _argv
# endif /* BORLAND5 */
//static int mbcs2utf(const char *s, int l, char *dst, unsigned dstlen)
/* static int mbcs2utf(const char *s, int l, char *dst, unsigned dstlen) */
static int mbcs2utf(const char *s, int l, char *dst)
{
static xchar *mbwbuf;
@ -73,7 +73,7 @@ static int mbcs2utf(const char *s, int l, char *dst)
dstlen = (l * 6) + 6;
mbwbuf = (xchar*)malloc(dstlen * sizeof(xchar));
l = mbstowcs(mbwbuf, s, l);
//l = fl_unicode2utf(mbwbuf, l, dst);
/* l = fl_unicode2utf(mbwbuf, l, dst); */
l = fl_utf8fromwc(dst, dstlen, mbwbuf, l);
dst[l] = 0;
free(mbwbuf);
@ -108,17 +108,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
int l;
unsigned dstlen;
if (__wargv ) {
for (l = 0; __wargv[i] && __wargv[i][l]; l++) {}; // is this just wstrlen???
for (l = 0; __wargv[i] && __wargv[i][l]; l++) {}; /* is this just wstrlen??? */
dstlen = (l * 5) + 1;
ar[i] = (char*) malloc(dstlen);
// ar[i][fl_unicode2utf(__wargv[i], l, ar[i])] = 0;
/* ar[i][fl_unicode2utf(__wargv[i], l, ar[i])] = 0; */
dstlen = fl_utf8fromwc(ar[i], dstlen, __wargv[i], l);
ar[i][dstlen] = 0;
} else {
for (l = 0; __argv[i] && __argv[i][l]; l++) {};
dstlen = (l * 5) + 1;
ar[i] = (char*) malloc(dstlen);
// ar[i][mbcs2utf(__argv[i], l, ar[i], dstlen)] = 0;
/* ar[i][mbcs2utf(__argv[i], l, ar[i], dstlen)] = 0; */
ar[i][mbcs2utf(__argv[i], l, ar[i])] = 0;
}
i++;
@ -139,7 +139,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
#elif defined(__hpux)
/* This code to prevent "empty translation unit" or similar warnings... */
static void dummy(void) {}
#endif // WIN32 && !FL_DLL && !__GNUC__
#endif /* WIN32 && !FL_DLL && !__GNUC__ */
/*
* End of "$Id$".

View File

@ -298,7 +298,11 @@ double fl_width(unsigned int c) {
void fl_text_extents(const char *c, int n, int &dx, int &dy, int &W, int &H) {
#if !defined(WIN32) && !defined(sgi) || defined(CYGWIN)
#warning fl_text_extents is only a test stub in Xlib build at present
#endif
W = 0; H = 0;
fl_measure(c, W, H, 0);
dx = 0;

View File

@ -22,7 +22,7 @@
* http://www.fltk.org/str.php
*/
// Modified to obey rfc3629, which limits unicode to 0-0x10ffff
/* Modified to obey rfc3629, which limits unicode to 0-0x10ffff */
#include <FL/fl_utf8.h>
#include <string.h>
@ -41,7 +41,7 @@
\c NULL, only the length of the utf-8 sequence is calculated
\return length of the sequence in bytes
*/
//FL_EXPORT int fl_unichar_to_utf8(Fl_Unichar uc, char *text);
/* FL_EXPORT int fl_unichar_to_utf8(Fl_Unichar uc, char *text); */
/** @} */
@ -55,10 +55,10 @@
\param[in] uc Unicode character
\return length of the sequence in bytes
*/
//FL_EXPORT int fl_utf8_size(Fl_Unichar uc);
/* FL_EXPORT int fl_utf8_size(Fl_Unichar uc); */
/** @} */
#endif // 0
#endif /* 0 */
/* Set to 1 to turn bad UTF8 bytes into ISO-8859-1. If this is to zero
they are instead turned into the Unicode REPLACEMENT CHARACTER, of
@ -87,8 +87,9 @@
#define STRICT_RFC3629 0
#if ERRORS_TO_CP1252
// Codes 0x80..0x9f from the Microsoft CP1252 character set, translated
// to Unicode:
/* Codes 0x80..0x9f from the Microsoft CP1252 character set, translated
* to Unicode:
*/
static unsigned short cp1252[32] = {
0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
@ -153,11 +154,11 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
goto UTF8_3;
#if STRICT_RFC3629
} else if (c == 0xed) {
// RFC 3629 says surrogate chars are illegal.
/* RFC 3629 says surrogate chars are illegal. */
if (((unsigned char*)p)[1] >= 0xa0) goto FAIL;
goto UTF8_3;
} else if (c == 0xef) {
// 0xfffe and 0xffff are also illegal characters
/* 0xfffe and 0xffff are also illegal characters */
if (((unsigned char*)p)[1]==0xbf &&
((unsigned char*)p)[2]>=0xbe) goto FAIL;
goto UTF8_3;
@ -178,7 +179,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
if (p+3 >= end || (p[2]&0xc0) != 0x80 || (p[3]&0xc0) != 0x80) goto FAIL;
*len = 4;
#if STRICT_RFC3629
// RFC 3629 says all codes ending in fffe or ffff are illegal:
/* RFC 3629 says all codes ending in fffe or ffff are illegal: */
if ((p[1]&0xf)==0xf &&
((unsigned char*)p)[2] == 0xbf &&
((unsigned char*)p)[3] >= 0xbe) goto FAIL;
@ -189,7 +190,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
((p[2] & 0x3f) << 6) +
((p[3] & 0x3f));
} else if (c == 0xf4) {
if (((unsigned char*)p)[1] > 0x8f) goto FAIL; // after 0x10ffff
if (((unsigned char*)p)[1] > 0x8f) goto FAIL; /* after 0x10ffff */
goto UTF8_4;
} else {
FAIL:
@ -197,7 +198,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
#if ERRORS_TO_ISO8859_1
return c;
#else
return 0xfffd; // Unicode REPLACEMENT CHARACTER
return 0xfffd; /* Unicode REPLACEMENT CHARACTER */
#endif
}
}
@ -224,9 +225,9 @@ const char* fl_utf8fwd(const char* p, const char* start, const char* end)
{
const char* a;
int len;
// if we are not pointing at a continuation character, we are done:
/* if we are not pointing at a continuation character, we are done: */
if ((*p&0xc0) != 0x80) return p;
// search backwards for a 0xc0 starting the character:
/* search backwards for a 0xc0 starting the character: */
for (a = p-1; ; --a) {
if (a < start) return p;
if (!(a[0]&0x80)) return p;
@ -255,9 +256,9 @@ const char* fl_utf8back(const char* p, const char* start, const char* end)
{
const char* a;
int len;
// if we are not pointing at a continuation character, we are done:
/* if we are not pointing at a continuation character, we are done: */
if ((*p&0xc0) != 0x80) return p;
// search backwards for a 0xc0 starting the character:
/* search backwards for a 0xc0 starting the character: */
for (a = p-1; ; --a) {
if (a < start) return p;
if (!(a[0]&0x80)) return p;
@ -280,7 +281,7 @@ int fl_utf8bytes(unsigned ucs) {
} else if (ucs < 0x10ffffU) {
return 4;
} else {
return 3; // length of the illegal character encoding
return 3; /* length of the illegal character encoding */
}
}
@ -320,7 +321,7 @@ int fl_utf8encode(unsigned ucs, char* buf) {
buf[3] = 0x80 | (ucs & 0x3F);
return 4;
} else {
// encode 0xfffd:
/* encode 0xfffd: */
buf[0] = 0xefU;
buf[1] = 0xbfU;
buf[2] = 0xbdU;
@ -367,7 +368,7 @@ unsigned fl_utf8toUtf16(const char* src, unsigned srclen,
unsigned count = 0;
if (dstlen) for (;;) {
if (p >= e) {dst[count] = 0; return count;}
if (!(*p & 0x80)) { // ascii
if (!(*p & 0x80)) { /* ascii */
dst[count] = *p++;
} else {
int len; unsigned ucs = fl_utf8decode(p,e,&len);
@ -375,7 +376,7 @@ unsigned fl_utf8toUtf16(const char* src, unsigned srclen,
if (ucs < 0x10000) {
dst[count] = ucs;
} else {
// make a surrogate pair:
/* make a surrogate pair: */
if (count+2 >= dstlen) {dst[count] = 0; count += 2; break;}
dst[count] = (((ucs-0x10000u)>>10)&0x3ff) | 0xd800;
dst[++count] = (ucs&0x3ff) | 0xdc00;
@ -383,7 +384,7 @@ unsigned fl_utf8toUtf16(const char* src, unsigned srclen,
}
if (++count == dstlen) {dst[count-1] = 0; break;}
}
// we filled dst, measure the rest:
/* we filled dst, measure the rest: */
while (p < e) {
if (!(*p & 0x80)) p++;
else {
@ -410,7 +411,7 @@ unsigned fl_utf8towc(const char* src, unsigned srclen,
unsigned count = 0;
if (dstlen) for (;;) {
if (p >= e) {dst[count] = 0; return count;}
if (!(*p & 0x80)) { // ascii
if (!(*p & 0x80)) { /* ascii */
dst[count] = *p++;
} else {
int len; unsigned ucs = fl_utf8decode(p,e,&len);
@ -419,7 +420,7 @@ unsigned fl_utf8towc(const char* src, unsigned srclen,
}
if (++count == dstlen) {dst[count-1] = 0; break;}
}
// we filled dst, measure the rest:
/* we filled dst, measure the rest: */
while (p < e) {
if (!(*p & 0x80)) p++;
else {
@ -462,7 +463,7 @@ unsigned fl_utf8toa(const char* src, unsigned srclen,
unsigned char c;
if (p >= e) {dst[count] = 0; return count;}
c = *(unsigned char*)p;
if (c < 0xC2) { // ascii or bad code
if (c < 0xC2) { /* ascii or bad code */
dst[count] = c;
p++;
} else {
@ -473,7 +474,7 @@ unsigned fl_utf8toa(const char* src, unsigned srclen,
}
if (++count >= dstlen) {dst[count-1] = 0; break;}
}
// we filled dst, measure the rest:
/* we filled dst, measure the rest: */
while (p < e) {
if (!(*p & 0x80)) p++;
else {
@ -524,17 +525,17 @@ unsigned fl_utf8fromwc(char* dst, unsigned dstlen,
if (ucs < 0x80U) {
dst[count++] = ucs;
if (count >= dstlen) {dst[count-1] = 0; break;}
} else if (ucs < 0x800U) { // 2 bytes
} else if (ucs < 0x800U) { /* 2 bytes */
if (count+2 >= dstlen) {dst[count] = 0; count += 2; break;}
dst[count++] = 0xc0 | (ucs >> 6);
dst[count++] = 0x80 | (ucs & 0x3F);
#ifdef _WIN32
} else if (ucs >= 0xd800 && ucs <= 0xdbff && i < srclen &&
src[i] >= 0xdc00 && src[i] <= 0xdfff) {
// surrogate pair
/* surrogate pair */
unsigned ucs2 = src[i++];
ucs = 0x10000U + ((ucs&0x3ff)<<10) + (ucs2&0x3ff);
// all surrogate pairs turn into 4-byte utf8
/* all surrogate pairs turn into 4-byte utf8 */
#else
} else if (ucs >= 0x10000) {
if (ucs > 0x10ffff) {
@ -551,24 +552,24 @@ unsigned fl_utf8fromwc(char* dst, unsigned dstlen,
#ifndef _WIN32
J1:
#endif
// all others are 3 bytes:
/* all others are 3 bytes: */
if (count+3 >= dstlen) {dst[count] = 0; count += 3; break;}
dst[count++] = 0xe0 | (ucs >> 12);
dst[count++] = 0x80 | ((ucs >> 6) & 0x3F);
dst[count++] = 0x80 | (ucs & 0x3F);
}
}
// we filled dst, measure the rest:
/* we filled dst, measure the rest: */
while (i < srclen) {
unsigned ucs = src[i++];
if (ucs < 0x80U) {
count++;
} else if (ucs < 0x800U) { // 2 bytes
} else if (ucs < 0x800U) { /* 2 bytes */
count += 2;
#ifdef _WIN32
} else if (ucs >= 0xd800 && ucs <= 0xdbff && i < srclen-1 &&
src[i+1] >= 0xdc00 && src[i+1] <= 0xdfff) {
// surrogate pair
/* surrogate pair */
++i;
#else
} else if (ucs >= 0x10000 && ucs <= 0x10ffff) {
@ -613,13 +614,13 @@ unsigned fl_utf8froma(char* dst, unsigned dstlen,
if (ucs < 0x80U) {
dst[count++] = ucs;
if (count >= dstlen) {dst[count-1] = 0; break;}
} else { // 2 bytes (note that CP1252 translate could make 3 bytes!)
} else { /* 2 bytes (note that CP1252 translate could make 3 bytes!) */
if (count+2 >= dstlen) {dst[count] = 0; count += 2; break;}
dst[count++] = 0xc0 | (ucs >> 6);
dst[count++] = 0x80 | (ucs & 0x3F);
}
}
// we filled dst, measure the rest:
/* we filled dst, measure the rest: */
while (p < e) {
unsigned char ucs = *(unsigned char*)p++;
if (ucs < 0x80U) {
@ -654,7 +655,7 @@ int fl_utf8locale(void) {
ret = GetACP() == CP_UTF8;
#else
char* s;
ret = 1; // assumme UTF-8 if no locale
ret = 1; /* assumme UTF-8 if no locale */
if (((s = getenv("LC_CTYPE")) && *s) ||
((s = getenv("LC_ALL")) && *s) ||
((s = getenv("LANG")) && *s)) {
@ -696,13 +697,14 @@ unsigned fl_utf8to_mb(const char* src, unsigned srclen,
fl_utf8towc(src, srclen, buf, length+1);
}
if (dstlen) {
// apparently this does not null-terminate, even though msdn
// documentation claims it does:
/* apparently this does not null-terminate, even though msdn
* documentation claims it does:
*/
ret =
WideCharToMultiByte(GetACP(), 0, buf, length, dst, dstlen, 0, 0);
dst[ret] = 0;
}
// if it overflows or measuring length, get the actual length:
/* if it overflows or measuring length, get the actual length: */
if (dstlen==0 || ret >= dstlen-1)
ret =
WideCharToMultiByte(GetACP(), 0, buf, length, 0, 0, 0, 0);
@ -725,10 +727,10 @@ unsigned fl_utf8to_mb(const char* src, unsigned srclen,
}
if (buf != lbuf) free((void*)buf);
if (ret >= 0) return (unsigned)ret;
// on any errors we return the UTF-8 as raw text...
/* on any errors we return the UTF-8 as raw text...*/
#endif
}
// identity transform:
/* identity transform: */
if (srclen < dstlen) {
memcpy(dst, src, srclen);
dst[srclen] = 0;
@ -792,10 +794,10 @@ unsigned fl_utf8from_mb(char* dst, unsigned dstlen,
if (buf != lbuf) free((void*)buf);
return ret;
}
// errors in conversion return the UTF-8 unchanged
/* errors in conversion return the UTF-8 unchanged */
#endif
}
// identity transform:
/* identity transform: */
if (srclen < dstlen) {
memcpy(dst, src, srclen);
dst[srclen] = 0;

View File

@ -51,13 +51,14 @@
# if defined(WIN32) && !defined(__CYGWIN__)
# define strcasecmp(s,t) _stricmp((s), (t))
# define strncasecmp(s,t,n) _strnicmp((s), (t), (n))
// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
// on Windows, which is supposed to be POSIX compliant... Some of these
// functions are also defined in ISO C99...
/* Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
* on Windows, which is supposed to be POSIX compliant... Some of these
* functions are also defined in ISO C99...
*/
# ifndef __WATCOMC__
# define strdup _strdup
# define unlink _unlink
# endif // !__WATCOMC__
# endif /* !__WATCOMC__ */
# elif defined(__EMX__)
# define strcasecmp(s,t) stricmp((s), (t))
# define strncasecmp(s,t,n) strnicmp((s), (t), (n))

View File

@ -114,7 +114,7 @@ void glutStrokeString(void* fontID, const unsigned char *string) {
* A newline will simply translate the next character's insertion
* point back to the start of the line and down one line.
*/
#if !defined(WIN32) || defined(CYGWIN)
#if !defined(WIN32) && !defined(sgi) || defined(CYGWIN)
#warning FIXME This needs to be UTF aware now
#endif

View File

@ -1,26 +1,27 @@
// "$Id: $"
//
// Author: Jean-Marc Lienher ( http://oksid.ch )
// Copyright 2000-2003 by O'ksi'D.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
/* "$Id: $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2003 by O'ksi'D.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
/*
* This file is required on all platforms for utf8 support

View File

@ -1,26 +1,27 @@
// "$Id: $"
//
// Author: Jean-Marc Lienher ( http://oksid.ch )
// Copyright 2000-2003 by O'ksi'D.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
/* "$Id: $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2003 by O'ksi'D.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
/*
* This file is required on all platforms for utf8 support

View File

@ -1,26 +1,27 @@
// "$Id: $"
//
// Author: Jean-Marc Lienher ( http://oksid.ch )
// Copyright 2000-2003 by O'ksi'D.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
/* "$Id: $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2003 by O'ksi'D.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
/*
* This file is required on all platforms for utf8 support

View File

@ -36,7 +36,7 @@ long XKeysymToUcs(KeySym keysym)
return (long) KeySymToUcs4(keysym);
}
#endif // X11 only
#endif /* X11 only */
/*
* End of "$Id$".

View File

@ -63,16 +63,16 @@ typedef struct {
#include "headers/dingbats_.h"
/*************** conv_gen.c ************/
//const
/*const*/
int ucs2fontmap(char *s, unsigned int ucs, int enc)
{
switch(enc) {
case 0: //iso10646-1
case 0: /* iso10646-1 */
s[0] = (char) ((ucs & 0xFF00) >> 8);
s[1] = (char) (ucs & 0xFF);
return 0;
break;
case 1: //iso8859-1
case 1: /* iso8859-1 */
if (ucs <= 0x00FF) {
if (ucs >= 0x0001) {
s[0] = 0;
@ -81,7 +81,7 @@ int ucs2fontmap(char *s, unsigned int ucs, int enc)
}
}
break;
case 2: //iso8859-2
case 2: /* iso8859-2 */
if (ucs <= 0x00a0) {
s[0] = 0;
s[1] = (char) ucs;
@ -100,102 +100,102 @@ int ucs2fontmap(char *s, unsigned int ucs, int enc)
}
}
break;
case 3: //iso8859-3
case 3: /* iso8859-3 */
if (iso8859_3_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 3;
}
break;
case 4: //iso8859-4
case 4: /* iso8859-4 */
if (iso8859_4_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 4;
}
break;
case 5: //iso8859-5
case 5: /* iso8859-5 */
if (iso8859_5_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 5;
}
break;
case 6: //iso8859-6
case 6: /* iso8859-6 */
if (iso8859_6_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 6;
}
break;
case 7: //iso8859-7
case 7: /* iso8859-7 */
if (iso8859_7_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 7;
}
break;
case 8: //iso8859-8
case 8: /* iso8859-8 */
if (iso8859_8_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 8;
}
break;
case 9: //iso8859-9
case 9: /* iso8859-9 */
if (iso8859_9_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 9;
}
break;
case 10: //iso8859-10
case 10: /* iso8859-10 */
if (iso8859_10_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 10;
}
break;
case 25: //iso8859-11
case 25: /* iso8859-11 */
if (iso8859_11_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 25;
}
break;
case 11: //iso8859-13
case 11: /* iso8859-13 */
if (iso8859_13_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 11;
}
break;
case 12: //iso8859-14
case 12: /* iso8859-14 */
if (iso8859_14_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 12;
}
break;
case 13: //iso8859-15
case 13: /* iso8859-15 */
if (iso8859_15_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 13;
}
break;
case 14: //koi8-r
case 14: /* koi8-r */
if (koi8_r_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 14;
}
break;
case 15: //big5
case 15: /* big5 */
if (big5_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 15;
}
break;
case 16: //ksc5601.1987-0
case 16: /* ksc5601.1987-0 */
if (ksc5601_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 16;
}
break;
case 17: //gb2312.1980-0
case 17: /* gb2312.1980-0 */
if (gb2312_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 17;
}
break;
case 18: //jisx0201.1976-0
case 18: /* jisx0201.1976-0 */
if (jisx0201_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 18;
}
break;
case 19: //jisx0208.1983-0
case 19: /* jisx0208.1983-0 */
if (jisx0208_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 19;
}
break;
case 20: //jisx0212.1990-0
case 20: /* jisx0212.1990-0 */
if (jisx0212_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 20;
}
break;
case 21: //symbol
case 21: /* symbol */
if (ucs <= 0x00F7) {
if (ucs >= 0x0020) {
s[0] = 0;
@ -246,7 +246,7 @@ int ucs2fontmap(char *s, unsigned int ucs, int enc)
}
}
break;
case 22: //dingbats
case 22: /* dingbats */
if (ucs <= 0x00A0) {
if (ucs >= 0x0020) {
s[0] = 0;
@ -285,12 +285,12 @@ int ucs2fontmap(char *s, unsigned int ucs, int enc)
}
}
break;
case 23: //koi8-u
case 23: /* koi8-u */
if (koi8_u_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 23;
}
break;
case 24: //microsoft-cp1251
case 24: /* microsoft-cp1251 */
if (cp1251_wctomb(NULL, (unsigned char*)s, ucs, 2) > 0) {
return 24;
}
@ -301,7 +301,7 @@ int ucs2fontmap(char *s, unsigned int ucs, int enc)
return -1;
};
//const
/*const*/
int encoding_number(const char *enc)
{
if (!enc || !strncmp(enc, "iso10646-1", 10)) {

View File

@ -367,7 +367,7 @@ XConvertEucToUtf8(
if (strstr(locale, "ja")) {
return XConvertEucJpToUtf8(buffer_return, len);
} else if (strstr(locale, "Big5") || strstr(locale, "big5")) { // BIG5
} else if (strstr(locale, "Big5") || strstr(locale, "big5")) { /* BIG5 */
return XConvertBig5ToUtf8(buffer_return, len);
} else if (strstr(locale, "zh") || strstr(locale, "chinese-")) {
if (strstr(locale, "TW") || strstr(locale, "chinese-t")) {
@ -432,7 +432,7 @@ XUtf8LookupString(
return len;
}
#endif // X11 only
#endif /* X11 only */
/*
* End of "$Id$".

View File

@ -240,7 +240,7 @@ XFastConvertUtf8ToUcs(
return -1;
}
#endif // X11 only
#endif /* X11 only */
/*
* End of "$Id: $".

View File

@ -915,7 +915,7 @@ XFreeUtf8FontStruct(
free(font_set);
}
#endif // X11 only
#endif /* X11 only */
/*
* End of "$Id: $".