annotate src/tokenizer.cpp @ 48:ba0259c9e411 stable-1-0-11

Fixes to compile on Fedora 9 and for const correctness
author Carl Byington <carl@five-ten-sg.com>
date Thu, 29 May 2008 11:38:42 -0700
parents d9ae11033b4b
children 60f59936fabb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
1 /*
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
2
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
4 the GPL version 3 or any later version at your choice available at
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
5 http://www.gnu.org/licenses/gpl-3.0.txt
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
6
6a2f26976898 shutdown removes iptables entries that we added
carl
parents: 27
diff changeset
7 */
1
551433a01cab initial coding
carl
parents:
diff changeset
8
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
9 // This version of the tokenizer does not force the config to lower
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
10 // case, to avoid lowercasing the iptables commands, which need some
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
11 // uppercase arguments. It also considers / to be a separate token
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
12 // since that is needed for the cidr style ignore statement.
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
13
1
551433a01cab initial coding
carl
parents:
diff changeset
14 #include "includes.h"
551433a01cab initial coding
carl
parents:
diff changeset
15
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
16 const int maxlen = 1000; // used for snprintf buffers
1
551433a01cab initial coding
carl
parents:
diff changeset
17
551433a01cab initial coding
carl
parents:
diff changeset
18 enum state {s_init,
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
19 s_token,
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
20 s_string,
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
21 s_ignore, // whitespace
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
22 s_eol, // ignore to eol
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
23 end_state,
1
551433a01cab initial coding
carl
parents:
diff changeset
24
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
25 s_term, // token terminator
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
26 s_single,
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
27 s_string1, // first " of string
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
28 s_string2, // last " of string
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
29 s_slash // possible start of ignore to eol
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
30 };
1
551433a01cab initial coding
carl
parents:
diff changeset
31
551433a01cab initial coding
carl
parents:
diff changeset
32 typedef state PARSE[end_state];
551433a01cab initial coding
carl
parents:
diff changeset
33
551433a01cab initial coding
carl
parents:
diff changeset
34 static PARSE parse_table[256] = {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
35 // s_init s_token s_string s_ignore s_eol
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
36 { s_single, s_term, s_string, s_single, s_eol, }, // 0x00
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
37 { s_single, s_term, s_string, s_single, s_eol, }, // 0x01
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
38 { s_single, s_term, s_string, s_single, s_eol, }, // 0x02
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
39 { s_single, s_term, s_string, s_single, s_eol, }, // 0x03
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
40 { s_single, s_term, s_string, s_single, s_eol, }, // 0x04
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
41 { s_single, s_term, s_string, s_single, s_eol, }, // 0x05
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
42 { s_single, s_term, s_string, s_single, s_eol, }, // 0x06
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
43 { s_single, s_term, s_string, s_single, s_eol, }, // 0x07
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
44 { s_single, s_term, s_string, s_single, s_eol, }, // 0x08
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
45 { s_ignore, s_term, s_string, s_ignore, s_eol, }, // 0x09 <tab>
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
46 { s_ignore, s_term, s_string2, s_ignore, s_ignore, }, // 0x0a <lf>
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
47 { s_single, s_term, s_string, s_single, s_eol, }, // 0x0b
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
48 { s_single, s_term, s_string, s_single, s_eol, }, // 0x0c
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
49 { s_ignore, s_term, s_string2, s_ignore, s_eol, }, // 0x0d <cr>
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
50 { s_single, s_term, s_string, s_single, s_eol, }, // 0x0e
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
51 { s_single, s_term, s_string, s_single, s_eol, }, // 0x0f
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
52 { s_single, s_term, s_string, s_single, s_eol, }, // 0x10
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
53 { s_single, s_term, s_string, s_single, s_eol, }, // 0x11 xon char
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
54 { s_single, s_term, s_string, s_single, s_eol, }, // 0x12
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
55 { s_single, s_term, s_string, s_single, s_eol, }, // 0x13 xoff char
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
56 { s_single, s_term, s_string, s_single, s_eol, }, // 0x14
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
57 { s_single, s_term, s_string, s_single, s_eol, }, // 0x15
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
58 { s_single, s_term, s_string, s_single, s_eol, }, // 0x16
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
59 { s_single, s_term, s_string, s_single, s_eol, }, // 0x17
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
60 { s_single, s_term, s_string, s_single, s_eol, }, // 0x18
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
61 { s_single, s_term, s_string, s_single, s_eol, }, // 0x19
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
62 { s_single, s_term, s_string, s_single, s_eol, }, // 0x1a
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
63 { s_single, s_term, s_string, s_single, s_eol, }, // 0x1b
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
64 { s_single, s_term, s_string, s_single, s_eol, }, // 0x1c
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
65 { s_single, s_term, s_string, s_single, s_eol, }, // 0x1d
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
66 { s_single, s_term, s_string, s_single, s_eol, }, // 0x1e
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
67 { s_single, s_term, s_string, s_single, s_eol, }, // 0x1f
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
68 { s_ignore, s_term, s_string, s_ignore, s_eol, }, // 0x20 space
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
69 { s_single, s_term, s_string, s_single, s_eol, }, // 0x21 !
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
70 { s_string1, s_term, s_string2, s_string1, s_eol, }, // 0x22 "
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
71 { s_eol, s_term, s_string, s_eol, s_eol, }, // 0x23 #
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
72 { s_single, s_term, s_string, s_single, s_eol, }, // 0x24 $
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
73 { s_single, s_term, s_string, s_single, s_eol, }, // 0x25 %
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
74 { s_single, s_term, s_string, s_single, s_eol, }, // 0x26 &
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
75 { s_single, s_term, s_string, s_single, s_eol, }, // 0x27 '
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
76 { s_single, s_term, s_string, s_single, s_eol, }, // 0x28 (
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
77 { s_single, s_term, s_string, s_single, s_eol, }, // 0x29 )
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
78 { s_single, s_term, s_string, s_single, s_eol, }, // 0x2A *
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
79 { s_single, s_token, s_string, s_single, s_eol, }, // 0x2B +
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
80 { s_single, s_term, s_string, s_single, s_eol, }, // 0x2C ,
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
81 { s_single, s_token, s_string, s_single, s_eol, }, // 0x2D -
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
82 { s_single, s_token, s_string, s_single, s_eol, }, // 0x2E .
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
83 { s_slash, s_term, s_string, s_slash, s_eol, }, // 0x2F /
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
84 { s_token, s_token, s_string, s_token, s_eol, }, // 0x30 0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
85 { s_token, s_token, s_string, s_token, s_eol, }, // 0x31 1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
86 { s_token, s_token, s_string, s_token, s_eol, }, // 0x32 2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
87 { s_token, s_token, s_string, s_token, s_eol, }, // 0x33 3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
88 { s_token, s_token, s_string, s_token, s_eol, }, // 0x34 4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
89 { s_token, s_token, s_string, s_token, s_eol, }, // 0x35 5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
90 { s_token, s_token, s_string, s_token, s_eol, }, // 0x36 6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
91 { s_token, s_token, s_string, s_token, s_eol, }, // 0x37 7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
92 { s_token, s_token, s_string, s_token, s_eol, }, // 0x38 8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
93 { s_token, s_token, s_string, s_token, s_eol, }, // 0x39 9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
94 { s_single, s_term, s_string, s_single, s_eol, }, // 0x3A :
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
95 { s_single, s_term, s_string, s_single, s_eol, }, // 0x3B ;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
96 { s_single, s_term, s_string, s_single, s_eol, }, // 0x3C <
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
97 { s_single, s_token, s_string, s_single, s_eol, }, // 0x3D =
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
98 { s_single, s_term, s_string, s_single, s_eol, }, // 0x3E >
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
99 { s_single, s_term, s_string, s_single, s_eol, }, // 0x3F ?
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
100 { s_single, s_token, s_string, s_single, s_eol, }, // 0x40 @
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
101 { s_token, s_token, s_string, s_token, s_eol, }, // 0x41 A
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
102 { s_token, s_token, s_string, s_token, s_eol, }, // 0x42 B
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
103 { s_token, s_token, s_string, s_token, s_eol, }, // 0x43 C
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
104 { s_token, s_token, s_string, s_token, s_eol, }, // 0x44 D
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
105 { s_token, s_token, s_string, s_token, s_eol, }, // 0x45 E
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
106 { s_token, s_token, s_string, s_token, s_eol, }, // 0x46 F
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
107 { s_token, s_token, s_string, s_token, s_eol, }, // 0x47 G
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
108 { s_token, s_token, s_string, s_token, s_eol, }, // 0x48 H
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
109 { s_token, s_token, s_string, s_token, s_eol, }, // 0x49 I
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
110 { s_token, s_token, s_string, s_token, s_eol, }, // 0x4A J
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
111 { s_token, s_token, s_string, s_token, s_eol, }, // 0x4B K
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
112 { s_token, s_token, s_string, s_token, s_eol, }, // 0x4C L
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
113 { s_token, s_token, s_string, s_token, s_eol, }, // 0x4D M
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
114 { s_token, s_token, s_string, s_token, s_eol, }, // 0x4E N
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
115 { s_token, s_token, s_string, s_token, s_eol, }, // 0x4F O
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
116 { s_token, s_token, s_string, s_token, s_eol, }, // 0x50 P
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
117 { s_token, s_token, s_string, s_token, s_eol, }, // 0x51 Q
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
118 { s_token, s_token, s_string, s_token, s_eol, }, // 0x52 R
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
119 { s_token, s_token, s_string, s_token, s_eol, }, // 0x53 S
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
120 { s_token, s_token, s_string, s_token, s_eol, }, // 0x54 T
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
121 { s_token, s_token, s_string, s_token, s_eol, }, // 0x55 U
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
122 { s_token, s_token, s_string, s_token, s_eol, }, // 0x56 V
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
123 { s_token, s_token, s_string, s_token, s_eol, }, // 0x57 W
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
124 { s_token, s_token, s_string, s_token, s_eol, }, // 0x58 X
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
125 { s_token, s_token, s_string, s_token, s_eol, }, // 0x59 Y
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
126 { s_token, s_token, s_string, s_token, s_eol, }, // 0x5A Z
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
127 { s_single, s_term, s_string, s_single, s_eol, }, // 0x5B [
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
128 { s_single, s_term, s_string, s_single, s_eol, }, // 0x5C backslash
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
129 { s_single, s_term, s_string, s_single, s_eol, }, // 0x5D ]
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
130 { s_single, s_term, s_string, s_single, s_eol, }, // 0x5E ^
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
131 { s_single, s_token, s_string, s_single, s_eol, }, // 0x5F _
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
132 { s_single, s_term, s_string, s_single, s_eol, }, // 0x60 `
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
133 { s_token, s_token, s_string, s_token, s_eol, }, // 0x61 a
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
134 { s_token, s_token, s_string, s_token, s_eol, }, // 0x62 b
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
135 { s_token, s_token, s_string, s_token, s_eol, }, // 0x63 c
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
136 { s_token, s_token, s_string, s_token, s_eol, }, // 0x64 d
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
137 { s_token, s_token, s_string, s_token, s_eol, }, // 0x65 e
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
138 { s_token, s_token, s_string, s_token, s_eol, }, // 0x66 f
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
139 { s_token, s_token, s_string, s_token, s_eol, }, // 0x67 g
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
140 { s_token, s_token, s_string, s_token, s_eol, }, // 0x68 h
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
141 { s_token, s_token, s_string, s_token, s_eol, }, // 0x69 i
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
142 { s_token, s_token, s_string, s_token, s_eol, }, // 0x6A j
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
143 { s_token, s_token, s_string, s_token, s_eol, }, // 0x6B k
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
144 { s_token, s_token, s_string, s_token, s_eol, }, // 0x6C l
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
145 { s_token, s_token, s_string, s_token, s_eol, }, // 0x6D m
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
146 { s_token, s_token, s_string, s_token, s_eol, }, // 0x6E n
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
147 { s_token, s_token, s_string, s_token, s_eol, }, // 0x6F o
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
148 { s_token, s_token, s_string, s_token, s_eol, }, // 0x70 p
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
149 { s_token, s_token, s_string, s_token, s_eol, }, // 0x71 q
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
150 { s_token, s_token, s_string, s_token, s_eol, }, // 0x72 r
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
151 { s_token, s_token, s_string, s_token, s_eol, }, // 0x73 s
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
152 { s_token, s_token, s_string, s_token, s_eol, }, // 0x74 t
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
153 { s_token, s_token, s_string, s_token, s_eol, }, // 0x75 u
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
154 { s_token, s_token, s_string, s_token, s_eol, }, // 0x76 v
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
155 { s_token, s_token, s_string, s_token, s_eol, }, // 0x77 w
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
156 { s_token, s_token, s_string, s_token, s_eol, }, // 0x78 x
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
157 { s_token, s_token, s_string, s_token, s_eol, }, // 0x79 y
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
158 { s_token, s_token, s_string, s_token, s_eol, }, // 0x7A z
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
159 { s_single, s_term, s_string, s_single, s_eol, }, // 0x7B {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
160 { s_single, s_term, s_string, s_single, s_eol, }, // 0x7C |
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
161 { s_single, s_term, s_string, s_single, s_eol, }, // 0x7D }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
162 { s_single, s_term, s_string, s_single, s_eol, }, // 0x7E ~
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
163 { s_single, s_term, s_string, s_single, s_eol, }, // 0x7f
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
164 { s_single, s_term, s_string, s_single, s_eol, }, // 0x80
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
165 { s_single, s_term, s_string, s_single, s_eol, }, // 0x81
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
166 { s_single, s_term, s_string, s_single, s_eol, }, // 0x82
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
167 { s_single, s_term, s_string, s_single, s_eol, }, // 0x83
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
168 { s_single, s_term, s_string, s_single, s_eol, }, // 0x84
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
169 { s_single, s_term, s_string, s_single, s_eol, }, // 0x85
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
170 { s_single, s_term, s_string, s_single, s_eol, }, // 0x86
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
171 { s_single, s_term, s_string, s_single, s_eol, }, // 0x87
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
172 { s_single, s_term, s_string, s_single, s_eol, }, // 0x88
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
173 { s_single, s_term, s_string, s_single, s_eol, }, // 0x89
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
174 { s_single, s_term, s_string, s_single, s_eol, }, // 0x8a
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
175 { s_single, s_term, s_string, s_single, s_eol, }, // 0x8b
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
176 { s_single, s_term, s_string, s_single, s_eol, }, // 0x8c
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
177 { s_single, s_term, s_string, s_single, s_eol, }, // 0x8d
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
178 { s_single, s_term, s_string, s_single, s_eol, }, // 0x8e
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
179 { s_single, s_term, s_string, s_single, s_eol, }, // 0x8f
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
180 { s_single, s_term, s_string, s_single, s_eol, }, // 0x90
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
181 { s_single, s_term, s_string, s_single, s_eol, }, // 0x91
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
182 { s_single, s_term, s_string, s_single, s_eol, }, // 0x92
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
183 { s_single, s_term, s_string, s_single, s_eol, }, // 0x93
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
184 { s_single, s_term, s_string, s_single, s_eol, }, // 0x94
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
185 { s_single, s_term, s_string, s_single, s_eol, }, // 0x95
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
186 { s_single, s_term, s_string, s_single, s_eol, }, // 0x96
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
187 { s_single, s_term, s_string, s_single, s_eol, }, // 0x97
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
188 { s_single, s_term, s_string, s_single, s_eol, }, // 0x98
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
189 { s_single, s_term, s_string, s_single, s_eol, }, // 0x99
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
190 { s_single, s_term, s_string, s_single, s_eol, }, // 0x9a
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
191 { s_single, s_term, s_string, s_single, s_eol, }, // 0x9b
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
192 { s_single, s_term, s_string, s_single, s_eol, }, // 0x9c
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
193 { s_single, s_term, s_string, s_single, s_eol, }, // 0x9d
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
194 { s_single, s_term, s_string, s_single, s_eol, }, // 0x9e
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
195 { s_single, s_term, s_string, s_single, s_eol, }, // 0x9f
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
196 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
197 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
198 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
199 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
200 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
201 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
202 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
203 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
204 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
205 { s_single, s_term, s_string, s_single, s_eol, }, // 0xa9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
206 { s_single, s_term, s_string, s_single, s_eol, }, // 0xaa
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
207 { s_single, s_term, s_string, s_single, s_eol, }, // 0xab
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
208 { s_single, s_term, s_string, s_single, s_eol, }, // 0xac
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
209 { s_single, s_term, s_string, s_single, s_eol, }, // 0xad
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
210 { s_single, s_term, s_string, s_single, s_eol, }, // 0xae
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
211 { s_single, s_term, s_string, s_single, s_eol, }, // 0xaf
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
212 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
213 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
214 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
215 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
216 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
217 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
218 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
219 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
220 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
221 { s_single, s_term, s_string, s_single, s_eol, }, // 0xb9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
222 { s_single, s_term, s_string, s_single, s_eol, }, // 0xba
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
223 { s_single, s_term, s_string, s_single, s_eol, }, // 0xbb
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
224 { s_single, s_term, s_string, s_single, s_eol, }, // 0xbc
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
225 { s_single, s_term, s_string, s_single, s_eol, }, // 0xbd
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
226 { s_single, s_term, s_string, s_single, s_eol, }, // 0xbe
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
227 { s_single, s_term, s_string, s_single, s_eol, }, // 0xbf
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
228 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
229 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
230 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
231 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
232 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
233 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
234 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
235 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
236 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
237 { s_single, s_term, s_string, s_single, s_eol, }, // 0xc9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
238 { s_single, s_term, s_string, s_single, s_eol, }, // 0xca
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
239 { s_single, s_term, s_string, s_single, s_eol, }, // 0xcb
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
240 { s_single, s_term, s_string, s_single, s_eol, }, // 0xcc
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
241 { s_single, s_term, s_string, s_single, s_eol, }, // 0xcd
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
242 { s_single, s_term, s_string, s_single, s_eol, }, // 0xce
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
243 { s_single, s_term, s_string, s_single, s_eol, }, // 0xcf
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
244 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
245 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
246 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
247 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
248 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
249 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
250 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
251 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
252 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
253 { s_single, s_term, s_string, s_single, s_eol, }, // 0xd9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
254 { s_single, s_term, s_string, s_single, s_eol, }, // 0xda
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
255 { s_single, s_term, s_string, s_single, s_eol, }, // 0xdb
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
256 { s_single, s_term, s_string, s_single, s_eol, }, // 0xdc
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
257 { s_single, s_term, s_string, s_single, s_eol, }, // 0xdd
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
258 { s_single, s_term, s_string, s_single, s_eol, }, // 0xde
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
259 { s_single, s_term, s_string, s_single, s_eol, }, // 0xdf
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
260 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
261 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
262 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
263 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
264 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
265 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
266 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
267 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
268 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
269 { s_single, s_term, s_string, s_single, s_eol, }, // 0xe9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
270 { s_single, s_term, s_string, s_single, s_eol, }, // 0xea
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
271 { s_single, s_term, s_string, s_single, s_eol, }, // 0xeb
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
272 { s_single, s_term, s_string, s_single, s_eol, }, // 0xec
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
273 { s_single, s_term, s_string, s_single, s_eol, }, // 0xed
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
274 { s_single, s_term, s_string, s_single, s_eol, }, // 0xee
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
275 { s_single, s_term, s_string, s_single, s_eol, }, // 0xef
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
276 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf0
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
277 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf1
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
278 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf2
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
279 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf3
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
280 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf4
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
281 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf5
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
282 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf6
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
283 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf7
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
284 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf8
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
285 { s_single, s_term, s_string, s_single, s_eol, }, // 0xf9
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
286 { s_single, s_term, s_string, s_single, s_eol, }, // 0xfa
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
287 { s_single, s_term, s_string, s_single, s_eol, }, // 0xfb
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
288 { s_single, s_term, s_string, s_single, s_eol, }, // 0xfc
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
289 { s_single, s_term, s_string, s_single, s_eol, }, // 0xfd
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
290 { s_single, s_term, s_string, s_single, s_eol, }, // 0xfe
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
291 { s_single, s_term, s_string, s_single, s_eol, }, // 0xff
1
551433a01cab initial coding
carl
parents:
diff changeset
292 };
551433a01cab initial coding
carl
parents:
diff changeset
293
551433a01cab initial coding
carl
parents:
diff changeset
294
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
295 TOKEN::TOKEN(const char *fn, string_set *includes) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
296 pushed = false;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
297 include_files = includes;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
298 include(fn);
1
551433a01cab initial coding
carl
parents:
diff changeset
299 }
551433a01cab initial coding
carl
parents:
diff changeset
300
551433a01cab initial coding
carl
parents:
diff changeset
301
551433a01cab initial coding
carl
parents:
diff changeset
302 TOKEN::~TOKEN() {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
303 while (!streams.empty()) pop();
1
551433a01cab initial coding
carl
parents:
diff changeset
304 }
551433a01cab initial coding
carl
parents:
diff changeset
305
551433a01cab initial coding
carl
parents:
diff changeset
306
551433a01cab initial coding
carl
parents:
diff changeset
307 void TOKEN::pop() {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
308 ifstream *is = streams.front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
309 const char *fn = filenames.front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
310 streams.pop_front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
311 filenamess.erase(fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
312 if (filenames.size() > 1) filenames.pop_front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
313 if (linenumbers.size() > 1) linenumbers.pop_front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
314 is->close();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
315 delete is;
1
551433a01cab initial coding
carl
parents:
diff changeset
316 }
551433a01cab initial coding
carl
parents:
diff changeset
317
551433a01cab initial coding
carl
parents:
diff changeset
318
551433a01cab initial coding
carl
parents:
diff changeset
319 void TOKEN::push_char(u_char c) {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
320 pushed = true;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
321 pushed_char = c;
1
551433a01cab initial coding
carl
parents:
diff changeset
322 }
551433a01cab initial coding
carl
parents:
diff changeset
323
551433a01cab initial coding
carl
parents:
diff changeset
324
551433a01cab initial coding
carl
parents:
diff changeset
325 bool TOKEN::next_char(u_char &uc) {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
326 if (pushed) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
327 uc = pushed_char;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
328 pushed = false;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
329 return true;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
330 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
331 while (!streams.empty() && streams.front()->eof()) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
332 pop();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
333 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
334 if (streams.empty()) return false;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
335 ifstream *is = streams.front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
336 uc = (u_char)is->get();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
337 if (is->eof()) return next_char(uc);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
338 if (uc == (u_char)'\n') {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
339 int &line = linenumbers.front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
340 line++;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
341 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
342 return true;
1
551433a01cab initial coding
carl
parents:
diff changeset
343 }
551433a01cab initial coding
carl
parents:
diff changeset
344
551433a01cab initial coding
carl
parents:
diff changeset
345
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
346 bool TOKEN::include(const char *fn) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
347 string_set::iterator i = filenamess.find(fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
348 if (i != filenamess.end()) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
349 token_error("redundant or recursive include file detected");
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
350 return false;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
351 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
352 ifstream *is = new ifstream;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
353 is->open(fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
354 if (is->fail()) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
355 char buf[maxlen];
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
356 snprintf(buf, sizeof(buf), "include file %s not found", fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
357 token_error(buf);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
358 return false;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
359 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
360 string_set &inc = *include_files;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
361 inc.insert(fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
362 streams.push_front(is);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
363 filenames.push_front(fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
364 filenamess.insert(fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
365 linenumbers.push_front(1);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
366 return true;
1
551433a01cab initial coding
carl
parents:
diff changeset
367 }
551433a01cab initial coding
carl
parents:
diff changeset
368
551433a01cab initial coding
carl
parents:
diff changeset
369
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
370 const char *TOKEN::next() {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
371 if (!pending_tokens.empty()) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
372 const char *t = pending_tokens.front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
373 pending_tokens.pop_front();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
374 return t;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
375 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
376 if (streams.empty()) return NULL;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
377 const int PENDING_LIMIT = 1000;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
378 u_char buffer[PENDING_LIMIT];
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
379 int count = 0;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
380 state st = s_init;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
381 while (true) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
382 if (count == (PENDING_LIMIT-1)) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
383 token_error("token too long");
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
384 break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
385 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
386 if (st >= end_state) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
387 token_error("finite state machine error");
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
388 break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
389 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
390 u_char c;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
391 if (!next_char(c)) break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
392 st = parse_table[c][st];
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
393 switch (st) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
394 case s_string:
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
395 case s_token: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
396 buffer[count++] = c;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
397 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
398
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
399 case s_term: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
400 push_char(c);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
401 st = s_init;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
402 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
403
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
404 case s_string1: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
405 st = s_string;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
406 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
407
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
408 case s_string2: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
409 st = s_init;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
410 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
411
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
412 case s_single: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
413 buffer[count++] = c;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
414 st = s_init;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
415 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
416
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
417 case s_ignore:
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
418 case s_eol: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
419 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
420
551433a01cab initial coding
carl
parents:
diff changeset
421
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
422 case s_slash: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
423 buffer[count++] = c;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
424 if (next_char(c)) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
425 if (c == (u_char)'/') {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
426 // start of ignore to eol on //
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
427 count--;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
428 st = s_eol;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
429 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
430 else {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
431 // not a // token, just return this single /
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
432 push_char(c);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
433 st = s_init;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
434 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
435 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
436 else {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
437 // cannot get another char
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
438 st = s_init;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
439 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
440 } break;
1
551433a01cab initial coding
carl
parents:
diff changeset
441
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
442 default: {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
443 token_error();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
444 token_error("unknown state %d %s", st, " ");
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
445 } break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
446 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
447 if (st == s_init) break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
448 }
1
551433a01cab initial coding
carl
parents:
diff changeset
449
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
450 buffer[count] = '\0';
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
451 if (count == 0) return NULL;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
452 const char *t = register_string((char*)buffer);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
453 if (t == token_include) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
454 const char *f = next(); // should be file name
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
455 const char *s = next(); // should be semicolon
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
456 if (s == token_semi) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
457 include(f);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
458 return next();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
459 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
460 else {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
461 push(s);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
462 push(f);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
463 return t;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
464 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
465 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
466 return t;
1
551433a01cab initial coding
carl
parents:
diff changeset
467 }
551433a01cab initial coding
carl
parents:
diff changeset
468
551433a01cab initial coding
carl
parents:
diff changeset
469
551433a01cab initial coding
carl
parents:
diff changeset
470 int TOKEN::nextint() {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
471 const char *t = next();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
472 char *e;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
473 long i = strtol(t, &e, 10);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
474 if (*e != '\0') {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
475 token_error("integer", t);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
476 return 0;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
477 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
478 return (int)i;
1
551433a01cab initial coding
carl
parents:
diff changeset
479 }
551433a01cab initial coding
carl
parents:
diff changeset
480
551433a01cab initial coding
carl
parents:
diff changeset
481
551433a01cab initial coding
carl
parents:
diff changeset
482 void TOKEN::skipeol() {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
483 while (true) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
484 u_char c;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
485 if (!next_char(c)) break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
486 if (c == (u_char)'\n') break;
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
487 }
1
551433a01cab initial coding
carl
parents:
diff changeset
488 }
551433a01cab initial coding
carl
parents:
diff changeset
489
551433a01cab initial coding
carl
parents:
diff changeset
490
551433a01cab initial coding
carl
parents:
diff changeset
491 void TOKEN::token_error(const char *err) {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
492 token_error();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
493 char buf[maxlen];
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
494 snprintf(buf, sizeof(buf), "%s \n", err);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
495 my_syslog(buf);
1
551433a01cab initial coding
carl
parents:
diff changeset
496 }
551433a01cab initial coding
carl
parents:
diff changeset
497
551433a01cab initial coding
carl
parents:
diff changeset
498
551433a01cab initial coding
carl
parents:
diff changeset
499 void TOKEN::token_error(const char *fmt, int d, const char *s) {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
500 char buf[maxlen];
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
501 snprintf(buf, sizeof(buf), fmt, d, s);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
502 my_syslog(buf);
1
551433a01cab initial coding
carl
parents:
diff changeset
503 }
551433a01cab initial coding
carl
parents:
diff changeset
504
551433a01cab initial coding
carl
parents:
diff changeset
505
551433a01cab initial coding
carl
parents:
diff changeset
506 void TOKEN::token_error(const char *fmt, const char *t, const char *h) {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
507 if (!h) h = "null";
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
508 char buf[maxlen];
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
509 snprintf(buf, sizeof(buf), fmt, t, h);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
510 my_syslog(buf);
1
551433a01cab initial coding
carl
parents:
diff changeset
511 }
551433a01cab initial coding
carl
parents:
diff changeset
512
551433a01cab initial coding
carl
parents:
diff changeset
513
551433a01cab initial coding
carl
parents:
diff changeset
514 void TOKEN::token_error(const char *want, const char *have) {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
515 token_error();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
516 token_error("expecting %s, found %s", want, have);
1
551433a01cab initial coding
carl
parents:
diff changeset
517 }
551433a01cab initial coding
carl
parents:
diff changeset
518
551433a01cab initial coding
carl
parents:
diff changeset
519
551433a01cab initial coding
carl
parents:
diff changeset
520 void TOKEN::token_error() {
48
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
521 token_error("syntax error at line %d in file %s -- ", cur_line(), cur_fn());
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
522 line_list::iterator j = linenumbers.begin();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
523 string_list::const_iterator i = filenames.begin();
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
524 for (; i!=filenames.end(); i++,j++) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
525 if (i != filenames.begin()) {
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
526 const char *fn = (*i);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
527 int li = (*j);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
528 token_error(" included from line %d in file %s -- ", li, fn);
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
529 }
ba0259c9e411 Fixes to compile on Fedora 9 and for const correctness
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
530 }
1
551433a01cab initial coding
carl
parents:
diff changeset
531 }
551433a01cab initial coding
carl
parents:
diff changeset
532