blob: b354b765901f25411275b0a5e116d8cd511c1607 [file] [log] [blame] [raw]
/* A part of the Native C Library for Windows NT
Copyright 2007-2015 PC GO Ld.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program 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 General Public License for more details.
*/
#define __NO_CTYPE
#include <ctype.h>
static const unsigned short int *_ctype_b =
/* 0x00 */ (unsigned short int *)"\002\000" "\002\000" "\002\000" "\002\000"
/* 0x04 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\003\040"
/* 0x0a */ "\002\040" "\002\040" "\002\040" "\002\040" "\002\000" "\002\000"
/* 0x10 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
/* 0x16 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
/* 0x1c */ "\002\000" "\002\000" "\002\000" "\002\000" "\001\140" "\004\300"
/* 0x22 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
/* 0x28 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
/* 0x2e */ "\004\300" "\004\300" "\010\330" "\010\330" "\010\330" "\010\330"
/* 0x34 */ "\010\330" "\010\330" "\010\330" "\010\330" "\010\330" "\010\330"
/* 0x3a */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
/* 0x40 */ "\004\300" "\010\325" "\010\325" "\010\325" "\010\325" "\010\325"
/* 0x46 */ "\010\325" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
/* 0x4c */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
/* 0x52 */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
/* 0x58 */ "\010\305" "\010\305" "\010\305" "\004\300" "\004\300" "\004\300"
/* 0x5e */ "\004\300" "\004\300" "\004\300" "\010\326" "\010\326" "\010\326"
/* 0x64 */ "\010\326" "\010\326" "\010\326" "\010\306" "\010\306" "\010\306"
/* 0x6a */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
/* 0x70 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
/* 0x76 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\004\300"
/* 0x7c */ "\004\300" "\004\300" "\004\300" "\002\000" "\000\000" "\000\000"
/* 0x82 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0x88 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0x8e */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0x94 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0x9a */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xa0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xa6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xac */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xb2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xb8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xbe */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xc4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xca */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xd0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xd6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xdc */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xe2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xe8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xee */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xf4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
/* 0xfa */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000";
#if 0
const unsigned short int **__ctype_b() {
return &_ctype_b;
}
#else
int __isctype(int c, unsigned short int type) {
if(c < 0) return 0;
return _ctype_b[c] & type;
}
#endif
#define DEFINE_CTYPE_FUNCTION(N, T) int N(int c) { return __isctype(c, T); }
DEFINE_CTYPE_FUNCTION(isalnum, _ISalnum)
//DEFINE_CTYPE_FUNCTION(isalpha, _ISalpha)
DEFINE_CTYPE_FUNCTION(isblank, _ISblank)
DEFINE_CTYPE_FUNCTION(iscntrl, _IScntrl)
//DEFINE_CTYPE_FUNCTION(isdigit, _ISdigit)
//DEFINE_CTYPE_FUNCTION(islower, _ISlower)
DEFINE_CTYPE_FUNCTION(isgraph, _ISgraph)
//DEFINE_CTYPE_FUNCTION(isprint, _ISprint)
DEFINE_CTYPE_FUNCTION(ispunct, _ISpunct)
//DEFINE_CTYPE_FUNCTION(isspace, _ISspace)
//DEFINE_CTYPE_FUNCTION(isupper, _ISupper)
//DEFINE_CTYPE_FUNCTION(isxdigit, _ISxdigit)
int tolower(int c) {
if(c < -128 || c > 255) return c;
if(!isupper(c)) return c;
return c + ('a' - 'A');
}
int toupper(int c) {
if(c < -128 || c > 255) return c;
if(!islower(c)) return c;
return c - ('a' - 'A');
}