ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/re-cmp.h
Revision: 1.1
Committed: Fri Feb 3 07:12:50 2006 UTC (18 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
Branch point for: UPSTREAM
Log Message:
Initial revision

File Contents

# Content
1 /* re-cmp.h
2 * Datastructures for representing a subset of regular expressions.
3 *
4 * Author: Kjetil T. Homme <kjetilho@ifi.uio.no> May 1993
5 */
6
7 /* C o n f i g u r a t i o n
8 */
9
10 #define SAFE_CHECKS /* Regexp's with syntax errors will core dump if
11 * this is undefined.
12 */
13
14 #define RE_TOKEN_MAX 64 /* Max amount of tokens in a regexp.
15 * Each token uses ~264 bytes. They are allocated
16 * as needed, but never de-allocated.
17 * E.g. [A-Za-z0-9_] counts as one token, so 64
18 * should be plenty for most purposes.
19 */
20
21 /* D o n o t c h a n g e b e l o w
22 */
23
24 #ifdef uchar
25 # undef uchar
26 #endif
27 #ifdef Boolean
28 # undef Boolean
29 #endif
30 #ifdef True
31 # undef True
32 #endif
33 #ifdef False
34 # undef False
35 #endif
36
37 #define uchar unsigned char
38 #define Boolean uchar
39 #define True 1 /* Changing this value will break the code */
40 #define False 0
41
42 typedef enum {
43 sel_any, /* corresponds to e.g. . */
44 sel_end, /* " $ */
45 sel_single, /* " q */
46 sel_range, /* " [A-F] */
47 sel_array, /* " [AF-RqO-T] */
48 sel_not_single, /* " [^f] */
49 sel_not_range /* " [^A-F] */
50 } selection_type;
51
52 typedef enum {
53 rep_once, /* corresponds to no meta-char */
54 rep_once_or_more, /* " + */
55 rep_null_or_once, /* " ? */
56 rep_null_or_more /* " * */
57 } repetetion_type;
58
59 typedef struct {
60 selection_type type;
61 union {
62 uchar single;
63 struct {
64 uchar low, high;
65 } range;
66 Boolean array[UCHAR_MAX];
67 } u;
68 repetetion_type repeat;
69 } selection;