source: buchla-68k/include/ctype.h@ 5c977dd

Last change on this file since 5c977dd was fa38804, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Removed form-feed comments.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 ============================================================================
3 ctype.h -- extended character macros, ala' Unix(tm)
4 Version 8 -- 1987-06-16 -- D.N. Lynx Crowe
5
6 These macros are a superset of those provided for System 5 Unix(tm).
7
8 This set of macros will return status for characters 0x80..0xFF as
9 though they were in the range 0x00..0x7F for compatibility with
10 the equivalent Lattice C macros. This means that isascii(c) should
11 be used if it is necessary to restrict the results to true ASCII.
12
13 isascii(c) non-zero if c is ASCII
14
15 isprint(c) non-zero if c is printable (including blank)
16 isgraph(c) non-zero if c is graphic (excluding blank)
17 iscntrl(c) non-zero if c is control character
18
19 isalpha(c) non-zero if c is alpha
20 isupper(c) non-zero if c is upper case
21 islower(c) non-zero if c is lower case
22
23 isdigit(c) non-zero if c is a digit (0 to 9)
24 isxdigit(c) non-zero if c is a hexadecimal digit (0 to 9, A to F, a to f)
25
26 isalnum(c) non-zero if c is alpha or digit
27
28 isspace(c) non-zero if c is white space
29 ispunct(c) non-zero if c is punctuation
30
31 iscsym(c) non-zero if valid character for C symbols
32 iscsymf(c) non-zero if valid first character for C symbols
33
34 toascii(c) returns c masked to 7 bits
35
36 _tolower(c) returns the lower case version of c
37 _toupper(c) returns the upper case version of c
38 ============================================================================
39*/
40
41#pragma once
42
43/* Digital Research / Alcyon C table definitions */
44
45#define _C 0x01 /* control 00.1F */
46#define _P 0x02 /* punctuation */
47#define _N 0x04 /* numeric 0..9 */
48#define _U 0x08 /* upper case */
49#define _L 0x10 /* lower case */
50#define _S 0x20 /* whitespace */
51#define _B 0x40 /* blank */
52#define _X 0x80 /* hex digit */
53
54#define isascii(c) (!((c) & ~0x7f))
55
56#define isprint(c) (__atab[(c) & 0xff] & (_P | _U | _L | _N | _B))
57#define isgraph(c) (__atab[(c) & 0xff] & (_P | _U | _L | _N))
58#define iscntrl(c) (__atab[(c) & 0xff] & _C)
59
60#define isalpha(c) (__atab[(c) & 0xff] & (_U | _L))
61#define isupper(c) (__atab[(c) & 0xff] & _U)
62#define islower(c) (__atab[(c) & 0xff] & _L)
63
64#define isdigit(c) (__atab[(c) & 0xff] & _N)
65#define isxdigit(c) (__atab[(c) & 0xff] & _X)
66
67#define isalnum(c) (__atab[(c) & 0xff] & (_U | _L | _N))
68
69#define isspace(c) (__atab[(c) & 0xff] & _S)
70#define ispunct(c) (__atab[(c) & 0xff] & _P)
71
72#define iscsym(c) (isalnum(c) || (((c) & 0x7f) == 0x5f))
73#define iscsymf(c) (isalpha(c) || (((c) & 0x7f) == 0x5f))
74
75#define toascii(c) ((c) & 0x7f)
76
77#define _toupper(c) ((c) - 'a' + 'A')
78#define _tolower(c) ((c) - 'A' + 'a')
Note: See TracBrowser for help on using the repository browser.