mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
add char type
This commit is contained in:
parent
a36ce0cf4e
commit
c535888966
@ -300,30 +300,32 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
||||
*yy_cp = '\0'; \
|
||||
yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 49
|
||||
#define YY_END_OF_BUFFER 50
|
||||
static yyconst short int yy_accept[189] =
|
||||
#define YY_NUM_RULES 50
|
||||
#define YY_END_OF_BUFFER 51
|
||||
static yyconst short int yy_accept[192] =
|
||||
{ 0,
|
||||
0, 0, 50, 48, 2, 1, 44, 45, 48, 48,
|
||||
48, 40, 40, 46, 47, 47, 47, 47, 47, 47,
|
||||
47, 47, 47, 47, 47, 47, 47, 1, 0, 41,
|
||||
43, 4, 3, 43, 40, 42, 47, 47, 47, 47,
|
||||
47, 47, 35, 47, 47, 47, 47, 47, 47, 47,
|
||||
47, 47, 47, 47, 47, 47, 0, 3, 42, 47,
|
||||
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
|
||||
47, 33, 34, 47, 47, 47, 47, 47, 0, 43,
|
||||
47, 22, 47, 11, 47, 47, 47, 47, 7, 47,
|
||||
47, 47, 47, 12, 47, 47, 47, 47, 47, 47,
|
||||
0, 0, 51, 49, 2, 1, 45, 46, 49, 49,
|
||||
49, 41, 41, 47, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 1, 0, 42,
|
||||
44, 4, 3, 44, 41, 43, 48, 48, 48, 48,
|
||||
48, 48, 48, 36, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 0, 3, 43,
|
||||
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 34, 35, 48, 48, 48, 48, 48,
|
||||
0, 44, 48, 22, 48, 11, 31, 48, 48, 48,
|
||||
48, 7, 48, 48, 48, 48, 12, 48, 48, 48,
|
||||
|
||||
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 13, 14, 15, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 16, 40, 23, 48, 38,
|
||||
37, 5, 48, 8, 48, 48, 48, 48, 48, 21,
|
||||
6, 10, 48, 17, 18, 19, 48, 48, 20, 48,
|
||||
48, 48, 39, 48, 9, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 32, 48, 48, 48, 48, 33, 48,
|
||||
48, 24, 48, 48, 48, 48, 25, 26, 48, 48,
|
||||
48, 27, 28, 29, 48, 48, 48, 48, 48, 30,
|
||||
0
|
||||
|
||||
47, 47, 47, 47, 47, 47, 47, 47, 47, 13,
|
||||
14, 15, 47, 47, 47, 47, 47, 47, 47, 47,
|
||||
47, 47, 16, 39, 23, 47, 37, 36, 5, 47,
|
||||
8, 47, 47, 47, 47, 47, 21, 6, 10, 47,
|
||||
17, 18, 19, 47, 47, 20, 47, 47, 47, 38,
|
||||
47, 9, 47, 47, 47, 47, 47, 47, 47, 47,
|
||||
31, 47, 47, 47, 47, 32, 47, 47, 24, 47,
|
||||
47, 47, 47, 25, 26, 47, 47, 47, 27, 28,
|
||||
29, 47, 47, 47, 47, 47, 30, 0
|
||||
} ;
|
||||
|
||||
static yyconst int yy_ec[256] =
|
||||
@ -367,124 +369,124 @@ static yyconst int yy_meta[45] =
|
||||
7, 7, 8, 7
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_base[197] =
|
||||
static yyconst short int yy_base[200] =
|
||||
{ 0,
|
||||
0, 0, 231, 232, 232, 0, 232, 232, 222, 0,
|
||||
39, 38, 39, 232, 0, 199, 18, 28, 28, 23,
|
||||
24, 186, 215, 36, 22, 182, 195, 0, 0, 216,
|
||||
43, 232, 0, 0, 0, 0, 0, 186, 188, 187,
|
||||
182, 28, 0, 188, 184, 183, 181, 176, 181, 178,
|
||||
180, 175, 173, 179, 173, 174, 199, 0, 0, 179,
|
||||
181, 181, 176, 175, 174, 177, 176, 165, 162, 57,
|
||||
157, 0, 0, 154, 37, 154, 166, 152, 183, 182,
|
||||
164, 174, 161, 0, 161, 151, 145, 143, 0, 144,
|
||||
164, 167, 164, 155, 150, 145, 141, 149, 148, 146,
|
||||
0, 0, 234, 235, 235, 0, 235, 235, 225, 0,
|
||||
39, 38, 39, 235, 0, 202, 18, 28, 28, 23,
|
||||
29, 189, 218, 41, 14, 185, 198, 0, 0, 219,
|
||||
38, 235, 0, 0, 0, 0, 0, 189, 191, 190,
|
||||
185, 200, 28, 0, 190, 186, 185, 183, 178, 183,
|
||||
180, 182, 177, 175, 181, 175, 176, 201, 0, 0,
|
||||
181, 183, 183, 178, 166, 176, 175, 178, 177, 166,
|
||||
163, 57, 158, 0, 0, 155, 39, 155, 167, 153,
|
||||
184, 183, 165, 175, 162, 0, 0, 162, 152, 146,
|
||||
144, 0, 145, 165, 168, 165, 156, 151, 146, 142,
|
||||
|
||||
67, 129, 157, 144, 126, 141, 127, 148, 124, 140,
|
||||
139, 0, 123, 126, 121, 129, 117, 126, 128, 137,
|
||||
140, 137, 128, 0, 0, 127, 0, 0, 0, 134,
|
||||
0, 110, 109, 108, 119, 117, 0, 0, 0, 115,
|
||||
119, 31, 0, 103, 101, 0, 101, 100, 114, 0,
|
||||
110, 0, 97, 96, 102, 94, 91, 107, 106, 83,
|
||||
0, 89, 88, 91, 101, 0, 78, 77, 0, 98,
|
||||
97, 79, 73, 0, 0, 71, 61, 81, 0, 0,
|
||||
0, 75, 49, 42, 54, 31, 0, 232, 84, 89,
|
||||
67, 91, 95, 103, 107, 111
|
||||
150, 149, 147, 67, 130, 158, 145, 127, 142, 128,
|
||||
149, 125, 141, 140, 0, 124, 127, 122, 130, 118,
|
||||
127, 129, 138, 141, 138, 129, 0, 0, 128, 0,
|
||||
0, 0, 135, 0, 111, 110, 109, 120, 118, 0,
|
||||
0, 0, 116, 120, 49, 0, 104, 102, 0, 102,
|
||||
101, 115, 0, 111, 0, 98, 97, 103, 95, 92,
|
||||
108, 107, 84, 0, 90, 89, 92, 102, 0, 79,
|
||||
78, 0, 98, 88, 64, 58, 0, 0, 47, 44,
|
||||
70, 0, 0, 0, 64, 48, 40, 54, 31, 0,
|
||||
235, 89, 94, 67, 96, 100, 108, 112, 116
|
||||
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_def[197] =
|
||||
static yyconst short int yy_def[200] =
|
||||
{ 0,
|
||||
188, 1, 188, 188, 188, 189, 188, 188, 190, 191,
|
||||
188, 192, 192, 188, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 189, 191, 190,
|
||||
191, 188, 194, 31, 13, 195, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 196, 194, 195, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 196, 196,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
191, 1, 191, 191, 191, 192, 191, 191, 193, 194,
|
||||
191, 195, 195, 191, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 192, 194, 193,
|
||||
194, 191, 197, 31, 13, 198, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 199, 197, 198,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
199, 199, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 0, 188, 188,
|
||||
188, 188, 188, 188, 188, 188
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||
0, 191, 191, 191, 191, 191, 191, 191, 191
|
||||
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_nxt[277] =
|
||||
static yyconst short int yy_nxt[280] =
|
||||
{ 0,
|
||||
4, 5, 6, 7, 8, 4, 9, 10, 11, 12,
|
||||
13, 13, 13, 13, 13, 13, 13, 14, 15, 15,
|
||||
15, 16, 17, 18, 19, 15, 20, 15, 15, 21,
|
||||
15, 15, 15, 22, 23, 15, 24, 25, 26, 27,
|
||||
15, 15, 15, 15, 32, 34, 34, 33, 39, 41,
|
||||
43, 44, 154, 45, 40, 47, 48, 51, 42, 46,
|
||||
53, 52, 57, 54, 64, 65, 97, 91, 57, 92,
|
||||
155, 31, 93, 94, 187, 186, 98, 120, 185, 121,
|
||||
36, 188, 122, 123, 28, 184, 28, 28, 28, 28,
|
||||
28, 28, 30, 30, 35, 35, 183, 182, 35, 37,
|
||||
44, 45, 54, 46, 40, 55, 42, 58, 43, 47,
|
||||
48, 49, 52, 58, 66, 67, 53, 94, 100, 95,
|
||||
157, 31, 96, 97, 190, 189, 188, 123, 101, 124,
|
||||
36, 191, 125, 126, 187, 186, 185, 184, 158, 28,
|
||||
183, 28, 28, 28, 28, 28, 28, 30, 30, 35,
|
||||
|
||||
37, 37, 37, 58, 181, 58, 58, 58, 58, 58,
|
||||
58, 59, 59, 80, 180, 80, 179, 178, 177, 176,
|
||||
175, 174, 173, 172, 171, 170, 169, 168, 167, 166,
|
||||
165, 164, 163, 162, 161, 160, 159, 158, 157, 156,
|
||||
153, 152, 151, 150, 149, 148, 147, 146, 145, 144,
|
||||
143, 142, 141, 140, 139, 138, 137, 136, 135, 134,
|
||||
133, 132, 131, 130, 129, 128, 127, 126, 125, 124,
|
||||
119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
|
||||
109, 108, 107, 106, 105, 104, 103, 102, 188, 188,
|
||||
101, 100, 99, 96, 95, 90, 89, 88, 87, 86,
|
||||
35, 182, 181, 35, 37, 37, 37, 37, 59, 180,
|
||||
59, 59, 59, 59, 59, 59, 60, 60, 82, 179,
|
||||
82, 178, 177, 176, 175, 174, 173, 172, 171, 170,
|
||||
169, 168, 167, 166, 165, 164, 163, 162, 161, 160,
|
||||
159, 156, 155, 154, 153, 152, 151, 150, 149, 148,
|
||||
147, 146, 145, 144, 143, 142, 141, 140, 139, 138,
|
||||
137, 136, 135, 134, 133, 132, 131, 130, 129, 128,
|
||||
127, 122, 121, 120, 119, 118, 117, 116, 115, 114,
|
||||
113, 112, 111, 110, 109, 108, 107, 106, 105, 191,
|
||||
191, 104, 103, 102, 99, 98, 93, 92, 91, 90,
|
||||
|
||||
85, 84, 83, 82, 81, 79, 78, 77, 76, 75,
|
||||
74, 73, 72, 71, 70, 69, 68, 67, 66, 63,
|
||||
62, 61, 60, 34, 56, 55, 50, 49, 38, 29,
|
||||
188, 3, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188
|
||||
89, 88, 87, 86, 85, 84, 83, 81, 80, 79,
|
||||
78, 77, 76, 75, 74, 73, 72, 71, 70, 69,
|
||||
68, 65, 64, 63, 62, 61, 34, 57, 56, 51,
|
||||
50, 38, 29, 191, 3, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_chk[277] =
|
||||
static yyconst short int yy_chk[280] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 11, 12, 13, 11, 17, 18,
|
||||
19, 19, 142, 20, 17, 21, 21, 24, 18, 20,
|
||||
25, 24, 31, 25, 42, 42, 75, 70, 31, 70,
|
||||
142, 191, 70, 70, 186, 185, 75, 101, 184, 101,
|
||||
12, 13, 101, 101, 189, 183, 189, 189, 189, 189,
|
||||
189, 189, 190, 190, 192, 192, 182, 178, 192, 193,
|
||||
19, 19, 25, 20, 17, 25, 18, 31, 18, 20,
|
||||
21, 21, 24, 31, 43, 43, 24, 72, 77, 72,
|
||||
145, 194, 72, 72, 189, 188, 187, 104, 77, 104,
|
||||
12, 13, 104, 104, 186, 185, 181, 180, 145, 192,
|
||||
179, 192, 192, 192, 192, 192, 192, 193, 193, 195,
|
||||
|
||||
193, 193, 193, 194, 177, 194, 194, 194, 194, 194,
|
||||
194, 195, 195, 196, 176, 196, 173, 172, 171, 170,
|
||||
168, 167, 165, 164, 163, 162, 160, 159, 158, 157,
|
||||
156, 155, 154, 153, 151, 149, 148, 147, 145, 144,
|
||||
141, 140, 136, 135, 134, 133, 132, 130, 126, 123,
|
||||
122, 121, 120, 119, 118, 117, 116, 115, 114, 113,
|
||||
111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
|
||||
100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
|
||||
90, 88, 87, 86, 85, 83, 82, 81, 80, 79,
|
||||
78, 77, 76, 74, 71, 69, 68, 67, 66, 65,
|
||||
195, 176, 175, 195, 196, 196, 196, 196, 197, 174,
|
||||
197, 197, 197, 197, 197, 197, 198, 198, 199, 173,
|
||||
199, 171, 170, 168, 167, 166, 165, 163, 162, 161,
|
||||
160, 159, 158, 157, 156, 154, 152, 151, 150, 148,
|
||||
147, 144, 143, 139, 138, 137, 136, 135, 133, 129,
|
||||
126, 125, 124, 123, 122, 121, 120, 119, 118, 117,
|
||||
116, 114, 113, 112, 111, 110, 109, 108, 107, 106,
|
||||
105, 103, 102, 101, 100, 99, 98, 97, 96, 95,
|
||||
94, 93, 91, 90, 89, 88, 85, 84, 83, 82,
|
||||
81, 80, 79, 78, 76, 73, 71, 70, 69, 68,
|
||||
|
||||
64, 63, 62, 61, 60, 57, 56, 55, 54, 53,
|
||||
52, 51, 50, 49, 48, 47, 46, 45, 44, 41,
|
||||
40, 39, 38, 30, 27, 26, 23, 22, 16, 9,
|
||||
3, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
|
||||
188, 188, 188, 188, 188, 188
|
||||
67, 66, 65, 64, 63, 62, 61, 58, 57, 56,
|
||||
55, 54, 53, 52, 51, 50, 49, 48, 47, 46,
|
||||
45, 42, 41, 40, 39, 38, 30, 27, 26, 23,
|
||||
22, 16, 9, 3, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
|
||||
191, 191, 191, 191, 191, 191, 191, 191, 191
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
@ -886,7 +888,7 @@ inline void accept() {
|
||||
col_number += yyleng;
|
||||
}
|
||||
|
||||
#line 891 "lex.yy.c"
|
||||
#line 893 "lex.yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
@ -1048,7 +1050,7 @@ YY_DECL
|
||||
}
|
||||
|
||||
|
||||
#line 1053 "lex.yy.c"
|
||||
#line 1055 "lex.yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
@ -1099,13 +1101,13 @@ yy_match:
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 189 )
|
||||
if ( yy_current_state >= 192 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 232 );
|
||||
while ( yy_base[yy_current_state] != 235 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
@ -1386,7 +1388,7 @@ YY_RULE_SETUP
|
||||
#line 566 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_REQUIRED;
|
||||
return KW_CHAR;
|
||||
}
|
||||
YY_BREAK
|
||||
case 32:
|
||||
@ -1394,7 +1396,7 @@ YY_RULE_SETUP
|
||||
#line 571 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_BROADCAST;
|
||||
return KW_REQUIRED;
|
||||
}
|
||||
YY_BREAK
|
||||
case 33:
|
||||
@ -1402,7 +1404,7 @@ YY_RULE_SETUP
|
||||
#line 576 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_P2P;
|
||||
return KW_BROADCAST;
|
||||
}
|
||||
YY_BREAK
|
||||
case 34:
|
||||
@ -1410,7 +1412,7 @@ YY_RULE_SETUP
|
||||
#line 581 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_RAM;
|
||||
return KW_P2P;
|
||||
}
|
||||
YY_BREAK
|
||||
case 35:
|
||||
@ -1418,7 +1420,7 @@ YY_RULE_SETUP
|
||||
#line 586 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_DB;
|
||||
return KW_RAM;
|
||||
}
|
||||
YY_BREAK
|
||||
case 36:
|
||||
@ -1426,7 +1428,7 @@ YY_RULE_SETUP
|
||||
#line 591 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_CLSEND;
|
||||
return KW_DB;
|
||||
}
|
||||
YY_BREAK
|
||||
case 37:
|
||||
@ -1434,7 +1436,7 @@ YY_RULE_SETUP
|
||||
#line 596 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_CLRECV;
|
||||
return KW_CLSEND;
|
||||
}
|
||||
YY_BREAK
|
||||
case 38:
|
||||
@ -1442,7 +1444,7 @@ YY_RULE_SETUP
|
||||
#line 601 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_OWNSEND;
|
||||
return KW_CLRECV;
|
||||
}
|
||||
YY_BREAK
|
||||
case 39:
|
||||
@ -1450,12 +1452,20 @@ YY_RULE_SETUP
|
||||
#line 606 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_AIRECV;
|
||||
return KW_OWNSEND;
|
||||
}
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 611 "dcLexer.lxx"
|
||||
{
|
||||
accept();
|
||||
return KW_AIRECV;
|
||||
}
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 616 "dcLexer.lxx"
|
||||
{
|
||||
// An unsigned integer number.
|
||||
accept();
|
||||
@ -1479,9 +1489,9 @@ YY_RULE_SETUP
|
||||
return UNSIGNED_INTEGER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 41:
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 634 "dcLexer.lxx"
|
||||
#line 639 "dcLexer.lxx"
|
||||
{
|
||||
// A signed integer number.
|
||||
accept();
|
||||
@ -1528,9 +1538,9 @@ YY_RULE_SETUP
|
||||
return SIGNED_INTEGER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 42:
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 680 "dcLexer.lxx"
|
||||
#line 685 "dcLexer.lxx"
|
||||
{
|
||||
// A hexadecimal integer number.
|
||||
accept();
|
||||
@ -1558,9 +1568,9 @@ YY_RULE_SETUP
|
||||
return UNSIGNED_INTEGER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 43:
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 707 "dcLexer.lxx"
|
||||
#line 712 "dcLexer.lxx"
|
||||
{
|
||||
// A floating-point number.
|
||||
accept();
|
||||
@ -1569,9 +1579,9 @@ YY_RULE_SETUP
|
||||
return REAL;
|
||||
}
|
||||
YY_BREAK
|
||||
case 44:
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 715 "dcLexer.lxx"
|
||||
#line 720 "dcLexer.lxx"
|
||||
{
|
||||
// Quoted string.
|
||||
accept();
|
||||
@ -1579,9 +1589,9 @@ YY_RULE_SETUP
|
||||
return STRING;
|
||||
}
|
||||
YY_BREAK
|
||||
case 45:
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 722 "dcLexer.lxx"
|
||||
#line 727 "dcLexer.lxx"
|
||||
{
|
||||
// Single-quoted string.
|
||||
accept();
|
||||
@ -1589,9 +1599,9 @@ YY_RULE_SETUP
|
||||
return STRING;
|
||||
}
|
||||
YY_BREAK
|
||||
case 46:
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 729 "dcLexer.lxx"
|
||||
#line 734 "dcLexer.lxx"
|
||||
{
|
||||
// Long hex string.
|
||||
accept();
|
||||
@ -1599,9 +1609,9 @@ YY_RULE_SETUP
|
||||
return HEX_STRING;
|
||||
}
|
||||
YY_BREAK
|
||||
case 47:
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 736 "dcLexer.lxx"
|
||||
#line 741 "dcLexer.lxx"
|
||||
{
|
||||
// Identifier.
|
||||
accept();
|
||||
@ -1609,21 +1619,21 @@ YY_RULE_SETUP
|
||||
return IDENTIFIER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 48:
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 744 "dcLexer.lxx"
|
||||
#line 749 "dcLexer.lxx"
|
||||
{
|
||||
// Send any other printable character as itself.
|
||||
accept();
|
||||
return dcyytext[0];
|
||||
}
|
||||
YY_BREAK
|
||||
case 49:
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 750 "dcLexer.lxx"
|
||||
#line 755 "dcLexer.lxx"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1628 "lex.yy.c"
|
||||
#line 1638 "lex.yy.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@ -1915,7 +1925,7 @@ static yy_state_type yy_get_previous_state()
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 189 )
|
||||
if ( yy_current_state >= 192 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
@ -1950,11 +1960,11 @@ yy_state_type yy_current_state;
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 189 )
|
||||
if ( yy_current_state >= 192 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 188);
|
||||
yy_is_jam = (yy_current_state == 191);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
@ -2504,4 +2514,4 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 750 "dcLexer.lxx"
|
||||
#line 755 "dcLexer.lxx"
|
||||
|
@ -563,6 +563,11 @@ REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
|
||||
return KW_UINT32UINT8ARRAY;
|
||||
}
|
||||
|
||||
"char" {
|
||||
accept();
|
||||
return KW_CHAR;
|
||||
}
|
||||
|
||||
"required" {
|
||||
accept();
|
||||
return KW_REQUIRED;
|
||||
|
@ -166,6 +166,33 @@ output(ostream &out, Number divisor) const {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCNumericRange::output_char
|
||||
// Access: Public
|
||||
// Description: Outputs the range, formatting the numeric values as
|
||||
// quoted ASCII characters.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template <class NUM>
|
||||
void DCNumericRange<NUM>::
|
||||
output_char(ostream &out, Number divisor) const {
|
||||
if (divisor != 1) {
|
||||
output(out, divisor);
|
||||
|
||||
} else {
|
||||
if (!_ranges.empty()) {
|
||||
TYPENAME Ranges::const_iterator ri;
|
||||
ri = _ranges.begin();
|
||||
output_minmax_char(out, *ri);
|
||||
++ri;
|
||||
while (ri != _ranges.end()) {
|
||||
out << ", ";
|
||||
output_minmax_char(out, *ri);
|
||||
++ri;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCNumericRange::clear
|
||||
// Access: Public
|
||||
@ -284,3 +311,20 @@ output_minmax(ostream &out, Number divisor, const MinMax &range) const {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCNumericRange::output_minmax_char
|
||||
// Access: Private
|
||||
// Description: Outputs a single element of the range description.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template <class NUM>
|
||||
INLINE void DCNumericRange<NUM>::
|
||||
output_minmax_char(ostream &out, const MinMax &range) const {
|
||||
if (range._min == range._max) {
|
||||
DCPacker::enquote_string(out, '\'', string(1, range._min));
|
||||
} else {
|
||||
DCPacker::enquote_string(out, '\'', string(1, range._min));
|
||||
out << "-";
|
||||
DCPacker::enquote_string(out, '\'', string(1, range._max));
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "dcbase.h"
|
||||
#include "hashGenerator.h"
|
||||
#include "dcPacker.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DCNumericRange
|
||||
@ -47,6 +48,7 @@ public:
|
||||
void generate_hash(HashGenerator &hashgen) const;
|
||||
|
||||
void output(ostream &out, Number divisor = 1) const;
|
||||
void output_char(ostream &out, Number divisor = 1) const;
|
||||
|
||||
public:
|
||||
INLINE void clear();
|
||||
@ -66,6 +68,7 @@ private:
|
||||
Number _max;
|
||||
};
|
||||
INLINE void output_minmax(ostream &out, Number divisor, const MinMax &range) const;
|
||||
INLINE void output_minmax_char(ostream &out, const MinMax &range) const;
|
||||
|
||||
typedef pvector<MinMax> Ranges;
|
||||
Ranges _ranges;
|
||||
|
@ -688,6 +688,7 @@ unpack_object() {
|
||||
break;
|
||||
|
||||
case PT_string:
|
||||
case PT_blob:
|
||||
{
|
||||
string str;
|
||||
unpack_string(str);
|
||||
@ -807,6 +808,10 @@ unpack_and_format(ostream &out) {
|
||||
enquote_string(out, '"', unpack_string());
|
||||
break;
|
||||
|
||||
case PT_blob:
|
||||
output_hex_string(out, unpack_literal_value());
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
switch (pack_type) {
|
||||
@ -855,6 +860,50 @@ unpack_and_format(ostream &out) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::enquote_string
|
||||
// Access: Public, Static
|
||||
// Description: Outputs the indicated string within quotation marks.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DCPacker::
|
||||
enquote_string(ostream &out, char quote_mark, const string &str) {
|
||||
out << quote_mark;
|
||||
for (string::const_iterator pi = str.begin();
|
||||
pi != str.end();
|
||||
++pi) {
|
||||
if ((*pi) == quote_mark || (*pi) == '\\') {
|
||||
out << '\\' << (*pi);
|
||||
|
||||
} else if (!isprint(*pi)) {
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%02x", (unsigned int)(*pi));
|
||||
out << "\\x" << buffer;
|
||||
|
||||
} else {
|
||||
out << (*pi);
|
||||
}
|
||||
}
|
||||
out << quote_mark;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::output_hex_string
|
||||
// Access: Public, Static
|
||||
// Description: Outputs the indicated string as a hex constant.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DCPacker::
|
||||
output_hex_string(ostream &out, const string &str) {
|
||||
out << '<';
|
||||
for (string::const_iterator pi = str.begin();
|
||||
pi != str.end();
|
||||
++pi) {
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%02x", (unsigned int)(*pi));
|
||||
out << buffer;
|
||||
}
|
||||
out << '>';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::handle_switch
|
||||
// Access: Private
|
||||
@ -945,29 +994,3 @@ set_unpack_data(const char *unpack_data, size_t unpack_length,
|
||||
_unpack_length = unpack_length;
|
||||
_owns_unpack_data = owns_unpack_data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCPacker::enquote_string
|
||||
// Access: Private
|
||||
// Description: Outputs the indicated string within quotation marks.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DCPacker::
|
||||
enquote_string(ostream &out, char quote_mark, const string &str) const {
|
||||
out << quote_mark;
|
||||
for (string::const_iterator pi = str.begin();
|
||||
pi != str.end();
|
||||
++pi) {
|
||||
if ((*pi) == quote_mark || (*pi) == '\\') {
|
||||
out << '\\' << (*pi);
|
||||
|
||||
} else if (!isprint(*pi)) {
|
||||
char buffer[10];
|
||||
sprintf(buffer, "%02x", (unsigned int)(*pi));
|
||||
out << "\\x" << buffer;
|
||||
|
||||
} else {
|
||||
out << (*pi);
|
||||
}
|
||||
}
|
||||
out << quote_mark;
|
||||
}
|
||||
|
@ -124,13 +124,15 @@ PUBLISHED:
|
||||
public:
|
||||
INLINE const char *get_data() const;
|
||||
|
||||
static void enquote_string(ostream &out, char quote_mark, const string &str);
|
||||
static void output_hex_string(ostream &out, const string &str);
|
||||
|
||||
private:
|
||||
INLINE void advance();
|
||||
void handle_switch(const DCSwitch *dswitch);
|
||||
void clear();
|
||||
void set_unpack_data(const char *unpack_data, size_t unpack_length,
|
||||
bool owns_unpack_data);
|
||||
void enquote_string(ostream &out, char quote_mark, const string &str) const;
|
||||
|
||||
private:
|
||||
enum Mode {
|
||||
|
@ -252,7 +252,8 @@ r_fill_live_catalog(LiveCatalog *live_catalog, DCPacker &packer,
|
||||
live_catalog->_live_entries[field_index]._begin = packer.get_num_unpacked_bytes();
|
||||
}
|
||||
|
||||
if (packer.has_nested_fields() && packer.get_pack_type() != PT_string) {
|
||||
if (packer.has_nested_fields() &&
|
||||
(packer.get_pack_type() != PT_string && packer.get_pack_type() != PT_blob)) {
|
||||
packer.push();
|
||||
while (packer.more_nested_fields()) {
|
||||
r_fill_live_catalog(live_catalog, packer, last_switch);
|
||||
|
@ -35,13 +35,15 @@ enum DCPackType {
|
||||
|
||||
// These PackTypes are all fundamental types, and should be packed
|
||||
// (or unpacked) with the corresponding call to pack_double(),
|
||||
// pack_int(), etc.
|
||||
// pack_int(), etc. PT_blob is the same as PT_string, but implies
|
||||
// that the string contains binary data.
|
||||
PT_double,
|
||||
PT_int,
|
||||
PT_uint,
|
||||
PT_int64,
|
||||
PT_uint64,
|
||||
PT_string,
|
||||
PT_blob,
|
||||
|
||||
// The remaining PackTypes imply a need to call push() and pop().
|
||||
// They are all variants on the same thing: a list of nested fields,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,17 +33,18 @@
|
||||
# define KW_UINT16ARRAY 286
|
||||
# define KW_UINT32ARRAY 287
|
||||
# define KW_UINT32UINT8ARRAY 288
|
||||
# define KW_REQUIRED 289
|
||||
# define KW_BROADCAST 290
|
||||
# define KW_P2P 291
|
||||
# define KW_RAM 292
|
||||
# define KW_DB 293
|
||||
# define KW_CLSEND 294
|
||||
# define KW_CLRECV 295
|
||||
# define KW_OWNSEND 296
|
||||
# define KW_AIRECV 297
|
||||
# define START_DC 298
|
||||
# define START_PARAMETER_VALUE 299
|
||||
# define KW_CHAR 289
|
||||
# define KW_REQUIRED 290
|
||||
# define KW_BROADCAST 291
|
||||
# define KW_P2P 292
|
||||
# define KW_RAM 293
|
||||
# define KW_DB 294
|
||||
# define KW_CLSEND 295
|
||||
# define KW_CLRECV 296
|
||||
# define KW_OWNSEND 297
|
||||
# define KW_AIRECV 298
|
||||
# define START_DC 299
|
||||
# define START_PARAMETER_VALUE 300
|
||||
|
||||
|
||||
extern YYSTYPE dcyylval;
|
||||
|
@ -96,6 +96,7 @@ dc_cleanup_parser() {
|
||||
%token KW_UINT16ARRAY
|
||||
%token KW_UINT32ARRAY
|
||||
%token KW_UINT32UINT8ARRAY
|
||||
%token KW_CHAR
|
||||
|
||||
%token KW_REQUIRED
|
||||
%token KW_BROADCAST
|
||||
@ -131,9 +132,11 @@ dc_cleanup_parser() {
|
||||
%type <str> import_identifier
|
||||
%type <str> slash_identifier
|
||||
%type <str> optional_name
|
||||
%type <u.s_uint> char_or_uint
|
||||
%type <u.s_uint> small_unsigned_integer
|
||||
%type <u.int64> signed_integer
|
||||
%type <u.uint64> unsigned_integer
|
||||
%type <u.real> char_or_number
|
||||
%type <u.real> number
|
||||
|
||||
%%
|
||||
@ -448,21 +451,21 @@ double_range:
|
||||
{
|
||||
double_range.clear();
|
||||
}
|
||||
| number
|
||||
| char_or_number
|
||||
{
|
||||
double_range.clear();
|
||||
if (!double_range.add_range($1, $1)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| number '-' number
|
||||
| char_or_number '-' char_or_number
|
||||
{
|
||||
double_range.clear();
|
||||
if (!double_range.add_range($1, $3)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| number number
|
||||
| char_or_number number
|
||||
{
|
||||
double_range.clear();
|
||||
if ($2 >= 0) {
|
||||
@ -471,19 +474,19 @@ double_range:
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| double_range ',' number
|
||||
| double_range ',' char_or_number
|
||||
{
|
||||
if (!double_range.add_range($3, $3)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| double_range ',' number '-' number
|
||||
| double_range ',' char_or_number '-' char_or_number
|
||||
{
|
||||
if (!double_range.add_range($3, $5)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| double_range ',' number number
|
||||
| double_range ',' char_or_number number
|
||||
{
|
||||
if ($4 >= 0) {
|
||||
yyerror("Syntax error");
|
||||
@ -498,27 +501,27 @@ uint_range:
|
||||
{
|
||||
uint_range.clear();
|
||||
}
|
||||
| small_unsigned_integer
|
||||
| char_or_uint
|
||||
{
|
||||
uint_range.clear();
|
||||
if (!uint_range.add_range($1, $1)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| small_unsigned_integer '-' small_unsigned_integer
|
||||
| char_or_uint '-' char_or_uint
|
||||
{
|
||||
uint_range.clear();
|
||||
if (!uint_range.add_range($1, $3)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| uint_range ',' small_unsigned_integer
|
||||
| uint_range ',' char_or_uint
|
||||
{
|
||||
if (!uint_range.add_range($3, $3)) {
|
||||
yyerror("Overlapping range");
|
||||
}
|
||||
}
|
||||
| uint_range ',' small_unsigned_integer '-' small_unsigned_integer
|
||||
| uint_range ',' char_or_uint '-' char_or_uint
|
||||
{
|
||||
if (!uint_range.add_range($3, $5)) {
|
||||
yyerror("Overlapping range");
|
||||
@ -560,6 +563,19 @@ parameter_definition:
|
||||
}
|
||||
;
|
||||
|
||||
char_or_uint:
|
||||
STRING
|
||||
{
|
||||
if ($1.length() != 1) {
|
||||
yyerror("Single character required.");
|
||||
$$ = 0;
|
||||
} else {
|
||||
$$ = (unsigned char)$1[0];
|
||||
}
|
||||
}
|
||||
| small_unsigned_integer
|
||||
;
|
||||
|
||||
small_unsigned_integer:
|
||||
UNSIGNED_INTEGER
|
||||
{
|
||||
@ -591,6 +607,20 @@ number:
|
||||
| REAL
|
||||
;
|
||||
|
||||
char_or_number:
|
||||
STRING
|
||||
{
|
||||
if ($1.length() != 1) {
|
||||
yyerror("Single character required.");
|
||||
$$ = 0;
|
||||
} else {
|
||||
$$ = (double)(unsigned char)$1[0];
|
||||
}
|
||||
}
|
||||
| number
|
||||
;
|
||||
|
||||
|
||||
parameter_value:
|
||||
signed_integer
|
||||
{
|
||||
@ -753,6 +783,10 @@ type_token:
|
||||
| KW_UINT32UINT8ARRAY
|
||||
{
|
||||
$$ = ST_uint32uint8array;
|
||||
}
|
||||
| KW_CHAR
|
||||
{
|
||||
$$ = ST_char;
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -96,18 +96,23 @@ DCSimpleParameter(DCSubatomicType type, unsigned int divisor) :
|
||||
case ST_blob32:
|
||||
_num_length_bytes = 4;
|
||||
// fall through
|
||||
|
||||
case ST_blob:
|
||||
case ST_string:
|
||||
// For these types, we will present an array interface as an array
|
||||
// of uint8, but we will also accept a set_value() with a string
|
||||
// parameter.
|
||||
_pack_type = PT_string;
|
||||
// For blob and string, we will present an array interface
|
||||
// as an array of uint8, but we will also accept a set_value()
|
||||
// with a string parameter.
|
||||
_pack_type = PT_blob;
|
||||
_nested_type = ST_uint8;
|
||||
_has_nested_fields = true;
|
||||
_bytes_per_element = 1;
|
||||
break;
|
||||
|
||||
case ST_string:
|
||||
_pack_type = PT_string;
|
||||
_nested_type = ST_char;
|
||||
_has_nested_fields = true;
|
||||
_bytes_per_element = 1;
|
||||
break;
|
||||
|
||||
// The simple types can be packed directly.
|
||||
case ST_int8:
|
||||
_pack_type = PT_int;
|
||||
@ -133,6 +138,12 @@ DCSimpleParameter(DCSubatomicType type, unsigned int divisor) :
|
||||
_fixed_byte_size = 8;
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
_pack_type = PT_string;
|
||||
_has_fixed_byte_size = true;
|
||||
_fixed_byte_size = 1;
|
||||
break;
|
||||
|
||||
case ST_uint8:
|
||||
_pack_type = PT_uint;
|
||||
_has_fixed_byte_size = true;
|
||||
@ -271,7 +282,7 @@ get_divisor() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool DCSimpleParameter::
|
||||
set_divisor(unsigned int divisor) {
|
||||
if (_pack_type == PT_string || divisor == 0) {
|
||||
if (_pack_type == PT_string || _pack_type == PT_blob || divisor == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -347,6 +358,7 @@ set_range(const DCDoubleRange &range) {
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
case ST_uint8array:
|
||||
_uint_range.clear();
|
||||
@ -532,6 +544,7 @@ pack_double(DCPackData &pack_data, double value,
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
{
|
||||
unsigned int int_value = (unsigned int)floor(real_value + 0.5);
|
||||
@ -610,6 +623,7 @@ pack_int(DCPackData &pack_data, int value,
|
||||
do_pack_int64(pack_data.get_write_pointer(8), int_value);
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
_uint_range.validate((unsigned int)int_value, range_error);
|
||||
validate_uint_limits((unsigned int)int_value, 8, range_error);
|
||||
@ -676,6 +690,7 @@ pack_uint(DCPackData &pack_data, unsigned int value,
|
||||
do_pack_int64(pack_data.get_write_pointer(8), (int)int_value);
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
_uint_range.validate(int_value, range_error);
|
||||
validate_uint_limits(int_value, 8, range_error);
|
||||
@ -743,6 +758,7 @@ pack_int64(DCPackData &pack_data, PN_int64 value,
|
||||
do_pack_int64(pack_data.get_write_pointer(8), int_value);
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
_uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
|
||||
validate_uint64_limits((PN_uint64)int_value, 8, range_error);
|
||||
@ -811,6 +827,7 @@ pack_uint64(DCPackData &pack_data, PN_uint64 value,
|
||||
do_pack_int64(pack_data.get_write_pointer(8), (PN_int64)int_value);
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
_uint_range.validate((unsigned int)int_value, range_error);
|
||||
validate_uint64_limits(int_value, 8, range_error);
|
||||
@ -854,11 +871,25 @@ void DCSimpleParameter::
|
||||
pack_string(DCPackData &pack_data, const string &value,
|
||||
bool &pack_error, bool &range_error) const {
|
||||
size_t string_length = value.length();
|
||||
_uint_range.validate(string_length, range_error);
|
||||
|
||||
switch (_type) {
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
case ST_int8:
|
||||
if (string_length == 0) {
|
||||
pack_error = true;
|
||||
} else {
|
||||
if (string_length != 1) {
|
||||
range_error = true;
|
||||
}
|
||||
_uint_range.validate((unsigned int)value[0], range_error);
|
||||
do_pack_uint8(pack_data.get_write_pointer(1), (unsigned int)value[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_string:
|
||||
case ST_blob:
|
||||
_uint_range.validate(string_length, range_error);
|
||||
validate_uint_limits(string_length, 16, range_error);
|
||||
if (_num_length_bytes != 0) {
|
||||
do_pack_uint16(pack_data.get_write_pointer(2), string_length);
|
||||
@ -867,6 +898,7 @@ pack_string(DCPackData &pack_data, const string &value,
|
||||
break;
|
||||
|
||||
case ST_blob32:
|
||||
_uint_range.validate(string_length, range_error);
|
||||
if (_num_length_bytes != 0) {
|
||||
do_pack_uint32(pack_data.get_write_pointer(4), string_length);
|
||||
}
|
||||
@ -940,6 +972,7 @@ unpack_double(const char *data, size_t length, size_t &p, double &value,
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
{
|
||||
if (p + 1 > length) {
|
||||
@ -1073,6 +1106,7 @@ unpack_int(const char *data, size_t length, size_t &p, int &value,
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
{
|
||||
if (p + 1 > length) {
|
||||
@ -1233,6 +1267,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
if (p + 1 > length) {
|
||||
pack_error = true;
|
||||
@ -1354,6 +1389,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
|
||||
p += 8;
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
{
|
||||
if (p + 1 > length) {
|
||||
@ -1508,6 +1544,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
if (p + 1 > length) {
|
||||
pack_error = true;
|
||||
@ -1582,6 +1619,27 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
|
||||
void DCSimpleParameter::
|
||||
unpack_string(const char *data, size_t length, size_t &p, string &value,
|
||||
bool &pack_error, bool &range_error) const {
|
||||
// If the type is a single byte, unpack it into a string of length 1.
|
||||
switch (_type) {
|
||||
case ST_char:
|
||||
case ST_int8:
|
||||
case ST_uint8:
|
||||
{
|
||||
if (p + 1 > length) {
|
||||
pack_error = true;
|
||||
return;
|
||||
}
|
||||
unsigned int int_value = do_unpack_uint8(data + p);
|
||||
_uint_range.validate(int_value, range_error);
|
||||
value.assign(1, int_value);
|
||||
p++;
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
size_t string_length;
|
||||
|
||||
if (_num_length_bytes == 0) {
|
||||
@ -1687,6 +1745,7 @@ unpack_validate(const char *data, size_t length, size_t &p,
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
case ST_uint8:
|
||||
{
|
||||
if (p + 1 > length) {
|
||||
@ -1798,6 +1857,7 @@ unpack_skip(const char *data, size_t length, size_t &p) const {
|
||||
size_t string_length;
|
||||
|
||||
switch (_type) {
|
||||
case ST_char:
|
||||
case ST_int8:
|
||||
case ST_uint8:
|
||||
p++;
|
||||
@ -1903,6 +1963,14 @@ output_instance(ostream &out, const string &prename, const string &name,
|
||||
out << ")";
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_char:
|
||||
if (!_uint_range.is_empty()) {
|
||||
out << "(";
|
||||
_uint_range.output_char(out, _divisor);
|
||||
out << ")";
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_uint64:
|
||||
if (!_uint64_range.is_empty()) {
|
||||
|
@ -78,6 +78,9 @@ operator << (ostream &out, DCSubatomicType type) {
|
||||
case ST_uint32uint8array:
|
||||
return out << "uint32uint8array";
|
||||
|
||||
case ST_char:
|
||||
return out << "char";
|
||||
|
||||
case ST_invalid:
|
||||
return out << "invalid";
|
||||
}
|
||||
|
@ -57,6 +57,10 @@ enum DCSubatomicType {
|
||||
// values. In Python, this becomes a list of 2-tuples.
|
||||
ST_uint32uint8array,
|
||||
|
||||
// Equivalent to uint8, except that it suggests a pack_type of
|
||||
// PT_string.
|
||||
ST_char,
|
||||
|
||||
// New additions should be added at the end to prevent the file hash
|
||||
// code from changing.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user