Changeset f7428b1 in buchla-68k for include/ctype.h
- Timestamp:
- 07/10/2017 01:26:59 AM (7 years ago)
- Branches:
- master
- Children:
- 5fa506d
- Parents:
- c3aee8a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
include/ctype.h
rc3aee8a rf7428b1 10 10 the equivalent Lattice C macros. This means that isascii(c) should 11 11 be used if it is necessary to restrict the results to true ASCII. 12 13 If SYS5CODE is TRUE these macros will use the same table definitions14 as System 5 Unix(tm). In this case these behave well even when fed15 an EOF. The EOF character value, -1, is not defined as being in any16 of the classes tested for. If SYS5CODE is FALSE, the Alcyon table17 will be used, and EOF will not work properly.18 19 Define _CTYPE_C for compiling the ctype.c file, undefine otherwise.20 21 The symbol _ii_ is defined to be the base of the table used.22 12 23 13 isascii(c) non-zero if c is ASCII … … 46 36 _tolower(c) returns the lower case version of c 47 37 _toupper(c) returns the upper case version of c 48 49 tonumber(c) converts c from ASCII to integer50 38 ============================================================================ 51 39 */ … … 55 43 */ 56 44 57 #define SYS5CODE 0 /* define non-zero for System 5 / Aztec C */ 58 59 #if SYS5CODE 60 61 #define _ii_ _ctype+1 62 63 /* System 5 Unix(tm) / Aztec C table definitions */ 64 65 #define _U 0x01 /* upper case */ 66 #define _L 0x02 /* lower case */ 67 #define _N 0x04 /* numeric 0..9 */ 68 #define _S 0x08 /* whitespace */ 69 #define _P 0x10 /* punctuation */ 70 #define _C 0x20 /* control 00..1F */ 71 #define _B 0x40 /* blank */ 72 #define _X 0x80 /* hex digit */ 73 74 #else 75 76 #define _ii_ __atab 45 #pragma once 77 46 78 47 /* Digital Research / Alcyon C table definitions */ … … 87 56 #define _X 0x80 /* hex digit */ 88 57 89 #endif90 91 #ifndef _CTYPE_C92 93 #if SYS5CODE94 95 extern char _ctype[]; /* character type table */96 97 #else /* SYS5CODE */98 99 extern void ___atab(void);100 extern int8_t __atab[]; /* character type table */101 102 #endif /* SYS5CODE */103 104 extern int16_t tolower(int16_t c);105 extern int16_t toupper(int16_t c);106 107 #endif /* _CTYPE_C */108 109 58 /* 110 59 111 60 */ 112 61 113 #define isascii(c) (!((c) &~0x7F))62 #define isascii(c) (!((c) & ~0x7f)) 114 63 115 #define isprint(c) ( (_ii_)[c]&(_P|_U|_L|_N|_B))116 #define isgraph(c) ( (_ii_)[c]&(_P|_U|_L|_N))117 #define iscntrl(c) ( (_ii_)[c]&_C)64 #define isprint(c) (__atab[(c) & 0xff] & (_P | _U | _L | _N | _B)) 65 #define isgraph(c) (__atab[(c) & 0xff] & (_P | _U | _L | _N)) 66 #define iscntrl(c) (__atab[(c) & 0xff] & _C) 118 67 119 #define isalpha(c) ( (_ii_)[c]&(_U|_L))120 #define isupper(c) ( (_ii_)[c]&_U)121 #define islower(c) ( (_ii_)[c]&_L)68 #define isalpha(c) (__atab[(c) & 0xff] & (_U | _L)) 69 #define isupper(c) (__atab[(c) & 0xff] & _U) 70 #define islower(c) (__atab[(c) & 0xff] & _L) 122 71 123 #define isdigit(c) ( (_ii_)[c]&_N)124 #define isxdigit(c) ( (_ii_)[c]&_X)72 #define isdigit(c) (__atab[(c) & 0xff] & _N) 73 #define isxdigit(c) (__atab[(c) & 0xff] & _X) 125 74 126 #define isalnum(c) ( (_ii_)[c]&(_U|_L|_N))75 #define isalnum(c) (__atab[(c) & 0xff] & (_U | _L | _N)) 127 76 128 #define isspace(c) ( (_ii_)[c]&_S)129 #define ispunct(c) ( (_ii_)[c]&_P)77 #define isspace(c) (__atab[(c) & 0xff] & _S) 78 #define ispunct(c) (__atab[(c) & 0xff] & _P) 130 79 131 #define iscsym(c) (isalnum(c) ||(((c)&127)==0x5F))132 #define iscsymf(c) (isalpha(c) ||(((c)&127)==0x5F))80 #define iscsym(c) (isalnum(c) || (((c) & 0x7f) == 0x5f)) 81 #define iscsymf(c) (isalpha(c) || (((c) & 0x7f) == 0x5f)) 133 82 134 #define toascii(c) ((c) &0x7F)83 #define toascii(c) ((c) & 0x7f) 135 84 136 #define _toupper(c) ((c)-'a'+'A') 137 #define _tolower(c) ((c)-'A'+'a') 138 139 #define tonumber(c) ((((c)&0x7F)>'9')?((islower(c)?_toupper(c):c)-'A'+10):(c&0x0F)) 140 85 #define _toupper(c) ((c) - 'a' + 'A') 86 #define _tolower(c) ((c) - 'A' + 'a')
Note:
See TracChangeset
for help on using the changeset viewer.