1 |
/* |
2 |
* Ascend Character Types |
3 |
* Shortcut character recognition |
4 |
* by Tom Epperly |
5 |
* Version: $Revision: 1.6 $ |
6 |
* Version control file: $RCSfile: actype.h,v $ |
7 |
* Date last modified: $Date: 1997/07/18 12:27:46 $ |
8 |
* Last modified by: $Author: mthomas $ |
9 |
* |
10 |
* This file is part of the Ascend Language Interpreter. |
11 |
* |
12 |
* Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly |
13 |
* |
14 |
* The Ascend Language Interpreter is free software; you can redistribute |
15 |
* it and/or modify it under the terms of the GNU General Public License as |
16 |
* published by the Free Software Foundation; either version 2 of the |
17 |
* License, or (at your option) any later version. |
18 |
* |
19 |
* The Ascend Language Interpreter is distributed in hope that it will be |
20 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 |
* General Public License for more details. |
23 |
* |
24 |
* You should have received a copy of the GNU General Public License |
25 |
* along with the program; if not, write to the Free Software Foundation, |
26 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
27 |
* COPYING. |
28 |
*/ |
29 |
|
30 |
/** @file |
31 |
* Ascend character types and shortcut character recognition. |
32 |
* <pre> |
33 |
* When #including actype.h, make sure these files are #included first: |
34 |
* #include "utilities/ascConfig.h" |
35 |
* #include "compiler.h" |
36 |
* </pre> |
37 |
*/ |
38 |
|
39 |
#ifndef __ACTYPE_H_SEEN__ |
40 |
#define __ACTYPE_H_SEEN__ |
41 |
|
42 |
extern CONST unsigned char ascend_char_t[]; |
43 |
/**< |
44 |
* Array of type codes for ASCII characters. |
45 |
* Valid array indices are 0-255, corresponding to the valid ASCII values. |
46 |
* The type of a given character can be tested using the bit masks UNIT_CHAR, |
47 |
* ID_CHAR, DIGIT_CHAR, SPACE_CHAR, and ALPHA_CHAR. |
48 |
*/ |
49 |
|
50 |
#define UNIT_CHAR 1 |
51 |
/**< Bit mask for character valid inside unit delimiters. */ |
52 |
#define ID_CHAR 2 |
53 |
/**< Bit mask for character valid in an identifier. */ |
54 |
#define DIGIT_CHAR 4 |
55 |
/**< Bit mask for a digit character. */ |
56 |
#define SPACE_CHAR 8 |
57 |
/**< Bit mask for a whitespace character. */ |
58 |
#define ALPHA_CHAR 16 |
59 |
/**< Bit mask for an alpha character. */ |
60 |
|
61 |
#define isunit(c) ((ascend_char_t[(unsigned char)c])&UNIT_CHAR) |
62 |
/**< |
63 |
* Test whether c is a character than can appear inside unit delimeters. |
64 |
* @param c char to test |
65 |
* @return Evaluates to TRUE if c is a valid unit character |
66 |
*/ |
67 |
|
68 |
#define isidchar(c) ((ascend_char_t[(unsigned char)c])&ID_CHAR) |
69 |
/**< |
70 |
* Test whether c is a character that can appear in an identifier. |
71 |
* @param c char to test |
72 |
* @return Evaluates to TRUE if c is a valid identifier character |
73 |
*/ |
74 |
|
75 |
#endif /* __ACTYPE_H_SEEN__ */ |
76 |
|