2003-04-16 08:38:17 +00:00
|
|
|
/* ------------------------------------------------------------------
|
|
|
|
* The Goldware Library
|
|
|
|
* Copyright (C) 1999 Alexander S. Aganichev
|
|
|
|
* ------------------------------------------------------------------
|
|
|
|
* 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 program; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307, USA
|
|
|
|
* ------------------------------------------------------------------
|
|
|
|
* $Id$
|
|
|
|
* ------------------------------------------------------------------
|
|
|
|
* Portable NLS functions for ctype.
|
|
|
|
* --------------------------------------------------------------- */
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
#ifndef __gctype_h
|
|
|
|
#define __gctype_h
|
|
|
|
|
|
|
|
|
2003-04-16 08:38:17 +00:00
|
|
|
/* --------------------------------------------------------------- */
|
2002-09-24 10:16:04 +00:00
|
|
|
|
|
|
|
#include <gcmpall.h>
|
|
|
|
|
|
|
|
|
2003-04-16 08:38:17 +00:00
|
|
|
/* --------------------------------------------------------------- */
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#define __USELOCALES__
|
|
|
|
#elif defined(__EMX__)
|
|
|
|
#define _CTYPE_FUN
|
|
|
|
#endif
|
|
|
|
#include <ctype.h>
|
|
|
|
#if defined(__EMX__)
|
|
|
|
#include <sys/nls.h>
|
2005-10-31 22:18:26 +00:00
|
|
|
#define g_tolower(c) _nls_tolower((uint8_t)(c))
|
|
|
|
#define g_toupper(c) _nls_toupper((uint8_t)(c))
|
2000-02-25 10:15:17 +00:00
|
|
|
#elif defined(__WIN32__)
|
2000-12-27 12:45:20 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
2000-02-25 10:15:17 +00:00
|
|
|
extern char tl[256], tu[256];
|
2005-10-31 22:18:26 +00:00
|
|
|
__inline__ int g_tolower(int c) { return tl[c]; }
|
|
|
|
__inline__ int g_toupper(int c) { return tu[c]; }
|
2000-12-27 12:45:20 +00:00
|
|
|
}
|
2002-09-30 12:22:31 +00:00
|
|
|
#else
|
|
|
|
extern char tl[256], tu[256];
|
2005-10-31 22:18:26 +00:00
|
|
|
#define g_tolower(c) tl[(int)(uint8_t)(c)]
|
|
|
|
#define g_toupper(c) tu[(int)(uint8_t)(c)]
|
2001-06-12 17:31:12 +00:00
|
|
|
#endif
|
2005-11-04 07:33:44 +00:00
|
|
|
#else
|
|
|
|
#define g_tolower(c) tolower(c)
|
|
|
|
#define g_toupper(c) toupper(c)
|
2000-12-27 12:45:20 +00:00
|
|
|
#endif
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
|
2003-04-16 08:38:17 +00:00
|
|
|
/* --------------------------------------------------------------- */
|
2000-02-25 10:15:17 +00:00
|
|
|
|
2003-04-16 08:38:17 +00:00
|
|
|
/* NLS chars detected by converting to lower or upper case and in case
|
|
|
|
* they don't match they treated as characters
|
|
|
|
*/
|
2002-10-05 21:13:23 +00:00
|
|
|
|
2000-12-27 12:45:20 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
2005-11-01 02:31:41 +00:00
|
|
|
#endif
|
2005-10-31 22:18:26 +00:00
|
|
|
|
2005-11-01 02:31:41 +00:00
|
|
|
#if defined(__WIN32__)
|
|
|
|
int g_islower(int c);
|
|
|
|
int g_isupper(int c);
|
|
|
|
int g_isalpha(int c);
|
2005-10-31 22:18:26 +00:00
|
|
|
#else
|
2005-11-05 21:31:49 +00:00
|
|
|
#define g_islower(c) islower(c)
|
|
|
|
#define g_isupper(c) isupper(c)
|
|
|
|
#define g_isalpha(c) isalpha(c)
|
2005-11-01 02:31:41 +00:00
|
|
|
#endif
|
2005-10-31 22:18:26 +00:00
|
|
|
|
2005-11-01 02:31:41 +00:00
|
|
|
int isxalnum(int c);
|
2005-10-31 22:18:26 +00:00
|
|
|
|
2000-12-27 12:45:20 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2000-02-25 10:15:17 +00:00
|
|
|
|
2003-03-29 21:51:19 +00:00
|
|
|
#ifdef __BEOS__
|
2003-04-16 08:38:17 +00:00
|
|
|
/* sz: there are some problems under BeOS with that function - symbols
|
|
|
|
* from second half of ASCII table are assumed as control ones ...
|
|
|
|
* This is a real disaster for cyrillic users ...
|
|
|
|
* It's also not possible to use setlocale() to change it's behaviour. =-(
|
|
|
|
*/
|
2005-11-01 02:31:41 +00:00
|
|
|
# undef iscntrl
|
2005-10-23 04:39:25 +00:00
|
|
|
# define iscntrl(c) ((c < 0x7f) ? __isctype((c), _IScntrl) : 0)
|
2003-04-16 12:57:46 +00:00
|
|
|
#endif /* __BEOS__ */
|
2000-02-25 10:15:17 +00:00
|
|
|
|
2003-04-16 08:38:17 +00:00
|
|
|
/* --------------------------------------------------------------- */
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2003-04-16 08:38:17 +00:00
|
|
|
/* --------------------------------------------------------------- */
|