ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/re-cmp.h
Revision: 1.3
Committed: Fri Sep 8 04:51:18 2006 UTC (17 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +3 -21 lines
Log Message:
Converted the custom type Boolean to C++ bool.

File Contents

# User Rev Content
1 root 1.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 root 1.2 * this is undefined.
12     */
13 root 1.1
14     #define RE_TOKEN_MAX 64 /* Max amount of tokens in a regexp.
15 root 1.2 * 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 root 1.1
21     /* D o n o t c h a n g e b e l o w
22     */
23    
24     typedef enum {
25     sel_any, /* corresponds to e.g. . */
26     sel_end, /* " $ */
27     sel_single, /* " q */
28     sel_range, /* " [A-F] */
29     sel_array, /* " [AF-RqO-T] */
30     sel_not_single, /* " [^f] */
31     sel_not_range /* " [^A-F] */
32     } selection_type;
33    
34     typedef enum {
35     rep_once, /* corresponds to no meta-char */
36     rep_once_or_more, /* " + */
37     rep_null_or_once, /* " ? */
38     rep_null_or_more /* " * */
39     } repetetion_type;
40    
41     typedef struct {
42     selection_type type;
43     union {
44 pippijn 1.3 unsigned char single;
45 root 1.2 struct {
46 pippijn 1.3 unsigned char low, high;
47 root 1.2 } range;
48 pippijn 1.3 bool array[UCHAR_MAX];
49 root 1.1 } u;
50     repetetion_type repeat;
51     } selection;