1/*****************************************************************************/
2/* */
3/* chartype.h */
4/* */
5/* Character classification functions */
6/* */
7/* */
8/* */
9/* (C) 2000-2004 Ullrich von Bassewitz */
10/* Roemerstrasse 52 */
11/* D-70794 Filderstadt */
12/* EMail: uz@cc65.org */
13/* */
14/* */
15/* This software is provided 'as-is', without any expressed or implied */
16/* warranty. In no event will the authors be held liable for any damages */
17/* arising from the use of this software. */
18/* */
19/* Permission is granted to anyone to use this software for any purpose, */
20/* including commercial applications, and to alter it and redistribute it */
21/* freely, subject to the following restrictions: */
22/* */
23/* 1. The origin of this software must not be misrepresented; you must not */
24/* claim that you wrote the original software. If you use this software */
25/* in a product, an acknowledgment in the product documentation would be */
26/* appreciated but is not required. */
27/* 2. Altered source versions must be plainly marked as such, and must not */
28/* be misrepresented as being the original software. */
29/* 3. This notice may not be removed or altered from any source */
30/* distribution. */
31/* */
32/*****************************************************************************/
33
34
35
36#ifndef CHARTYPE_H
37#define CHARTYPE_H
38
39
40
41#include <ctype.h>
42
43/* common */
44#include "inline.h"
45
46
47/* This module contains replacements for functions in ctype.h besides other
48** functions. There is a problem with using ctype.h directly:
49** The parameter must have a value of "unsigned char" or EOF.
50** So on platforms where a char is signed, this may give problems or at
51** least warnings. The wrapper functions below will have an "char" parameter
52** but handle it correctly. They will NOT work for EOF, but this is not a
53** problem, since EOF is always handled separately.
54*/
55
56
57
58/*****************************************************************************/
59/* Code */
60/*****************************************************************************/
61
62
63
64int IsAlpha (char C);
65/* Check for a letter */
66
67int IsAlNum (char C);
68/* Check for letter or digit */
69
70int IsAscii (char C);
71/* Check for an ASCII character */
72
73int IsBlank (char C);
74/* Check for a space or tab */
75
76#if defined(HAVE_INLINE)
77INLINE int IsControl (char C)
78/* Check for control chars */
79{
80 return iscntrl ((unsigned char) C);
81}
82#else
83# define IsControl(C) iscntrl (C)
84#endif
85
86int IsSpace (char C);
87/* Check for any white space characters */
88
89int IsDigit (char C);
90/* Check for a digit */
91
92int IsLower (char C);
93/* Check for a lower case char */
94
95int IsUpper (char C);
96/* Check for upper case characters */
97
98int IsBDigit (char C);
99/* Check for binary digits (0/1) */
100
101int IsODigit (char C);
102/* Check for octal digits (0..7) */
103
104int IsXDigit (char C);
105/* Check for hexadecimal digits */
106
107int IsQuote (char C);
108/* Check for a single or double quote */
109
110
111
112/* End of chartype.h */
113
114#endif
115