From c5358889664191dc92f37f8716b7f1b94312138d Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 24 Jun 2004 22:16:30 +0000 Subject: [PATCH] add char type --- direct/src/dcparser/dcLexer.cxx.prebuilt | 306 ++++---- direct/src/dcparser/dcLexer.lxx | 5 + direct/src/dcparser/dcNumericRange.I | 44 ++ direct/src/dcparser/dcNumericRange.h | 3 + direct/src/dcparser/dcPacker.cxx | 75 +- direct/src/dcparser/dcPacker.h | 4 +- direct/src/dcparser/dcPackerCatalog.cxx | 3 +- direct/src/dcparser/dcPackerInterface.h | 4 +- direct/src/dcparser/dcParser.cxx.prebuilt | 834 ++++++++++++---------- direct/src/dcparser/dcParser.h.prebuilt | 23 +- direct/src/dcparser/dcParser.yxx | 54 +- direct/src/dcparser/dcSimpleParameter.cxx | 84 ++- direct/src/dcparser/dcSubatomicType.cxx | 3 + direct/src/dcparser/dcSubatomicType.h | 4 + 14 files changed, 846 insertions(+), 600 deletions(-) diff --git a/direct/src/dcparser/dcLexer.cxx.prebuilt b/direct/src/dcparser/dcLexer.cxx.prebuilt index e85f220b09..f886f78477 100644 --- a/direct/src/dcparser/dcLexer.cxx.prebuilt +++ b/direct/src/dcparser/dcLexer.cxx.prebuilt @@ -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" diff --git a/direct/src/dcparser/dcLexer.lxx b/direct/src/dcparser/dcLexer.lxx index e6a61bae47..186e8d9c8e 100644 --- a/direct/src/dcparser/dcLexer.lxx +++ b/direct/src/dcparser/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; diff --git a/direct/src/dcparser/dcNumericRange.I b/direct/src/dcparser/dcNumericRange.I index bec5260fb2..6ab4129dd1 100644 --- a/direct/src/dcparser/dcNumericRange.I +++ b/direct/src/dcparser/dcNumericRange.I @@ -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 +void DCNumericRange:: +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 +INLINE void DCNumericRange:: +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)); + } +} diff --git a/direct/src/dcparser/dcNumericRange.h b/direct/src/dcparser/dcNumericRange.h index 7744431054..1ed7258569 100644 --- a/direct/src/dcparser/dcNumericRange.h +++ b/direct/src/dcparser/dcNumericRange.h @@ -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 Ranges; Ranges _ranges; diff --git a/direct/src/dcparser/dcPacker.cxx b/direct/src/dcparser/dcPacker.cxx index 8cac88a806..0c8f6bb419 100755 --- a/direct/src/dcparser/dcPacker.cxx +++ b/direct/src/dcparser/dcPacker.cxx @@ -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; -} diff --git a/direct/src/dcparser/dcPacker.h b/direct/src/dcparser/dcPacker.h index 96ee7df2b2..25597caaa3 100755 --- a/direct/src/dcparser/dcPacker.h +++ b/direct/src/dcparser/dcPacker.h @@ -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 { diff --git a/direct/src/dcparser/dcPackerCatalog.cxx b/direct/src/dcparser/dcPackerCatalog.cxx index 0879ab96c8..ea0e031aee 100644 --- a/direct/src/dcparser/dcPackerCatalog.cxx +++ b/direct/src/dcparser/dcPackerCatalog.cxx @@ -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); diff --git a/direct/src/dcparser/dcPackerInterface.h b/direct/src/dcparser/dcPackerInterface.h index 4228ebd157..ffab344dfb 100755 --- a/direct/src/dcparser/dcPackerInterface.h +++ b/direct/src/dcparser/dcPackerInterface.h @@ -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, diff --git a/direct/src/dcparser/dcParser.cxx.prebuilt b/direct/src/dcparser/dcParser.cxx.prebuilt index 5ff94eb2b6..49d8f9e406 100644 --- a/direct/src/dcparser/dcParser.cxx.prebuilt +++ b/direct/src/dcparser/dcParser.cxx.prebuilt @@ -42,17 +42,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 #line 6 "dcParser.yxx" @@ -120,12 +121,12 @@ dc_cleanup_parser() { -#define YYFINAL 215 +#define YYFINAL 220 #define YYFLAG -32768 -#define YYNTBASE 60 +#define YYNTBASE 61 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 117) +#define YYTRANSLATE(x) ((unsigned)(x) <= 300 ? yytranslate[x] : 120) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -134,15 +135,15 @@ static const char yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 54, 55, 51, 2, 52, 57, 50, 49, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 53, 46, - 2, 56, 2, 2, 2, 2, 2, 2, 2, 2, + 55, 56, 52, 2, 53, 58, 51, 50, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 54, 47, + 2, 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 58, 2, 59, 2, 2, 2, 2, 2, 2, + 2, 59, 2, 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 47, 2, 48, 2, 2, 2, 2, + 2, 2, 2, 48, 2, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -159,7 +160,8 @@ static const char yytranslate[] = 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46 }; #if YYDEBUG @@ -173,58 +175,60 @@ static const short yyprhs[] = 135, 137, 139, 144, 148, 155, 162, 164, 166, 168, 172, 175, 179, 185, 190, 192, 194, 198, 202, 208, 210, 215, 217, 221, 226, 228, 230, 232, 234, 236, - 238, 240, 242, 244, 246, 248, 249, 254, 255, 260, - 261, 266, 270, 274, 278, 282, 284, 287, 289, 291, - 293, 297, 299, 301, 303, 305, 307, 309, 311, 313, + 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, + 257, 262, 263, 268, 269, 274, 278, 282, 286, 290, + 292, 295, 297, 299, 301, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 331, 333, - 335, 337, 340, 343, 346, 349, 352, 355, 358, 361, - 364, 365, 370, 372, 374, 378, 380, 382, 383, 393, - 395, 398, 401, 404, 405, 410, 412, 415, 417 + 335, 337, 339, 341, 343, 345, 347, 350, 353, 356, + 359, 362, 365, 368, 371, 374, 375, 380, 382, 384, + 388, 390, 392, 393, 403, 405, 408, 411, 414, 415, + 420, 422, 425, 427 }; static const short yyrhs[] = { - 44, 61, 0, 45, 96, 0, 116, 0, 61, 46, - 0, 61, 62, 0, 61, 68, 0, 61, 72, 0, - 0, 64, 8, 63, 73, 47, 75, 48, 0, 10, - 0, 9, 0, 8, 0, 8, 0, 66, 49, 8, - 0, 66, 0, 67, 50, 66, 0, 12, 67, 0, - 0, 11, 67, 12, 69, 70, 0, 71, 0, 51, - 0, 66, 0, 71, 52, 66, 0, 13, 86, 0, - 116, 0, 53, 74, 0, 65, 0, 74, 52, 65, - 0, 116, 0, 75, 46, 0, 75, 76, 0, 77, - 0, 105, 0, 110, 0, 85, 46, 0, 83, 0, - 0, 8, 54, 78, 79, 55, 104, 0, 116, 0, - 80, 0, 81, 0, 80, 52, 81, 0, 86, 0, - 0, 86, 56, 82, 96, 0, 0, 90, 84, 91, - 0, 90, 0, 83, 0, 85, 0, 103, 0, 103, - 54, 88, 55, 0, 103, 49, 92, 0, 103, 49, - 92, 54, 88, 55, 0, 103, 54, 88, 55, 49, - 92, 0, 8, 0, 116, 0, 95, 0, 95, 57, - 95, 0, 95, 95, 0, 88, 52, 95, 0, 88, - 52, 95, 57, 95, 0, 88, 52, 95, 95, 0, - 116, 0, 92, 0, 92, 57, 92, 0, 89, 52, - 92, 0, 89, 52, 92, 57, 92, 0, 87, 0, - 90, 58, 89, 59, 0, 8, 0, 91, 49, 92, - 0, 91, 58, 89, 59, 0, 3, 0, 4, 0, - 3, 0, 94, 0, 93, 0, 5, 0, 93, 0, - 94, 0, 5, 0, 6, 0, 7, 0, 0, 47, - 97, 100, 48, 0, 0, 58, 98, 100, 59, 0, - 0, 54, 99, 100, 55, 0, 93, 51, 92, 0, - 94, 51, 92, 0, 5, 51, 92, 0, 7, 51, - 92, 0, 101, 0, 102, 101, 0, 116, 0, 52, - 0, 96, 0, 102, 52, 96, 0, 16, 0, 17, - 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, - 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, - 0, 28, 0, 29, 0, 30, 0, 31, 0, 32, - 0, 33, 0, 34, 0, 116, 0, 104, 35, 0, - 104, 36, 0, 104, 37, 0, 104, 38, 0, 104, - 39, 0, 104, 40, 0, 104, 41, 0, 104, 42, - 0, 104, 43, 0, 0, 8, 53, 106, 108, 0, - 8, 0, 107, 0, 108, 52, 107, 0, 116, 0, - 8, 0, 0, 14, 109, 54, 86, 55, 47, 111, - 112, 48, 0, 116, 0, 112, 46, 0, 112, 113, - 0, 112, 115, 0, 0, 15, 114, 96, 53, 0, - 110, 0, 85, 46, 0, 83, 0, 0 + 45, 62, 0, 46, 99, 0, 119, 0, 62, 47, + 0, 62, 63, 0, 62, 69, 0, 62, 73, 0, + 0, 65, 8, 64, 74, 48, 76, 49, 0, 10, + 0, 9, 0, 8, 0, 8, 0, 67, 50, 8, + 0, 67, 0, 68, 51, 67, 0, 12, 68, 0, + 0, 11, 68, 12, 70, 71, 0, 72, 0, 52, + 0, 67, 0, 72, 53, 67, 0, 13, 87, 0, + 119, 0, 54, 75, 0, 66, 0, 75, 53, 66, + 0, 119, 0, 76, 47, 0, 76, 77, 0, 78, + 0, 108, 0, 113, 0, 86, 47, 0, 84, 0, + 0, 8, 55, 79, 80, 56, 107, 0, 119, 0, + 81, 0, 82, 0, 81, 53, 82, 0, 87, 0, + 0, 87, 57, 83, 99, 0, 0, 91, 85, 92, + 0, 91, 0, 84, 0, 86, 0, 106, 0, 106, + 55, 89, 56, 0, 106, 50, 94, 0, 106, 50, + 94, 55, 89, 56, 0, 106, 55, 89, 56, 50, + 94, 0, 8, 0, 119, 0, 98, 0, 98, 58, + 98, 0, 98, 97, 0, 89, 53, 98, 0, 89, + 53, 98, 58, 98, 0, 89, 53, 98, 97, 0, + 119, 0, 93, 0, 93, 58, 93, 0, 90, 53, + 93, 0, 90, 53, 93, 58, 93, 0, 88, 0, + 91, 59, 90, 60, 0, 8, 0, 92, 50, 94, + 0, 92, 59, 90, 60, 0, 6, 0, 94, 0, + 3, 0, 4, 0, 3, 0, 96, 0, 95, 0, + 5, 0, 6, 0, 97, 0, 95, 0, 96, 0, + 5, 0, 6, 0, 7, 0, 0, 48, 100, 103, + 49, 0, 0, 59, 101, 103, 60, 0, 0, 55, + 102, 103, 56, 0, 95, 52, 94, 0, 96, 52, + 94, 0, 5, 52, 94, 0, 7, 52, 94, 0, + 104, 0, 105, 104, 0, 119, 0, 53, 0, 99, + 0, 105, 53, 99, 0, 16, 0, 17, 0, 18, + 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, + 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, + 0, 29, 0, 30, 0, 31, 0, 32, 0, 33, + 0, 34, 0, 35, 0, 119, 0, 107, 36, 0, + 107, 37, 0, 107, 38, 0, 107, 39, 0, 107, + 40, 0, 107, 41, 0, 107, 42, 0, 107, 43, + 0, 107, 44, 0, 0, 8, 54, 109, 111, 0, + 8, 0, 110, 0, 111, 53, 110, 0, 119, 0, + 8, 0, 0, 14, 112, 55, 87, 56, 48, 114, + 115, 49, 0, 119, 0, 115, 47, 0, 115, 116, + 0, 115, 118, 0, 0, 15, 117, 99, 54, 0, + 113, 0, 86, 47, 0, 84, 0, 0 }; #endif @@ -233,21 +237,22 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 141, 143, 146, 148, 149, 150, 151, 154, 154, - 170, 175, 181, 194, 196, 202, 204, 210, 215, 215, - 222, 224, 230, 235, 241, 257, 259, 262, 269, 277, - 279, 280, 288, 290, 291, 292, 296, 302, 302, 313, - 315, 318, 320, 323, 329, 329, 353, 353, 364, 368, - 370, 373, 378, 386, 397, 411, 425, 446, 451, 458, - 465, 474, 480, 486, 496, 501, 508, 515, 521, 529, - 531, 537, 543, 557, 563, 574, 578, 582, 587, 591, - 594, 599, 603, 607, 611, 615, 615, 623, 623, 631, - 631, 639, 645, 651, 657, 665, 667, 670, 672, 675, - 677, 680, 685, 689, 693, 697, 701, 705, 709, 713, - 717, 721, 725, 729, 733, 737, 741, 745, 749, 753, - 759, 761, 765, 769, 773, 777, 781, 785, 789, 793, - 799, 799, 810, 826, 833, 846, 851, 854, 854, 868, - 870, 871, 872, 882, 882, 898, 900, 904, 910 + 0, 144, 146, 149, 151, 152, 153, 154, 157, 157, + 173, 178, 184, 197, 199, 205, 207, 213, 218, 218, + 225, 227, 233, 238, 244, 260, 262, 265, 272, 280, + 282, 283, 291, 293, 294, 295, 299, 305, 305, 316, + 318, 321, 323, 326, 332, 332, 356, 356, 367, 371, + 373, 376, 381, 389, 400, 414, 428, 449, 454, 461, + 468, 477, 483, 489, 499, 504, 511, 518, 524, 532, + 534, 540, 546, 560, 566, 576, 579, 590, 594, 598, + 603, 607, 610, 620, 624, 629, 633, 637, 641, 645, + 645, 653, 653, 661, 661, 669, 675, 681, 687, 695, + 697, 700, 702, 705, 707, 710, 715, 719, 723, 727, + 731, 735, 739, 743, 747, 751, 755, 759, 763, 767, + 771, 775, 779, 783, 787, 793, 795, 799, 803, 807, + 811, 815, 819, 823, 827, 833, 833, 844, 860, 867, + 880, 885, 888, 888, 902, 904, 905, 906, 916, 916, + 932, 934, 938, 944 }; #endif @@ -264,44 +269,46 @@ static const char *const yytname[] = "KW_UINT32", "KW_UINT64", "KW_FLOAT64", "KW_STRING", "KW_BLOB", "KW_BLOB32", "KW_INT8ARRAY", "KW_INT16ARRAY", "KW_INT32ARRAY", "KW_UINT8ARRAY", "KW_UINT16ARRAY", "KW_UINT32ARRAY", - "KW_UINT32UINT8ARRAY", "KW_REQUIRED", "KW_BROADCAST", "KW_P2P", - "KW_RAM", "KW_DB", "KW_CLSEND", "KW_CLRECV", "KW_OWNSEND", "KW_AIRECV", - "START_DC", "START_PARAMETER_VALUE", "';'", "'{'", "'}'", "'/'", "'.'", - "'*'", "','", "':'", "'('", "')'", "'='", "'-'", "'['", "']'", - "grammar", "dc", "dclass", "@1", "kw_struct_or_kw_dclass", + "KW_UINT32UINT8ARRAY", "KW_CHAR", "KW_REQUIRED", "KW_BROADCAST", + "KW_P2P", "KW_RAM", "KW_DB", "KW_CLSEND", "KW_CLRECV", "KW_OWNSEND", + "KW_AIRECV", "START_DC", "START_PARAMETER_VALUE", "';'", "'{'", "'}'", + "'/'", "'.'", "'*'", "','", "':'", "'('", "')'", "'='", "'-'", "'['", + "']'", "grammar", "dc", "dclass", "@1", "kw_struct_or_kw_dclass", "dclass_name", "slash_identifier", "import_identifier", "import", "@2", "import_symbol_list_or_star", "import_symbol_list", "typedef_decl", "dclass_derivation", "base_list", "dclass_fields", "dclass_field", "atomic_field", "@3", "parameter_list", "nonempty_parameter_list", "atomic_element", "@4", "named_parameter", "@5", "unnamed_parameter", "parameter", "type_name", "double_range", "uint_range", - "type_definition", "parameter_definition", "small_unsigned_integer", - "signed_integer", "unsigned_integer", "number", "parameter_value", "@6", - "@7", "@8", "array", "maybe_comma", "array_def", "type_token", - "atomic_flags", "molecular_field", "@9", "atomic_name", - "molecular_atom_list", "optional_name", "switch", "@10", - "switch_fields", "switch_case", "@11", "switch_field", "empty", 0 + "type_definition", "parameter_definition", "char_or_uint", + "small_unsigned_integer", "signed_integer", "unsigned_integer", + "number", "char_or_number", "parameter_value", "@6", "@7", "@8", + "array", "maybe_comma", "array_def", "type_token", "atomic_flags", + "molecular_field", "@9", "atomic_name", "molecular_atom_list", + "optional_name", "switch", "@10", "switch_fields", "switch_case", "@11", + "switch_field", "empty", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 0, 60, 60, 61, 61, 61, 61, 61, 63, 62, - 64, 64, 65, 66, 66, 67, 67, 68, 69, 68, - 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, - 75, 75, 76, 76, 76, 76, 76, 78, 77, 79, - 79, 80, 80, 81, 82, 81, 84, 83, 85, 86, - 86, 87, 87, 87, 87, 87, 87, 88, 88, 88, - 88, 88, 88, 88, 89, 89, 89, 89, 89, 90, - 90, 91, 91, 91, 92, 93, 94, 95, 95, 95, - 96, 96, 96, 96, 96, 97, 96, 98, 96, 99, - 96, 96, 96, 96, 96, 100, 100, 101, 101, 102, - 102, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, - 106, 105, 107, 108, 108, 109, 109, 111, 110, 112, - 112, 112, 112, 114, 113, 115, 115, 115, 116 + 0, 61, 61, 62, 62, 62, 62, 62, 64, 63, + 65, 65, 66, 67, 67, 68, 68, 69, 70, 69, + 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, + 76, 76, 77, 77, 77, 77, 77, 79, 78, 80, + 80, 81, 81, 82, 83, 82, 85, 84, 86, 87, + 87, 88, 88, 88, 88, 88, 88, 89, 89, 89, + 89, 89, 89, 89, 90, 90, 90, 90, 90, 91, + 91, 92, 92, 92, 93, 93, 94, 95, 96, 97, + 97, 97, 98, 98, 99, 99, 99, 99, 99, 100, + 99, 101, 99, 102, 99, 99, 99, 99, 99, 103, + 103, 104, 104, 105, 105, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 109, 108, 110, 111, 111, + 112, 112, 114, 113, 115, 115, 115, 115, 117, 116, + 118, 118, 118, 119 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -315,13 +322,14 @@ static const short yyr2[] = 1, 1, 4, 3, 6, 6, 1, 1, 1, 3, 2, 3, 5, 4, 1, 1, 3, 3, 5, 1, 4, 1, 3, 4, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 4, 0, 4, 0, - 4, 3, 3, 3, 3, 1, 2, 1, 1, 1, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 4, 0, 4, 0, 4, 3, 3, 3, 3, 1, + 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 0, 4, 1, 1, 3, 1, 1, 0, 9, 1, - 2, 2, 2, 0, 4, 1, 2, 1, 0 + 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 0, 4, 1, 1, 3, + 1, 1, 0, 9, 1, 2, 2, 2, 0, 4, + 1, 2, 1, 0 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -329,140 +337,150 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 0, 148, 0, 1, 3, 76, 75, 82, 83, 84, - 85, 89, 87, 80, 81, 2, 11, 10, 0, 0, - 0, 4, 5, 0, 6, 7, 0, 0, 148, 148, - 148, 0, 0, 13, 15, 0, 17, 56, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 49, 50, 24, - 69, 48, 51, 8, 74, 93, 94, 98, 99, 0, - 95, 148, 97, 0, 0, 91, 92, 0, 18, 0, - 148, 0, 0, 148, 148, 86, 98, 96, 90, 88, - 14, 0, 16, 0, 65, 64, 71, 47, 53, 79, - 0, 78, 77, 58, 57, 0, 0, 25, 100, 21, - 22, 19, 20, 0, 70, 0, 0, 148, 148, 0, - 52, 0, 60, 12, 27, 26, 148, 0, 67, 66, - 72, 0, 0, 61, 0, 59, 0, 0, 29, 23, - 0, 73, 54, 0, 63, 55, 28, 56, 148, 30, - 9, 31, 32, 36, 0, 33, 34, 68, 62, 130, - 37, 136, 0, 135, 35, 0, 148, 0, 132, 133, - 131, 0, 40, 41, 43, 39, 0, 0, 148, 0, - 44, 0, 134, 38, 120, 42, 0, 137, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 45, 148, 0, - 139, 143, 140, 138, 147, 0, 145, 141, 142, 0, - 146, 0, 144, 0, 0, 0 + 0, 153, 0, 1, 3, 78, 77, 86, 87, 88, + 89, 93, 91, 84, 85, 2, 11, 10, 0, 0, + 0, 4, 5, 0, 6, 7, 0, 0, 153, 153, + 153, 0, 0, 13, 15, 0, 17, 56, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 49, 50, + 24, 69, 48, 51, 8, 76, 97, 98, 102, 103, + 0, 99, 153, 101, 0, 0, 95, 96, 0, 18, + 0, 153, 0, 0, 153, 153, 90, 102, 100, 94, + 92, 14, 0, 16, 74, 0, 65, 75, 64, 71, + 47, 53, 81, 82, 0, 80, 79, 83, 58, 57, + 0, 0, 25, 104, 21, 22, 19, 20, 0, 70, + 0, 0, 153, 153, 0, 52, 0, 60, 12, 27, + 26, 153, 0, 67, 66, 72, 0, 0, 61, 0, + 59, 0, 0, 29, 23, 0, 73, 54, 0, 63, + 55, 28, 56, 153, 30, 9, 31, 32, 36, 0, + 33, 34, 68, 62, 135, 37, 141, 0, 140, 35, + 0, 153, 0, 137, 138, 136, 0, 40, 41, 43, + 39, 0, 0, 153, 0, 44, 0, 139, 38, 125, + 42, 0, 142, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 45, 153, 0, 144, 148, 145, 143, 152, + 0, 150, 146, 147, 0, 151, 0, 149, 0, 0, + 0 }; static const short yydefgoto[] = { - 213, 3, 22, 84, 23, 124, 34, 35, 24, 91, - 111, 112, 25, 106, 125, 137, 151, 152, 166, 171, - 172, 173, 186, 57, 81, 58, 174, 60, 100, 93, - 61, 97, 94, 13, 14, 103, 68, 28, 30, 29, - 69, 70, 71, 62, 183, 155, 165, 169, 170, 162, - 156, 198, 199, 207, 209, 208, 72 + 218, 3, 22, 85, 23, 129, 34, 35, 24, 92, + 116, 117, 25, 111, 130, 142, 156, 157, 171, 176, + 177, 178, 191, 58, 82, 59, 179, 61, 104, 95, + 62, 100, 96, 97, 13, 14, 107, 108, 69, 28, + 30, 29, 70, 71, 72, 63, 188, 160, 170, 174, + 175, 167, 161, 203, 204, 212, 214, 213, 73 }; static const short yypact[] = { - 36,-32768, 19, 142,-32768,-32768,-32768, -21,-32768, -1, - -32768,-32768,-32768, 41, 46,-32768,-32768,-32768, 13, 13, - 227,-32768,-32768, 32,-32768,-32768, 29, 29, 11, 11, - 11, 29, 29,-32768, 25, 1, 20,-32768,-32768,-32768, + 57,-32768, 17, 42,-32768,-32768,-32768, -15,-32768, -9, + -32768,-32768,-32768, 15, 22,-32768,-32768,-32768, 76, 76, + 267,-32768,-32768, 83,-32768,-32768, 47, 47, 9, 9, + 9, 47, 47,-32768, 59, 26, 60,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 4, -10,-32768,-32768,-32768,-32768,-32768,-32768, 52, - -32768, 59,-32768, 43, 55,-32768,-32768, 107,-32768, 13, - 29, 108, 29, 50, 64,-32768, 19,-32768,-32768,-32768, - -32768, 21, 25, -11, 65,-32768,-32768, -30, 70,-32768, - 23,-32768,-32768, 30,-32768, 117, 79,-32768,-32768,-32768, - 25,-32768, 97, 29,-32768, 29, 29, 29, 50, 50, - 109, 50,-32768,-32768,-32768, 104,-32768, 13, 100,-32768, - -32768, 0, 24, 33, 29,-32768, 117, 113,-32768, 25, - 29,-32768,-32768, 50,-32768,-32768,-32768, 35, 152,-32768, - -32768,-32768,-32768,-32768, 116,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 110,-32768,-32768, 155, 227, 227,-32768,-32768, - 114, 112, 118,-32768, 115,-32768, 119, 155,-32768, 227, - -32768, 122,-32768, 67,-32768,-32768, 19,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 194, - -32768,-32768,-32768,-32768,-32768, 126,-32768,-32768,-32768, 19, - -32768, 120,-32768, 165, 175,-32768 + -32768,-32768, 0, 8,-32768,-32768,-32768,-32768,-32768,-32768, + 61,-32768, 62,-32768, 56, 53,-32768,-32768, 108,-32768, + 76, 72, 110, 47, 90, 65,-32768, 17,-32768,-32768, + -32768,-32768, 28, 59,-32768, -35, 63,-32768,-32768,-32768, + -10, 67,-32768,-32768, 44,-32768,-32768,-32768, 24,-32768, + 112, 75,-32768,-32768,-32768, 59,-32768, 73, 72,-32768, + 72, 47, 72, 90, 90, 77, 90,-32768,-32768,-32768, + 79,-32768, 76, 70,-32768,-32768, -21, 45, 30, 47, + -32768, 112, 233,-32768, 59, 72,-32768,-32768, 90,-32768, + -32768,-32768, 50, 121,-32768,-32768,-32768,-32768,-32768, 84, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 88,-32768,-32768, + 122, 267, 267,-32768,-32768, 91, 89, 93,-32768, 92, + -32768, 94, 122,-32768, 267,-32768, 99,-32768, 98,-32768, + -32768, 17,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768, 199,-32768,-32768,-32768,-32768,-32768, + 101,-32768,-32768,-32768, 17,-32768, 97,-32768, 152, 154, + -32768 }; static const short yypgoto[] = { - -32768,-32768,-32768,-32768,-32768, 40, -71, 158,-32768,-32768, + -32768,-32768,-32768,-32768,-32768, 16, -61, 137,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 3,-32768, -135,-32768, -131, -19,-32768, 60, 62, - -32768,-32768, -22, -76, -72, -20, -2,-32768,-32768,-32768, - 66, 121,-32768,-32768,-32768,-32768,-32768, 6,-32768,-32768, - -18,-32768,-32768,-32768,-32768,-32768, 2 + -32768, -26,-32768, -135,-32768, -131, -19,-32768, 36, 38, + -32768,-32768, -39, -22, -82, -78, -91, -34, -2,-32768, + -32768,-32768, 78, 95,-32768,-32768,-32768,-32768,-32768, -20, + -32768,-32768, -43,-32768,-32768,-32768,-32768,-32768, 2 }; -#define YYLAST 261 +#define YYLAST 302 static const short yytable[] = { - 15, 59, 153, 4, 65, 66, 154, 101, 92, 75, - 76, 102, -46, 78, 5, 6, 7, 8, 9, 116, - 110, 33, 5, 6, 7, 8, 9, 101, 117, 33, - 26, 102, 64, 5, 6, 99, 5, 6, 99, 82, - 63, 113, 101, 101, 83, 101, 102, 102, 114, 102, - 27, 79, 113, 5, 6, 99, 139, 101, 10, 141, - 98, 102, 80, 67, 204, 11, 10, 101, 205, 12, - 79, 102, 109, 11, 77, 119, 119, 12, 120, 142, - 1, 2, 95, 122, 108, 104, 107, 121, 159, 160, - 143, 128, 31, 129, 130, 73, 74, 32, 88, 133, - 85, 135, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 86, 145, 144, 89, 90, 96, 105, 157, 95, - 104, 147, 115, 158, 118, 123, 126, 148, 138, 38, + 15, 60, 105, 4, 66, 67, 106, 158, -46, 76, + 77, 159, 5, 6, 7, 8, 9, 127, 118, 93, + 5, 6, 7, 8, 9, 119, 105, 5, 6, 102, + 106, 115, 118, 5, 6, 102, 33, 26, 79, 146, + 121, 105, 105, 27, 105, 106, 106, 149, 106, 122, + 65, 16, 17, 18, 19, 20, 105, 10, 83, 81, + 106, 101, 68, 84, 11, 10, 105, 31, 12, 209, + 106, 144, 11, 210, 32, 65, 12, 80, 94, 133, + 114, 134, 126, 98, 33, 113, 109, 112, 148, 21, + 138, 64, 140, 5, 6, 102, 103, 124, 124, 135, + 125, 147, 1, 2, 164, 165, 162, 74, 75, 78, + 86, 80, 89, 90, 163, 87, 91, 150, 99, 110, + 128, 120, 123, 131, 98, 109, 132, 139, 145, 166, + 173, 169, 141, 143, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 172, 182, 183, 184, 192, 215, 185, + 186, 217, 219, 181, 220, 168, 36, 151, 190, 137, + 136, 211, 187, 0, 0, 0, 0, 88, 0, 0, + 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 189, 0, 0, 0, 202, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 205, 0, 37, 0, 0, + 0, 0, 216, 153, 206, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 0, 0, 0, 0, 0, + 0, 152, 0, 0, 0, 0, 207, 153, 208, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 176, 127, - 163, 16, 17, 18, 19, 20, 136, 140, 134, 149, - 161, 150, 164, 168, 167, 214, 177, 178, 175, 187, - 179, 180, 210, 212, 181, 215, 146, 36, 132, 131, - 184, 206, 185, 182, 197, 0, 0, 0, 21, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 37, 0, 0, 0, 0, 211, 148, 201, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 0, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, - 202, 0, 203, 38, 39, 40, 41, 42, 43, 44, + 154, 0, 155, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56 + 55, 56, 57 }; static const short yycheck[] = { - 2, 20, 137, 1, 26, 27, 137, 83, 79, 31, - 32, 83, 8, 12, 3, 4, 5, 6, 7, 49, - 91, 8, 3, 4, 5, 6, 7, 103, 58, 8, - 51, 103, 3, 3, 4, 5, 3, 4, 5, 49, - 8, 52, 118, 119, 54, 121, 118, 119, 59, 121, - 51, 50, 52, 3, 4, 5, 127, 133, 47, 59, - 82, 133, 58, 52, 199, 54, 47, 143, 199, 58, - 50, 143, 51, 54, 49, 52, 52, 58, 55, 55, - 44, 45, 80, 103, 86, 83, 84, 57, 53, 54, - 57, 113, 51, 115, 116, 29, 30, 51, 55, 119, - 48, 121, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 52, 134, 133, 59, 8, 8, 53, 140, 117, - 118, 8, 57, 143, 54, 8, 47, 14, 126, 16, + 2, 20, 84, 1, 26, 27, 84, 142, 8, 31, + 32, 142, 3, 4, 5, 6, 7, 108, 53, 80, + 3, 4, 5, 6, 7, 60, 108, 3, 4, 5, + 108, 92, 53, 3, 4, 5, 8, 52, 12, 60, + 50, 123, 124, 52, 126, 123, 124, 138, 126, 59, + 3, 9, 10, 11, 12, 13, 138, 48, 50, 59, + 138, 83, 53, 55, 55, 48, 148, 52, 59, 204, + 148, 132, 55, 204, 52, 3, 59, 51, 6, 118, + 52, 120, 58, 81, 8, 87, 84, 85, 58, 47, + 124, 8, 126, 3, 4, 5, 6, 53, 53, 121, + 56, 56, 45, 46, 54, 55, 145, 29, 30, 50, + 49, 51, 56, 60, 148, 53, 8, 139, 8, 54, + 8, 58, 55, 48, 122, 123, 53, 50, 58, 8, + 8, 47, 53, 131, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 55, 53, 56, 53, 48, 47, 57, + 56, 54, 0, 172, 0, 153, 19, 141, 184, 123, + 122, 204, 182, -1, -1, -1, -1, 72, -1, -1, + -1, -1, -1, 171, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 183, -1, -1, -1, 191, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 203, -1, 8, -1, -1, + -1, -1, 214, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, + -1, 8, -1, -1, -1, -1, 47, 14, 49, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 167, 52, - 148, 9, 10, 11, 12, 13, 52, 57, 49, 46, - 8, 48, 46, 8, 54, 0, 52, 55, 166, 47, - 52, 56, 46, 53, 55, 0, 136, 19, 118, 117, - 178, 199, 179, 177, 186, -1, -1, -1, 46, -1, - -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, - 198, -1, 8, -1, -1, -1, -1, 209, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, + 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, - 46, -1, 48, 16, 17, 18, 19, 20, 21, 22, + 47, -1, 49, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34 + 33, 34, 35 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" @@ -1172,7 +1190,7 @@ yyreduce: switch (yyn) { case 8: -#line 156 "dcParser.yxx" +#line 159 "dcParser.yxx" { current_class = new DCClass(yyvsp[0].str, yyvsp[-1].u.flag, false); if (!dc_file->add_class(current_class)) { @@ -1186,19 +1204,19 @@ case 8: } break; case 10: -#line 172 "dcParser.yxx" +#line 175 "dcParser.yxx" { yyval.u.flag = true; } break; case 11: -#line 176 "dcParser.yxx" +#line 179 "dcParser.yxx" { yyval.u.flag = false; } break; case 12: -#line 183 "dcParser.yxx" +#line 186 "dcParser.yxx" { DCClass *dclass = dc_file->get_class_by_name(yyvsp[0].str); if (dclass == (DCClass *)NULL) { @@ -1210,49 +1228,49 @@ case 12: } break; case 14: -#line 197 "dcParser.yxx" +#line 200 "dcParser.yxx" { yyval.str = yyvsp[-2].str + string("/") + yyvsp[0].str; } break; case 16: -#line 205 "dcParser.yxx" +#line 208 "dcParser.yxx" { yyval.str = yyvsp[-2].str + string(".") + yyvsp[0].str; } break; case 17: -#line 212 "dcParser.yxx" +#line 215 "dcParser.yxx" { dc_file->add_import_module(yyvsp[0].str); } break; case 18: -#line 216 "dcParser.yxx" +#line 219 "dcParser.yxx" { dc_file->add_import_module(yyvsp[-1].str); } break; case 21: -#line 225 "dcParser.yxx" +#line 228 "dcParser.yxx" { dc_file->add_import_symbol("*"); } break; case 22: -#line 232 "dcParser.yxx" +#line 235 "dcParser.yxx" { dc_file->add_import_symbol(yyvsp[0].str); } break; case 23: -#line 236 "dcParser.yxx" +#line 239 "dcParser.yxx" { dc_file->add_import_symbol(yyvsp[0].str); } break; case 24: -#line 243 "dcParser.yxx" +#line 246 "dcParser.yxx" { DCTypedef *dtypedef = new DCTypedef(yyvsp[0].u.parameter); @@ -1267,7 +1285,7 @@ case 24: } break; case 27: -#line 264 "dcParser.yxx" +#line 267 "dcParser.yxx" { if (yyvsp[0].u.dclass != (DCClass *)NULL) { current_class->add_parent(yyvsp[0].u.dclass); @@ -1275,7 +1293,7 @@ case 27: } break; case 28: -#line 270 "dcParser.yxx" +#line 273 "dcParser.yxx" { if (yyvsp[0].u.dclass != (DCClass *)NULL) { current_class->add_parent(yyvsp[0].u.dclass); @@ -1283,7 +1301,7 @@ case 28: } break; case 31: -#line 281 "dcParser.yxx" +#line 284 "dcParser.yxx" { if (!current_class->add_field(yyvsp[0].u.field)) { yyerror("Duplicate field name: " + yyvsp[0].u.field->get_name()); @@ -1291,45 +1309,45 @@ case 31: } break; case 35: -#line 293 "dcParser.yxx" +#line 296 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; case 36: -#line 297 "dcParser.yxx" +#line 300 "dcParser.yxx" { yyval.u.field = yyvsp[0].u.parameter; } break; case 37: -#line 304 "dcParser.yxx" +#line 307 "dcParser.yxx" { current_atomic = new DCAtomicField(yyvsp[-1].str); } break; case 38: -#line 308 "dcParser.yxx" +#line 311 "dcParser.yxx" { yyval.u.field = current_atomic; } break; case 43: -#line 325 "dcParser.yxx" +#line 328 "dcParser.yxx" { atomic_element = DCAtomicField::ElementType(yyvsp[0].u.parameter); current_atomic->add_element(atomic_element); } break; case 44: -#line 330 "dcParser.yxx" +#line 333 "dcParser.yxx" { current_packer = &default_packer; current_packer->begin_pack(yyvsp[-1].u.parameter); } break; case 45: -#line 335 "dcParser.yxx" +#line 338 "dcParser.yxx" { bool is_valid = yyvsp[-3].u.parameter->is_valid(); atomic_element = DCAtomicField::ElementType(yyvsp[-3].u.parameter); @@ -1348,25 +1366,25 @@ case 45: } break; case 46: -#line 355 "dcParser.yxx" +#line 358 "dcParser.yxx" { current_parameter = yyvsp[0].u.parameter; } break; case 47: -#line 359 "dcParser.yxx" +#line 362 "dcParser.yxx" { yyval.u.parameter = yyvsp[0].u.parameter; } break; case 51: -#line 375 "dcParser.yxx" +#line 378 "dcParser.yxx" { yyval.u.parameter = new DCSimpleParameter(yyvsp[0].u.subatomic); } break; case 52: -#line 379 "dcParser.yxx" +#line 382 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-3].u.subatomic); if (!simple_param->set_range(double_range)) { @@ -1376,7 +1394,7 @@ case 52: } break; case 53: -#line 387 "dcParser.yxx" +#line 390 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-2].u.subatomic); if (yyvsp[0].u.s_uint == 0) { @@ -1389,7 +1407,7 @@ case 53: } break; case 54: -#line 398 "dcParser.yxx" +#line 401 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-5].u.subatomic); if (yyvsp[-3].u.s_uint == 0) { @@ -1405,7 +1423,7 @@ case 54: } break; case 55: -#line 412 "dcParser.yxx" +#line 415 "dcParser.yxx" { DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-5].u.subatomic); if (yyvsp[0].u.s_uint == 0) { @@ -1421,7 +1439,7 @@ case 55: } break; case 56: -#line 426 "dcParser.yxx" +#line 429 "dcParser.yxx" { DCTypedef *dtypedef = dc_file->get_typedef_by_name(yyvsp[0].str); if (dtypedef == (DCTypedef *)NULL) { @@ -1442,13 +1460,13 @@ case 56: } break; case 57: -#line 448 "dcParser.yxx" +#line 451 "dcParser.yxx" { double_range.clear(); } break; case 58: -#line 452 "dcParser.yxx" +#line 455 "dcParser.yxx" { double_range.clear(); if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { @@ -1457,7 +1475,7 @@ case 58: } break; case 59: -#line 459 "dcParser.yxx" +#line 462 "dcParser.yxx" { double_range.clear(); if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { @@ -1466,7 +1484,7 @@ case 59: } break; case 60: -#line 466 "dcParser.yxx" +#line 469 "dcParser.yxx" { double_range.clear(); if (yyvsp[0].u.real >= 0) { @@ -1477,7 +1495,7 @@ case 60: } break; case 61: -#line 475 "dcParser.yxx" +#line 478 "dcParser.yxx" { if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); @@ -1485,7 +1503,7 @@ case 61: } break; case 62: -#line 481 "dcParser.yxx" +#line 484 "dcParser.yxx" { if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); @@ -1493,7 +1511,7 @@ case 62: } break; case 63: -#line 487 "dcParser.yxx" +#line 490 "dcParser.yxx" { if (yyvsp[0].u.real >= 0) { yyerror("Syntax error"); @@ -1503,13 +1521,13 @@ case 63: } break; case 64: -#line 498 "dcParser.yxx" +#line 501 "dcParser.yxx" { uint_range.clear(); } break; case 65: -#line 502 "dcParser.yxx" +#line 505 "dcParser.yxx" { uint_range.clear(); if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { @@ -1518,7 +1536,7 @@ case 65: } break; case 66: -#line 509 "dcParser.yxx" +#line 512 "dcParser.yxx" { uint_range.clear(); if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { @@ -1527,7 +1545,7 @@ case 66: } break; case 67: -#line 516 "dcParser.yxx" +#line 519 "dcParser.yxx" { if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); @@ -1535,7 +1553,7 @@ case 67: } break; case 68: -#line 522 "dcParser.yxx" +#line 525 "dcParser.yxx" { if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); @@ -1543,20 +1561,20 @@ case 68: } break; case 70: -#line 532 "dcParser.yxx" +#line 535 "dcParser.yxx" { yyval.u.parameter = new DCArrayParameter(yyvsp[-3].u.parameter, uint_range); } break; case 71: -#line 539 "dcParser.yxx" +#line 542 "dcParser.yxx" { current_parameter->set_name(yyvsp[0].str); yyval.u.parameter = current_parameter; } break; case 72: -#line 544 "dcParser.yxx" +#line 547 "dcParser.yxx" { if (yyvsp[0].u.s_uint == 0) { yyerror("Invalid divisor."); @@ -1572,13 +1590,24 @@ case 72: } break; case 73: -#line 558 "dcParser.yxx" +#line 561 "dcParser.yxx" { yyval.u.parameter = new DCArrayParameter(yyvsp[-3].u.parameter, uint_range); } break; case 74: -#line 565 "dcParser.yxx" +#line 568 "dcParser.yxx" +{ + if (yyvsp[0].str.length() != 1) { + yyerror("Single character required."); + yyval.u.s_uint = 0; + } else { + yyval.u.s_uint = (unsigned char)yyvsp[0].str[0]; + } +} + break; +case 76: +#line 581 "dcParser.yxx" { yyval.u.s_uint = (unsigned int)yyvsp[0].u.uint64; if (yyval.u.s_uint != yyvsp[0].u.uint64) { @@ -1587,298 +1616,315 @@ case 74: } } break; -case 77: -#line 584 "dcParser.yxx" +case 79: +#line 600 "dcParser.yxx" { yyval.u.real = (double)yyvsp[0].u.uint64; } break; -case 78: -#line 588 "dcParser.yxx" +case 80: +#line 604 "dcParser.yxx" { yyval.u.real = (double)yyvsp[0].u.int64; } break; -case 80: -#line 596 "dcParser.yxx" +case 82: +#line 612 "dcParser.yxx" +{ + if (yyvsp[0].str.length() != 1) { + yyerror("Single character required."); + yyval.u.real = 0; + } else { + yyval.u.real = (double)(unsigned char)yyvsp[0].str[0]; + } +} + break; +case 84: +#line 626 "dcParser.yxx" { current_packer->pack_int64(yyvsp[0].u.int64); } break; -case 81: -#line 600 "dcParser.yxx" +case 85: +#line 630 "dcParser.yxx" { current_packer->pack_uint64(yyvsp[0].u.uint64); } break; -case 82: -#line 604 "dcParser.yxx" +case 86: +#line 634 "dcParser.yxx" { current_packer->pack_double(yyvsp[0].u.real); } break; -case 83: -#line 608 "dcParser.yxx" +case 87: +#line 638 "dcParser.yxx" { current_packer->pack_string(yyvsp[0].str); } break; -case 84: -#line 612 "dcParser.yxx" +case 88: +#line 642 "dcParser.yxx" { current_packer->pack_literal_value(yyvsp[0].str); } break; -case 85: -#line 616 "dcParser.yxx" -{ - current_packer->push(); -} - break; -case 86: -#line 620 "dcParser.yxx" -{ - current_packer->pop(); -} - break; -case 87: -#line 624 "dcParser.yxx" -{ - current_packer->push(); -} - break; -case 88: -#line 628 "dcParser.yxx" -{ - current_packer->pop(); -} - break; case 89: -#line 632 "dcParser.yxx" +#line 646 "dcParser.yxx" { current_packer->push(); } break; case 90: -#line 636 "dcParser.yxx" +#line 650 "dcParser.yxx" { current_packer->pop(); } break; case 91: -#line 640 "dcParser.yxx" +#line 654 "dcParser.yxx" +{ + current_packer->push(); +} + break; +case 92: +#line 658 "dcParser.yxx" +{ + current_packer->pop(); +} + break; +case 93: +#line 662 "dcParser.yxx" +{ + current_packer->push(); +} + break; +case 94: +#line 666 "dcParser.yxx" +{ + current_packer->pop(); +} + break; +case 95: +#line 670 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_int64(yyvsp[-2].u.int64); } } break; -case 92: -#line 646 "dcParser.yxx" +case 96: +#line 676 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_uint64(yyvsp[-2].u.uint64); } } break; -case 93: -#line 652 "dcParser.yxx" +case 97: +#line 682 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_double(yyvsp[-2].u.real); } } break; -case 94: -#line 658 "dcParser.yxx" +case 98: +#line 688 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_literal_value(yyvsp[-2].str); } } break; -case 101: -#line 682 "dcParser.yxx" +case 105: +#line 712 "dcParser.yxx" { yyval.u.subatomic = ST_int8; } break; -case 102: -#line 686 "dcParser.yxx" +case 106: +#line 716 "dcParser.yxx" { yyval.u.subatomic = ST_int16; } break; -case 103: -#line 690 "dcParser.yxx" +case 107: +#line 720 "dcParser.yxx" { yyval.u.subatomic = ST_int32; } break; -case 104: -#line 694 "dcParser.yxx" +case 108: +#line 724 "dcParser.yxx" { yyval.u.subatomic = ST_int64; } break; -case 105: -#line 698 "dcParser.yxx" +case 109: +#line 728 "dcParser.yxx" { yyval.u.subatomic = ST_uint8; } break; -case 106: -#line 702 "dcParser.yxx" +case 110: +#line 732 "dcParser.yxx" { yyval.u.subatomic = ST_uint16; } break; -case 107: -#line 706 "dcParser.yxx" +case 111: +#line 736 "dcParser.yxx" { yyval.u.subatomic = ST_uint32; } break; -case 108: -#line 710 "dcParser.yxx" +case 112: +#line 740 "dcParser.yxx" { yyval.u.subatomic = ST_uint64; } break; -case 109: -#line 714 "dcParser.yxx" +case 113: +#line 744 "dcParser.yxx" { yyval.u.subatomic = ST_float64; } break; -case 110: -#line 718 "dcParser.yxx" +case 114: +#line 748 "dcParser.yxx" { yyval.u.subatomic = ST_string; } break; -case 111: -#line 722 "dcParser.yxx" +case 115: +#line 752 "dcParser.yxx" { yyval.u.subatomic = ST_blob; } break; -case 112: -#line 726 "dcParser.yxx" +case 116: +#line 756 "dcParser.yxx" { yyval.u.subatomic = ST_blob32; } break; -case 113: -#line 730 "dcParser.yxx" +case 117: +#line 760 "dcParser.yxx" { yyval.u.subatomic = ST_int8array; } break; -case 114: -#line 734 "dcParser.yxx" +case 118: +#line 764 "dcParser.yxx" { yyval.u.subatomic = ST_int16array; } break; -case 115: -#line 738 "dcParser.yxx" +case 119: +#line 768 "dcParser.yxx" { yyval.u.subatomic = ST_int32array; } break; -case 116: -#line 742 "dcParser.yxx" +case 120: +#line 772 "dcParser.yxx" { yyval.u.subatomic = ST_uint8array; } break; -case 117: -#line 746 "dcParser.yxx" +case 121: +#line 776 "dcParser.yxx" { yyval.u.subatomic = ST_uint16array; } break; -case 118: -#line 750 "dcParser.yxx" +case 122: +#line 780 "dcParser.yxx" { yyval.u.subatomic = ST_uint32array; } break; -case 119: -#line 754 "dcParser.yxx" +case 123: +#line 784 "dcParser.yxx" { yyval.u.subatomic = ST_uint32uint8array; } break; -case 121: -#line 762 "dcParser.yxx" +case 124: +#line 788 "dcParser.yxx" +{ + yyval.u.subatomic = ST_char; +} + break; +case 126: +#line 796 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_required); } break; -case 122: -#line 766 "dcParser.yxx" +case 127: +#line 800 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_broadcast); } break; -case 123: -#line 770 "dcParser.yxx" +case 128: +#line 804 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_p2p); } break; -case 124: -#line 774 "dcParser.yxx" +case 129: +#line 808 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_ram); } break; -case 125: -#line 778 "dcParser.yxx" +case 130: +#line 812 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_db); } break; -case 126: -#line 782 "dcParser.yxx" +case 131: +#line 816 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_clsend); } break; -case 127: -#line 786 "dcParser.yxx" +case 132: +#line 820 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_clrecv); } break; -case 128: -#line 790 "dcParser.yxx" +case 133: +#line 824 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_ownsend); } break; -case 129: -#line 794 "dcParser.yxx" +case 134: +#line 828 "dcParser.yxx" { current_atomic->add_flag(DCAtomicField::F_airecv); } break; -case 130: -#line 801 "dcParser.yxx" +case 135: +#line 835 "dcParser.yxx" { current_molecular = new DCMolecularField(yyvsp[-1].str); } break; -case 131: -#line 805 "dcParser.yxx" +case 136: +#line 839 "dcParser.yxx" { yyval.u.field = current_molecular; } break; -case 132: -#line 812 "dcParser.yxx" +case 137: +#line 846 "dcParser.yxx" { DCField *field = current_class->get_field_by_name(yyvsp[0].str); yyval.u.atomic = (DCAtomicField *)NULL; @@ -1892,16 +1938,16 @@ case 132: } } break; -case 133: -#line 828 "dcParser.yxx" +case 138: +#line 862 "dcParser.yxx" { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { current_molecular->add_atomic(yyvsp[0].u.atomic); } } break; -case 134: -#line 834 "dcParser.yxx" +case 139: +#line 868 "dcParser.yxx" { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { current_molecular->add_atomic(yyvsp[0].u.atomic); @@ -1913,28 +1959,28 @@ case 134: } } break; -case 135: -#line 848 "dcParser.yxx" +case 140: +#line 882 "dcParser.yxx" { yyval.str = ""; } break; -case 137: -#line 856 "dcParser.yxx" +case 142: +#line 890 "dcParser.yxx" { yyval.u.field = current_switch; current_switch = new DCSwitch(yyvsp[-4].str, yyvsp[-2].u.parameter); } break; -case 138: -#line 861 "dcParser.yxx" +case 143: +#line 895 "dcParser.yxx" { yyval.u.field = current_switch; current_switch = (DCSwitch *)yyvsp[-2].u.parameter; } break; -case 142: -#line 873 "dcParser.yxx" +case 147: +#line 907 "dcParser.yxx" { if (current_switch->get_num_cases() == 0) { yyerror("case declaration required before first element"); @@ -1943,15 +1989,15 @@ case 142: } } break; -case 143: -#line 884 "dcParser.yxx" +case 148: +#line 918 "dcParser.yxx" { current_packer = &default_packer; current_packer->begin_pack(current_switch->get_switch_parameter()); } break; -case 144: -#line 889 "dcParser.yxx" +case 149: +#line 923 "dcParser.yxx" { if (!current_packer->end_pack()) { yyerror("Invalid value for switch parameter"); @@ -1960,14 +2006,14 @@ case 144: } } break; -case 146: -#line 901 "dcParser.yxx" +case 151: +#line 935 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; -case 147: -#line 905 "dcParser.yxx" +case 152: +#line 939 "dcParser.yxx" { yyval.u.field = yyvsp[0].u.parameter; } @@ -2205,4 +2251,4 @@ yyreturn: #endif return yyresult; } -#line 913 "dcParser.yxx" +#line 947 "dcParser.yxx" diff --git a/direct/src/dcparser/dcParser.h.prebuilt b/direct/src/dcparser/dcParser.h.prebuilt index 518511fecb..929bca6b35 100644 --- a/direct/src/dcparser/dcParser.h.prebuilt +++ b/direct/src/dcparser/dcParser.h.prebuilt @@ -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; diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index 2f40b02727..f567e6fff0 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -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 import_identifier %type slash_identifier %type optional_name +%type char_or_uint %type small_unsigned_integer %type signed_integer %type unsigned_integer +%type char_or_number %type 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; } ; diff --git a/direct/src/dcparser/dcSimpleParameter.cxx b/direct/src/dcparser/dcSimpleParameter.cxx index 3f0a4fdea8..b2a391c2b1 100644 --- a/direct/src/dcparser/dcSimpleParameter.cxx +++ b/direct/src/dcparser/dcSimpleParameter.cxx @@ -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()) { diff --git a/direct/src/dcparser/dcSubatomicType.cxx b/direct/src/dcparser/dcSubatomicType.cxx index d36e984d68..4c7a63f8f2 100644 --- a/direct/src/dcparser/dcSubatomicType.cxx +++ b/direct/src/dcparser/dcSubatomicType.cxx @@ -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"; } diff --git a/direct/src/dcparser/dcSubatomicType.h b/direct/src/dcparser/dcSubatomicType.h index 37b6c31c93..e40fb2c0fa 100644 --- a/direct/src/dcparser/dcSubatomicType.h +++ b/direct/src/dcparser/dcSubatomicType.h @@ -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.