| 1 |  | 
|---|
| 2 | /*  A Bison parser, made from ppy.y | 
|---|
| 3 | by  GNU Bison version 1.25 | 
|---|
| 4 | */ | 
|---|
| 5 |  | 
|---|
| 6 | #define YYBISON 1  /* Identify Bison output.  */ | 
|---|
| 7 |  | 
|---|
| 8 | #define yyparse ppparse | 
|---|
| 9 | #define yylex pplex | 
|---|
| 10 | #define yyerror pperror | 
|---|
| 11 | #define yylval pplval | 
|---|
| 12 | #define yychar ppchar | 
|---|
| 13 | #define yydebug ppdebug | 
|---|
| 14 | #define yynerrs ppnerrs | 
|---|
| 15 | #define tIF     258 | 
|---|
| 16 | #define tIFDEF  259 | 
|---|
| 17 | #define tIFNDEF 260 | 
|---|
| 18 | #define tELSE   261 | 
|---|
| 19 | #define tELIF   262 | 
|---|
| 20 | #define tENDIF  263 | 
|---|
| 21 | #define tDEFINED        264 | 
|---|
| 22 | #define tNL     265 | 
|---|
| 23 | #define tINCLUDE        266 | 
|---|
| 24 | #define tLINE   267 | 
|---|
| 25 | #define tGCCLINE        268 | 
|---|
| 26 | #define tERROR  269 | 
|---|
| 27 | #define tWARNING        270 | 
|---|
| 28 | #define tPRAGMA 271 | 
|---|
| 29 | #define tPPIDENT        272 | 
|---|
| 30 | #define tUNDEF  273 | 
|---|
| 31 | #define tMACROEND       274 | 
|---|
| 32 | #define tCONCAT 275 | 
|---|
| 33 | #define tELIPSIS        276 | 
|---|
| 34 | #define tSTRINGIZE      277 | 
|---|
| 35 | #define tIDENT  278 | 
|---|
| 36 | #define tLITERAL        279 | 
|---|
| 37 | #define tMACRO  280 | 
|---|
| 38 | #define tDEFINE 281 | 
|---|
| 39 | #define tDQSTRING       282 | 
|---|
| 40 | #define tSQSTRING       283 | 
|---|
| 41 | #define tIQSTRING       284 | 
|---|
| 42 | #define tUINT   285 | 
|---|
| 43 | #define tSINT   286 | 
|---|
| 44 | #define tULONG  287 | 
|---|
| 45 | #define tSLONG  288 | 
|---|
| 46 | #define tULONGLONG      289 | 
|---|
| 47 | #define tSLONGLONG      290 | 
|---|
| 48 | #define tLOGOR  291 | 
|---|
| 49 | #define tLOGAND 292 | 
|---|
| 50 | #define tEQ     293 | 
|---|
| 51 | #define tNE     294 | 
|---|
| 52 | #define tLTE    295 | 
|---|
| 53 | #define tGTE    296 | 
|---|
| 54 | #define tLSHIFT 297 | 
|---|
| 55 | #define tRSHIFT 298 | 
|---|
| 56 |  | 
|---|
| 57 | #line 14 "ppy.y" | 
|---|
| 58 |  | 
|---|
| 59 | #include "config.h" | 
|---|
| 60 |  | 
|---|
| 61 | #include <stdio.h> | 
|---|
| 62 | #include <stdlib.h> | 
|---|
| 63 | #include <stdarg.h> | 
|---|
| 64 | #include <assert.h> | 
|---|
| 65 | #include <ctype.h> | 
|---|
| 66 | #include <string.h> | 
|---|
| 67 |  | 
|---|
| 68 | #include "utils.h" | 
|---|
| 69 | #include "newstruc.h" | 
|---|
| 70 | #include "wrc.h" | 
|---|
| 71 | #include "preproc.h" | 
|---|
| 72 |  | 
|---|
| 73 |  | 
|---|
| 74 | #define UNARY_OP(r, v, OP)                                      \ | 
|---|
| 75 | switch(v.type)                                          \ | 
|---|
| 76 | {                                                       \ | 
|---|
| 77 | case cv_sint:   r.val.si  = OP v.val.si; break;         \ | 
|---|
| 78 | case cv_uint:   r.val.ui  = OP v.val.ui; break;         \ | 
|---|
| 79 | case cv_slong:  r.val.sl  = OP v.val.sl; break;         \ | 
|---|
| 80 | case cv_ulong:  r.val.ul  = OP v.val.ul; break;         \ | 
|---|
| 81 | case cv_sll:    r.val.sll = OP v.val.sll; break;        \ | 
|---|
| 82 | case cv_ull:    r.val.ull = OP v.val.ull; break;        \ | 
|---|
| 83 | } | 
|---|
| 84 |  | 
|---|
| 85 | #define cv_signed(v)    ((v.type & FLAG_SIGNED) != 0) | 
|---|
| 86 |  | 
|---|
| 87 | #define BIN_OP_INT(r, v1, v2, OP)                       \ | 
|---|
| 88 | r.type = v1.type;                               \ | 
|---|
| 89 | if(cv_signed(v1) && cv_signed(v2))              \ | 
|---|
| 90 | r.val.si = v1.val.si OP v2.val.si;      \ | 
|---|
| 91 | else if(cv_signed(v1) && !cv_signed(v2))        \ | 
|---|
| 92 | r.val.si = v1.val.si OP v2.val.ui;      \ | 
|---|
| 93 | else if(!cv_signed(v1) && cv_signed(v2))        \ | 
|---|
| 94 | r.val.ui = v1.val.ui OP v2.val.si;      \ | 
|---|
| 95 | else                                            \ | 
|---|
| 96 | r.val.ui = v1.val.ui OP v2.val.ui; | 
|---|
| 97 |  | 
|---|
| 98 | #define BIN_OP_LONG(r, v1, v2, OP)                      \ | 
|---|
| 99 | r.type = v1.type;                               \ | 
|---|
| 100 | if(cv_signed(v1) && cv_signed(v2))              \ | 
|---|
| 101 | r.val.sl = v1.val.sl OP v2.val.sl;      \ | 
|---|
| 102 | else if(cv_signed(v1) && !cv_signed(v2))        \ | 
|---|
| 103 | r.val.sl = v1.val.sl OP v2.val.ul;      \ | 
|---|
| 104 | else if(!cv_signed(v1) && cv_signed(v2))        \ | 
|---|
| 105 | r.val.ul = v1.val.ul OP v2.val.sl;      \ | 
|---|
| 106 | else                                            \ | 
|---|
| 107 | r.val.ul = v1.val.ul OP v2.val.ul; | 
|---|
| 108 |  | 
|---|
| 109 | #define BIN_OP_LONGLONG(r, v1, v2, OP)                  \ | 
|---|
| 110 | r.type = v1.type;                               \ | 
|---|
| 111 | if(cv_signed(v1) && cv_signed(v2))              \ | 
|---|
| 112 | r.val.sll = v1.val.sll OP v2.val.sll;   \ | 
|---|
| 113 | else if(cv_signed(v1) && !cv_signed(v2))        \ | 
|---|
| 114 | r.val.sll = v1.val.sll OP v2.val.ull;   \ | 
|---|
| 115 | else if(!cv_signed(v1) && cv_signed(v2))        \ | 
|---|
| 116 | r.val.ull = v1.val.ull OP v2.val.sll;   \ | 
|---|
| 117 | else                                            \ | 
|---|
| 118 | r.val.ull = v1.val.ull OP v2.val.ull; | 
|---|
| 119 |  | 
|---|
| 120 | #define BIN_OP(r, v1, v2, OP)                                           \ | 
|---|
| 121 | switch(v1.type & SIZE_MASK)                                     \ | 
|---|
| 122 | {                                                               \ | 
|---|
| 123 | case SIZE_INT:          BIN_OP_INT(r, v1, v2, OP); break;       \ | 
|---|
| 124 | case SIZE_LONG:         BIN_OP_LONG(r, v1, v2, OP); break;      \ | 
|---|
| 125 | case SIZE_LONGLONG:     BIN_OP_LONGLONG(r, v1, v2, OP); break;  \ | 
|---|
| 126 | default: internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type);        \ | 
|---|
| 127 | } | 
|---|
| 128 |  | 
|---|
| 129 |  | 
|---|
| 130 | /* | 
|---|
| 131 | * Prototypes | 
|---|
| 132 | */ | 
|---|
| 133 | static int boolean(cval_t *v); | 
|---|
| 134 | static void promote_equal_size(cval_t *v1, cval_t *v2); | 
|---|
| 135 | static void cast_to_sint(cval_t *v); | 
|---|
| 136 | static void cast_to_uint(cval_t *v); | 
|---|
| 137 | static void cast_to_slong(cval_t *v); | 
|---|
| 138 | static void cast_to_ulong(cval_t *v); | 
|---|
| 139 | static void cast_to_sll(cval_t *v); | 
|---|
| 140 | static void cast_to_ull(cval_t *v); | 
|---|
| 141 | static marg_t *new_marg(char *str, def_arg_t type); | 
|---|
| 142 | static marg_t *add_new_marg(char *str, def_arg_t type); | 
|---|
| 143 | static int marg_index(char *id); | 
|---|
| 144 | static mtext_t *new_mtext(char *str, int idx, def_exp_t type); | 
|---|
| 145 | static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp); | 
|---|
| 146 | static char *merge_text(char *s1, char *s2); | 
|---|
| 147 |  | 
|---|
| 148 | /* | 
|---|
| 149 | * Local variables | 
|---|
| 150 | */ | 
|---|
| 151 | static marg_t **macro_args;     /* Macro parameters array while parsing */ | 
|---|
| 152 | static int      nmacro_args; | 
|---|
| 153 |  | 
|---|
| 154 |  | 
|---|
| 155 | #line 112 "ppy.y" | 
|---|
| 156 | typedef union{ | 
|---|
| 157 | int             sint; | 
|---|
| 158 | unsigned int    uint; | 
|---|
| 159 | long            slong; | 
|---|
| 160 | unsigned long   ulong; | 
|---|
| 161 | wrc_sll_t       sll; | 
|---|
| 162 | wrc_ull_t       ull; | 
|---|
| 163 | int             *iptr; | 
|---|
| 164 | char            *cptr; | 
|---|
| 165 | cval_t          cval; | 
|---|
| 166 | marg_t          *marg; | 
|---|
| 167 | mtext_t         *mtext; | 
|---|
| 168 | } YYSTYPE; | 
|---|
| 169 | #ifndef YYDEBUG | 
|---|
| 170 | #define YYDEBUG 1 | 
|---|
| 171 | #endif | 
|---|
| 172 |  | 
|---|
| 173 | #include <stdio.h> | 
|---|
| 174 |  | 
|---|
| 175 | #ifndef __cplusplus | 
|---|
| 176 | #ifndef __STDC__ | 
|---|
| 177 | #define const | 
|---|
| 178 | #endif | 
|---|
| 179 | #endif | 
|---|
| 180 |  | 
|---|
| 181 |  | 
|---|
| 182 |  | 
|---|
| 183 | #define YYFINAL         144 | 
|---|
| 184 | #define YYFLAG          -32768 | 
|---|
| 185 | #define YYNTBASE        60 | 
|---|
| 186 |  | 
|---|
| 187 | #define YYTRANSLATE(x) ((unsigned)(x) <= 298 ? yytranslate[x] : 73) | 
|---|
| 188 |  | 
|---|
| 189 | static const char yytranslate[] = {     0, | 
|---|
| 190 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 191 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 192 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 193 | 2,     2,    56,     2,     2,     2,     2,    42,     2,    58, | 
|---|
| 194 | 59,    53,    51,    57,    52,     2,    54,     2,     2,     2, | 
|---|
| 195 | 2,     2,     2,     2,     2,     2,     2,    37,     2,    45, | 
|---|
| 196 | 2,    47,    36,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 197 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 198 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 199 | 2,     2,     2,    41,     2,     2,     2,     2,     2,     2, | 
|---|
| 200 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 201 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 202 | 2,     2,     2,    40,     2,    55,     2,     2,     2,     2, | 
|---|
| 203 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 204 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 205 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 206 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 207 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 208 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 209 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 210 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 211 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 212 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 213 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 214 | 2,     2,     2,     2,     2,     2,     2,     2,     2,     2, | 
|---|
| 215 | 2,     2,     2,     2,     2,     1,     2,     3,     4,     5, | 
|---|
| 216 | 6,     7,     8,     9,    10,    11,    12,    13,    14,    15, | 
|---|
| 217 | 16,    17,    18,    19,    20,    21,    22,    23,    24,    25, | 
|---|
| 218 | 26,    27,    28,    29,    30,    31,    32,    33,    34,    35, | 
|---|
| 219 | 38,    39,    43,    44,    46,    48,    49,    50 | 
|---|
| 220 | }; | 
|---|
| 221 |  | 
|---|
| 222 | #if YYDEBUG != 0 | 
|---|
| 223 | static const short yyprhs[] = {     0, | 
|---|
| 224 | 0,     1,     4,     8,    12,    16,    20,    24,    28,    31, | 
|---|
| 225 | 34,    38,    42,    49,    54,    59,    62,    66,    70,    74, | 
|---|
| 226 | 78,    79,    81,    83,    85,    87,    90,    93,    96,    97, | 
|---|
| 227 | 99,   102,   103,   105,   107,   111,   115,   117,   118,   120, | 
|---|
| 228 | 122,   125,   127,   129,   131,   133,   136,   138,   140,   142, | 
|---|
| 229 | 144,   146,   148,   150,   153,   158,   160,   164,   168,   172, | 
|---|
| 230 | 176,   180,   184,   188,   192,   196,   200,   204,   208,   212, | 
|---|
| 231 | 216,   220,   224,   228,   231,   234,   237,   240,   244 | 
|---|
| 232 | }; | 
|---|
| 233 |  | 
|---|
| 234 | static const short yyrhs[] = {    -1, | 
|---|
| 235 | 60,    61,     0,    11,    27,    10,     0,    11,    29,    10, | 
|---|
| 236 | 0,     3,    72,    10,     0,     4,    23,    10,     0,     5, | 
|---|
| 237 | 23,    10,     0,     7,    72,    10,     0,     6,    10,     0, | 
|---|
| 238 | 8,    10,     0,    18,    23,    10,     0,    26,    62,    10, | 
|---|
| 239 | 0,    25,    64,    66,    19,    69,    10,     0,    12,    31, | 
|---|
| 240 | 27,    10,     0,    13,    27,    65,    10,     0,    13,    10, | 
|---|
| 241 | 0,    14,    62,    10,     0,    15,    62,    10,     0,    16, | 
|---|
| 242 | 62,    10,     0,    17,    62,    10,     0,     0,    63,     0, | 
|---|
| 243 | 24,     0,    27,     0,    28,     0,    63,    24,     0,    63, | 
|---|
| 244 | 27,     0,    63,    28,     0,     0,    31,     0,    65,    31, | 
|---|
| 245 | 0,     0,    67,     0,    68,     0,    68,    57,    21,     0, | 
|---|
| 246 | 68,    57,    23,     0,    23,     0,     0,    70,     0,    71, | 
|---|
| 247 | 0,    70,    71,     0,    24,     0,    27,     0,    28,     0, | 
|---|
| 248 | 20,     0,    22,    23,     0,    23,     0,    31,     0,    30, | 
|---|
| 249 | 0,    33,     0,    32,     0,    35,     0,    34,     0,     9, | 
|---|
| 250 | 23,     0,     9,    58,    23,    59,     0,    23,     0,    72, | 
|---|
| 251 | 38,    72,     0,    72,    39,    72,     0,    72,    43,    72, | 
|---|
| 252 | 0,    72,    44,    72,     0,    72,    45,    72,     0,    72, | 
|---|
| 253 | 47,    72,     0,    72,    46,    72,     0,    72,    48,    72, | 
|---|
| 254 | 0,    72,    51,    72,     0,    72,    52,    72,     0,    72, | 
|---|
| 255 | 41,    72,     0,    72,    42,    72,     0,    72,    40,    72, | 
|---|
| 256 | 0,    72,    53,    72,     0,    72,    54,    72,     0,    72, | 
|---|
| 257 | 49,    72,     0,    72,    50,    72,     0,    51,    72,     0, | 
|---|
| 258 | 52,    72,     0,    55,    72,     0,    56,    72,     0,    58, | 
|---|
| 259 | 72,    59,     0,    72,    36,    72,    37,    72,     0 | 
|---|
| 260 | }; | 
|---|
| 261 |  | 
|---|
| 262 | #endif | 
|---|
| 263 |  | 
|---|
| 264 | #if YYDEBUG != 0 | 
|---|
| 265 | static const short yyrline[] = { 0, | 
|---|
| 266 | 164,   165,   169,   170,   171,   172,   173,   192,   213,   236, | 
|---|
| 267 | 250,   251,   252,   255,   256,   257,   258,   259,   260,   261, | 
|---|
| 268 | 265,   266,   269,   270,   271,   272,   273,   274,   277,   280, | 
|---|
| 269 | 281,   284,   285,   288,   289,   292,   293,   297,   298,   304, | 
|---|
| 270 | 305,   308,   309,   310,   311,   312,   318,   327,   328,   329, | 
|---|
| 271 | 330,   331,   332,   333,   334,   335,   336,   337,   338,   339, | 
|---|
| 272 | 340,   341,   342,   343,   344,   345,   346,   347,   348,   349, | 
|---|
| 273 | 350,   351,   352,   353,   354,   355,   356,   357,   358 | 
|---|
| 274 | }; | 
|---|
| 275 | #endif | 
|---|
| 276 |  | 
|---|
| 277 |  | 
|---|
| 278 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | 
|---|
| 279 |  | 
|---|
| 280 | static const char * const yytname[] = {   "$","error","$undefined.","tIF","tIFDEF", | 
|---|
| 281 | "tIFNDEF","tELSE","tELIF","tENDIF","tDEFINED","tNL","tINCLUDE","tLINE","tGCCLINE", | 
|---|
| 282 | "tERROR","tWARNING","tPRAGMA","tPPIDENT","tUNDEF","tMACROEND","tCONCAT","tELIPSIS", | 
|---|
| 283 | "tSTRINGIZE","tIDENT","tLITERAL","tMACRO","tDEFINE","tDQSTRING","tSQSTRING", | 
|---|
| 284 | "tIQSTRING","tUINT","tSINT","tULONG","tSLONG","tULONGLONG","tSLONGLONG","'?'", | 
|---|
| 285 | "':'","tLOGOR","tLOGAND","'|'","'^'","'&'","tEQ","tNE","'<'","tLTE","'>'","tGTE", | 
|---|
| 286 | "tLSHIFT","tRSHIFT","'+'","'-'","'*'","'/'","'~'","'!'","','","'('","')'","pp_file", | 
|---|
| 287 | "preprocessor","opt_text","text","res_arg","nums","allmargs","emargs","margs", | 
|---|
| 288 | "opt_mtexts","mtexts","mtext","pp_expr", NULL | 
|---|
| 289 | }; | 
|---|
| 290 | #endif | 
|---|
| 291 |  | 
|---|
| 292 | static const short yyr1[] = {     0, | 
|---|
| 293 | 60,    60,    61,    61,    61,    61,    61,    61,    61,    61, | 
|---|
| 294 | 61,    61,    61,    61,    61,    61,    61,    61,    61,    61, | 
|---|
| 295 | 62,    62,    63,    63,    63,    63,    63,    63,    64,    65, | 
|---|
| 296 | 65,    66,    66,    67,    67,    68,    68,    69,    69,    70, | 
|---|
| 297 | 70,    71,    71,    71,    71,    71,    71,    72,    72,    72, | 
|---|
| 298 | 72,    72,    72,    72,    72,    72,    72,    72,    72,    72, | 
|---|
| 299 | 72,    72,    72,    72,    72,    72,    72,    72,    72,    72, | 
|---|
| 300 | 72,    72,    72,    72,    72,    72,    72,    72,    72 | 
|---|
| 301 | }; | 
|---|
| 302 |  | 
|---|
| 303 | static const short yyr2[] = {     0, | 
|---|
| 304 | 0,     2,     3,     3,     3,     3,     3,     3,     2,     2, | 
|---|
| 305 | 3,     3,     6,     4,     4,     2,     3,     3,     3,     3, | 
|---|
| 306 | 0,     1,     1,     1,     1,     2,     2,     2,     0,     1, | 
|---|
| 307 | 2,     0,     1,     1,     3,     3,     1,     0,     1,     1, | 
|---|
| 308 | 2,     1,     1,     1,     1,     2,     1,     1,     1,     1, | 
|---|
| 309 | 1,     1,     1,     2,     4,     1,     3,     3,     3,     3, | 
|---|
| 310 | 3,     3,     3,     3,     3,     3,     3,     3,     3,     3, | 
|---|
| 311 | 3,     3,     3,     2,     2,     2,     2,     3,     5 | 
|---|
| 312 | }; | 
|---|
| 313 |  | 
|---|
| 314 | static const short yydefact[] = {     1, | 
|---|
| 315 | 0,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|---|
| 316 | 21,    21,    21,    21,     0,    29,    21,     2,     0,    56, | 
|---|
| 317 | 49,    48,    51,    50,    53,    52,     0,     0,     0,     0, | 
|---|
| 318 | 0,     0,     0,     0,     9,     0,    10,     0,     0,     0, | 
|---|
| 319 | 16,     0,    23,    24,    25,     0,    22,     0,     0,     0, | 
|---|
| 320 | 0,    32,     0,    54,     0,    74,    75,    76,    77,     0, | 
|---|
| 321 | 5,     0,     0,     0,     0,     0,     0,     0,     0,     0, | 
|---|
| 322 | 0,     0,     0,     0,     0,     0,     0,     0,     0,     6, | 
|---|
| 323 | 7,     8,     3,     4,     0,    30,     0,    17,    26,    27, | 
|---|
| 324 | 28,    18,    19,    20,    11,    37,     0,    33,    34,    12, | 
|---|
| 325 | 0,    78,     0,    57,    58,    69,    67,    68,    59,    60, | 
|---|
| 326 | 61,    63,    62,    64,    72,    73,    65,    66,    70,    71, | 
|---|
| 327 | 14,    15,    31,    38,     0,    55,     0,    45,     0,    47, | 
|---|
| 328 | 42,    43,    44,     0,    39,    40,    35,    36,    79,    46, | 
|---|
| 329 | 13,    41,     0,     0 | 
|---|
| 330 | }; | 
|---|
| 331 |  | 
|---|
| 332 | static const short yydefgoto[] = {     1, | 
|---|
| 333 | 18,    46,    47,    52,    87,    97,    98,    99,   134,   135, | 
|---|
| 334 | 136,    32 | 
|---|
| 335 | }; | 
|---|
| 336 |  | 
|---|
| 337 | static const short yypact[] = {-32768, | 
|---|
| 338 | 119,    -4,   -16,    11,    40,    -4,    43,   -25,    24,    -7, | 
|---|
| 339 | -12,   -12,   -12,   -12,    53,-32768,   -12,-32768,   -22,-32768, | 
|---|
| 340 | -32768,-32768,-32768,-32768,-32768,-32768,    -4,    -4,    -4,    -4, | 
|---|
| 341 | -4,    39,    91,   118,-32768,    64,-32768,   131,   132,    93, | 
|---|
| 342 | -32768,    98,-32768,-32768,-32768,   137,   254,   180,   269,   270, | 
|---|
| 343 | 273,   261,   275,-32768,   263,   -36,   -36,-32768,-32768,   110, | 
|---|
| 344 | -32768,    -4,    -4,    -4,    -4,    -4,    -4,    -4,    -4,    -4, | 
|---|
| 345 | -4,    -4,    -4,    -4,    -4,    -4,    -4,    -4,    -4,-32768, | 
|---|
| 346 | -32768,-32768,-32768,-32768,   277,-32768,     1,-32768,-32768,-32768, | 
|---|
| 347 | -32768,-32768,-32768,-32768,-32768,-32768,   271,-32768,   231,-32768, | 
|---|
| 348 | 230,-32768,   134,   169,   184,   198,   211,   223,    -8,    -8, | 
|---|
| 349 | 45,    45,    45,    45,   114,   114,   -36,   -36,-32768,-32768, | 
|---|
| 350 | -32768,-32768,-32768,   -14,    12,-32768,    -4,-32768,   268,-32768, | 
|---|
| 351 | -32768,-32768,-32768,   282,   -14,-32768,-32768,-32768,   153,-32768, | 
|---|
| 352 | -32768,-32768,   293,-32768 | 
|---|
| 353 | }; | 
|---|
| 354 |  | 
|---|
| 355 | static const short yypgoto[] = {-32768, | 
|---|
| 356 | -32768,   126,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | 
|---|
| 357 | 159,    -6 | 
|---|
| 358 | }; | 
|---|
| 359 |  | 
|---|
| 360 |  | 
|---|
| 361 | #define YYLAST          294 | 
|---|
| 362 |  | 
|---|
| 363 |  | 
|---|
| 364 | static const short yytable[] = {    36, | 
|---|
| 365 | 54,    38,    41,    39,    19,   128,    33,   129,   130,   131, | 
|---|
| 366 | 122,    43,   132,   133,    44,    45,    78,    79,    20,    42, | 
|---|
| 367 | 56,    57,    58,    59,    60,    21,    22,    23,    24,    25, | 
|---|
| 368 | 26,   123,   137,    34,   138,    55,    70,    71,    72,    73, | 
|---|
| 369 | 74,    75,    76,    77,    78,    79,    27,    28,    61,    35, | 
|---|
| 370 | 29,    30,    37,    31,    40,   103,   104,   105,   106,   107, | 
|---|
| 371 | 108,   109,   110,   111,   112,   113,   114,   115,   116,   117, | 
|---|
| 372 | 118,   119,   120,    82,    62,    51,    63,    64,    65,    66, | 
|---|
| 373 | 67,    68,    69,    70,    71,    72,    73,    74,    75,    76, | 
|---|
| 374 | 77,    78,    79,    74,    75,    76,    77,    78,    79,    62, | 
|---|
| 375 | 80,    63,    64,    65,    66,    67,    68,    69,    70,    71, | 
|---|
| 376 | 72,    73,    74,    75,    76,    77,    78,    79,   143,    85, | 
|---|
| 377 | 139,     2,     3,     4,     5,     6,     7,    81,    86,     8, | 
|---|
| 378 | 9,    10,    11,    12,    13,    14,    15,    48,    49,    50, | 
|---|
| 379 | 83,    84,    53,    16,    17,    62,    88,    63,    64,    65, | 
|---|
| 380 | 66,    67,    68,    69,    70,    71,    72,    73,    74,    75, | 
|---|
| 381 | 76,    77,    78,    79,    76,    77,    78,    79,   102,    62, | 
|---|
| 382 | 127,    63,    64,    65,    66,    67,    68,    69,    70,    71, | 
|---|
| 383 | 72,    73,    74,    75,    76,    77,    78,    79,    62,    92, | 
|---|
| 384 | 63,    64,    65,    66,    67,    68,    69,    70,    71,    72, | 
|---|
| 385 | 73,    74,    75,    76,    77,    78,    79,    64,    65,    66, | 
|---|
| 386 | 67,    68,    69,    70,    71,    72,    73,    74,    75,    76, | 
|---|
| 387 | 77,    78,    79,    65,    66,    67,    68,    69,    70,    71, | 
|---|
| 388 | 72,    73,    74,    75,    76,    77,    78,    79,    66,    67, | 
|---|
| 389 | 68,    69,    70,    71,    72,    73,    74,    75,    76,    77, | 
|---|
| 390 | 78,    79,    67,    68,    69,    70,    71,    72,    73,    74, | 
|---|
| 391 | 75,    76,    77,    78,    79,    68,    69,    70,    71,    72, | 
|---|
| 392 | 73,    74,    75,    76,    77,    78,    79,    89,    93,    94, | 
|---|
| 393 | 90,    91,    95,    96,   100,   101,   121,   125,   126,   124, | 
|---|
| 394 | 140,   141,   144,   142 | 
|---|
| 395 | }; | 
|---|
| 396 |  | 
|---|
| 397 | static const short yycheck[] = {     6, | 
|---|
| 398 | 23,    27,    10,    29,     9,    20,    23,    22,    23,    24, | 
|---|
| 399 | 10,    24,    27,    28,    27,    28,    53,    54,    23,    27, | 
|---|
| 400 | 27,    28,    29,    30,    31,    30,    31,    32,    33,    34, | 
|---|
| 401 | 35,    31,    21,    23,    23,    58,    45,    46,    47,    48, | 
|---|
| 402 | 49,    50,    51,    52,    53,    54,    51,    52,    10,    10, | 
|---|
| 403 | 55,    56,    10,    58,    31,    62,    63,    64,    65,    66, | 
|---|
| 404 | 67,    68,    69,    70,    71,    72,    73,    74,    75,    76, | 
|---|
| 405 | 77,    78,    79,    10,    36,    23,    38,    39,    40,    41, | 
|---|
| 406 | 42,    43,    44,    45,    46,    47,    48,    49,    50,    51, | 
|---|
| 407 | 52,    53,    54,    49,    50,    51,    52,    53,    54,    36, | 
|---|
| 408 | 10,    38,    39,    40,    41,    42,    43,    44,    45,    46, | 
|---|
| 409 | 47,    48,    49,    50,    51,    52,    53,    54,     0,    27, | 
|---|
| 410 | 127,     3,     4,     5,     6,     7,     8,    10,    31,    11, | 
|---|
| 411 | 12,    13,    14,    15,    16,    17,    18,    12,    13,    14, | 
|---|
| 412 | 10,    10,    17,    25,    26,    36,    10,    38,    39,    40, | 
|---|
| 413 | 41,    42,    43,    44,    45,    46,    47,    48,    49,    50, | 
|---|
| 414 | 51,    52,    53,    54,    51,    52,    53,    54,    59,    36, | 
|---|
| 415 | 37,    38,    39,    40,    41,    42,    43,    44,    45,    46, | 
|---|
| 416 | 47,    48,    49,    50,    51,    52,    53,    54,    36,    10, | 
|---|
| 417 | 38,    39,    40,    41,    42,    43,    44,    45,    46,    47, | 
|---|
| 418 | 48,    49,    50,    51,    52,    53,    54,    39,    40,    41, | 
|---|
| 419 | 42,    43,    44,    45,    46,    47,    48,    49,    50,    51, | 
|---|
| 420 | 52,    53,    54,    40,    41,    42,    43,    44,    45,    46, | 
|---|
| 421 | 47,    48,    49,    50,    51,    52,    53,    54,    41,    42, | 
|---|
| 422 | 43,    44,    45,    46,    47,    48,    49,    50,    51,    52, | 
|---|
| 423 | 53,    54,    42,    43,    44,    45,    46,    47,    48,    49, | 
|---|
| 424 | 50,    51,    52,    53,    54,    43,    44,    45,    46,    47, | 
|---|
| 425 | 48,    49,    50,    51,    52,    53,    54,    24,    10,    10, | 
|---|
| 426 | 27,    28,    10,    23,    10,    23,    10,    57,    59,    19, | 
|---|
| 427 | 23,    10,     0,   135 | 
|---|
| 428 | }; | 
|---|
| 429 | /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */ | 
|---|
| 430 | #line 3 "bison.simple" | 
|---|
| 431 |  | 
|---|
| 432 | /* Skeleton output parser for bison, | 
|---|
| 433 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | 
|---|
| 434 |  | 
|---|
| 435 | This program is free software; you can redistribute it and/or modify | 
|---|
| 436 | it under the terms of the GNU General Public License as published by | 
|---|
| 437 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 438 | any later version. | 
|---|
| 439 |  | 
|---|
| 440 | This program is distributed in the hope that it will be useful, | 
|---|
| 441 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 442 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 443 | GNU General Public License for more details. | 
|---|
| 444 |  | 
|---|
| 445 | You should have received a copy of the GNU General Public License | 
|---|
| 446 | along with this program; if not, write to the Free Software | 
|---|
| 447 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ | 
|---|
| 448 |  | 
|---|
| 449 | /* As a special exception, when this file is copied by Bison into a | 
|---|
| 450 | Bison output file, you may use that output file without restriction. | 
|---|
| 451 | This special exception was added by the Free Software Foundation | 
|---|
| 452 | in version 1.24 of Bison.  */ | 
|---|
| 453 |  | 
|---|
| 454 | #ifndef alloca | 
|---|
| 455 | #ifdef __GNUC__ | 
|---|
| 456 | #define alloca __builtin_alloca | 
|---|
| 457 | #else /* not GNU C.  */ | 
|---|
| 458 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) | 
|---|
| 459 | #include <alloca.h> | 
|---|
| 460 | #else /* not sparc */ | 
|---|
| 461 | #if defined (MSDOS) && !defined (__TURBOC__) | 
|---|
| 462 | #include <malloc.h> | 
|---|
| 463 | #else /* not MSDOS, or __TURBOC__ */ | 
|---|
| 464 | #if defined(_AIX) | 
|---|
| 465 | #include <malloc.h> | 
|---|
| 466 | #pragma alloca | 
|---|
| 467 | #else /* not MSDOS, __TURBOC__, or _AIX */ | 
|---|
| 468 | #ifdef __hpux | 
|---|
| 469 | #ifdef __cplusplus | 
|---|
| 470 | extern "C" { | 
|---|
| 471 | void *alloca (unsigned int); | 
|---|
| 472 | }; | 
|---|
| 473 | #else /* not __cplusplus */ | 
|---|
| 474 | void *alloca (); | 
|---|
| 475 | #endif /* not __cplusplus */ | 
|---|
| 476 | #endif /* __hpux */ | 
|---|
| 477 | #endif /* not _AIX */ | 
|---|
| 478 | #endif /* not MSDOS, or __TURBOC__ */ | 
|---|
| 479 | #endif /* not sparc.  */ | 
|---|
| 480 | #endif /* not GNU C.  */ | 
|---|
| 481 | #endif /* alloca not defined.  */ | 
|---|
| 482 |  | 
|---|
| 483 | /* This is the parser code that is written into each bison parser | 
|---|
| 484 | when the %semantic_parser declaration is not specified in the grammar. | 
|---|
| 485 | It was written by Richard Stallman by simplifying the hairy parser | 
|---|
| 486 | used when %semantic_parser is specified.  */ | 
|---|
| 487 |  | 
|---|
| 488 | /* Note: there must be only one dollar sign in this file. | 
|---|
| 489 | It is replaced by the list of actions, each action | 
|---|
| 490 | as one case of the switch.  */ | 
|---|
| 491 |  | 
|---|
| 492 | #define yyerrok         (yyerrstatus = 0) | 
|---|
| 493 | #define yyclearin       (yychar = YYEMPTY) | 
|---|
| 494 | #define YYEMPTY         -2 | 
|---|
| 495 | #define YYEOF           0 | 
|---|
| 496 | #define YYACCEPT        return(0) | 
|---|
| 497 | #define YYABORT         return(1) | 
|---|
| 498 | #define YYERROR         goto yyerrlab1 | 
|---|
| 499 | /* Like YYERROR except do call yyerror. | 
|---|
| 500 | This remains here temporarily to ease the | 
|---|
| 501 | transition to the new meaning of YYERROR, for GCC. | 
|---|
| 502 | Once GCC version 2 has supplanted version 1, this can go.  */ | 
|---|
| 503 | #define YYFAIL          goto yyerrlab | 
|---|
| 504 | #define YYRECOVERING()  (!!yyerrstatus) | 
|---|
| 505 | #define YYBACKUP(token, value) \ | 
|---|
| 506 | do                                                              \ | 
|---|
| 507 | if (yychar == YYEMPTY && yylen == 1)                          \ | 
|---|
| 508 | { yychar = (token), yylval = (value);                       \ | 
|---|
| 509 | yychar1 = YYTRANSLATE (yychar);                           \ | 
|---|
| 510 | YYPOPSTACK;                                               \ | 
|---|
| 511 | goto yybackup;                                            \ | 
|---|
| 512 | }                                                           \ | 
|---|
| 513 | else                                                          \ | 
|---|
| 514 | { yyerror ("syntax error: cannot back up"); YYERROR; }      \ | 
|---|
| 515 | while (0) | 
|---|
| 516 |  | 
|---|
| 517 | #define YYTERROR        1 | 
|---|
| 518 | #define YYERRCODE       256 | 
|---|
| 519 |  | 
|---|
| 520 | #ifndef YYPURE | 
|---|
| 521 | #define YYLEX           yylex() | 
|---|
| 522 | #endif | 
|---|
| 523 |  | 
|---|
| 524 | #ifdef YYPURE | 
|---|
| 525 | #ifdef YYLSP_NEEDED | 
|---|
| 526 | #ifdef YYLEX_PARAM | 
|---|
| 527 | #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM) | 
|---|
| 528 | #else | 
|---|
| 529 | #define YYLEX           yylex(&yylval, &yylloc) | 
|---|
| 530 | #endif | 
|---|
| 531 | #else /* not YYLSP_NEEDED */ | 
|---|
| 532 | #ifdef YYLEX_PARAM | 
|---|
| 533 | #define YYLEX           yylex(&yylval, YYLEX_PARAM) | 
|---|
| 534 | #else | 
|---|
| 535 | #define YYLEX           yylex(&yylval) | 
|---|
| 536 | #endif | 
|---|
| 537 | #endif /* not YYLSP_NEEDED */ | 
|---|
| 538 | #endif | 
|---|
| 539 |  | 
|---|
| 540 | /* If nonreentrant, generate the variables here */ | 
|---|
| 541 |  | 
|---|
| 542 | #ifndef YYPURE | 
|---|
| 543 |  | 
|---|
| 544 | int     yychar;                 /*  the lookahead symbol                */ | 
|---|
| 545 | YYSTYPE yylval;                 /*  the semantic value of the           */ | 
|---|
| 546 | /*  lookahead symbol                    */ | 
|---|
| 547 |  | 
|---|
| 548 | #ifdef YYLSP_NEEDED | 
|---|
| 549 | YYLTYPE yylloc;                 /*  location data for the lookahead     */ | 
|---|
| 550 | /*  symbol                              */ | 
|---|
| 551 | #endif | 
|---|
| 552 |  | 
|---|
| 553 | int yynerrs;                    /*  number of parse errors so far       */ | 
|---|
| 554 | #endif  /* not YYPURE */ | 
|---|
| 555 |  | 
|---|
| 556 | #if YYDEBUG != 0 | 
|---|
| 557 | int yydebug;                    /*  nonzero means print parse trace     */ | 
|---|
| 558 | /* Since this is uninitialized, it does not stop multiple parsers | 
|---|
| 559 | from coexisting.  */ | 
|---|
| 560 | #endif | 
|---|
| 561 |  | 
|---|
| 562 | /*  YYINITDEPTH indicates the initial size of the parser's stacks       */ | 
|---|
| 563 |  | 
|---|
| 564 | #ifndef YYINITDEPTH | 
|---|
| 565 | #define YYINITDEPTH 200 | 
|---|
| 566 | #endif | 
|---|
| 567 |  | 
|---|
| 568 | /*  YYMAXDEPTH is the maximum size the stacks can grow to | 
|---|
| 569 | (effective only if the built-in stack extension method is used).  */ | 
|---|
| 570 |  | 
|---|
| 571 | #if YYMAXDEPTH == 0 | 
|---|
| 572 | #undef YYMAXDEPTH | 
|---|
| 573 | #endif | 
|---|
| 574 |  | 
|---|
| 575 | #ifndef YYMAXDEPTH | 
|---|
| 576 | #define YYMAXDEPTH 10000 | 
|---|
| 577 | #endif | 
|---|
| 578 |  | 
|---|
| 579 | /* Prevent warning if -Wstrict-prototypes.  */ | 
|---|
| 580 | #ifdef __GNUC__ | 
|---|
| 581 | int yyparse (void); | 
|---|
| 582 | #endif | 
|---|
| 583 |  | 
|---|
| 584 |  | 
|---|
| 585 | #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */ | 
|---|
| 586 | #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT) | 
|---|
| 587 | #else                           /* not GNU C or C++ */ | 
|---|
| 588 | #ifndef __cplusplus | 
|---|
| 589 |  | 
|---|
| 590 | /* This is the most reliable way to avoid incompatibilities | 
|---|
| 591 | in available built-in functions on various systems.  */ | 
|---|
| 592 | static void | 
|---|
| 593 | __yy_memcpy (to, from, count) | 
|---|
| 594 | char *to; | 
|---|
| 595 | char *from; | 
|---|
| 596 | int count; | 
|---|
| 597 | { | 
|---|
| 598 | register char *f = from; | 
|---|
| 599 | register char *t = to; | 
|---|
| 600 | register int i = count; | 
|---|
| 601 |  | 
|---|
| 602 | while (i-- > 0) | 
|---|
| 603 | *t++ = *f++; | 
|---|
| 604 | } | 
|---|
| 605 |  | 
|---|
| 606 | #else /* __cplusplus */ | 
|---|
| 607 |  | 
|---|
| 608 | /* This is the most reliable way to avoid incompatibilities | 
|---|
| 609 | in available built-in functions on various systems.  */ | 
|---|
| 610 | static void | 
|---|
| 611 | __yy_memcpy (char *to, char *from, int count) | 
|---|
| 612 | { | 
|---|
| 613 | register char *f = from; | 
|---|
| 614 | register char *t = to; | 
|---|
| 615 | register int i = count; | 
|---|
| 616 |  | 
|---|
| 617 | while (i-- > 0) | 
|---|
| 618 | *t++ = *f++; | 
|---|
| 619 | } | 
|---|
| 620 |  | 
|---|
| 621 | #endif | 
|---|
| 622 | #endif | 
|---|
| 623 |  | 
|---|
| 624 |  | 
|---|
| 625 | #line 196 "bison.simple" | 
|---|
| 626 |  | 
|---|
| 627 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | 
|---|
| 628 | into yyparse.  The argument should have type void *. | 
|---|
| 629 | It should actually point to an object. | 
|---|
| 630 | Grammar actions can access the variable by casting it | 
|---|
| 631 | to the proper pointer type.  */ | 
|---|
| 632 |  | 
|---|
| 633 | #ifdef YYPARSE_PARAM | 
|---|
| 634 | #ifdef __cplusplus | 
|---|
| 635 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | 
|---|
| 636 | #define YYPARSE_PARAM_DECL | 
|---|
| 637 | #else /* not __cplusplus */ | 
|---|
| 638 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | 
|---|
| 639 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | 
|---|
| 640 | #endif /* not __cplusplus */ | 
|---|
| 641 | #else /* not YYPARSE_PARAM */ | 
|---|
| 642 | #define YYPARSE_PARAM_ARG | 
|---|
| 643 | #define YYPARSE_PARAM_DECL | 
|---|
| 644 | #endif /* not YYPARSE_PARAM */ | 
|---|
| 645 |  | 
|---|
| 646 | int | 
|---|
| 647 | yyparse(YYPARSE_PARAM_ARG) | 
|---|
| 648 | YYPARSE_PARAM_DECL | 
|---|
| 649 | { | 
|---|
| 650 | register int yystate; | 
|---|
| 651 | register int yyn; | 
|---|
| 652 | register short *yyssp; | 
|---|
| 653 | register YYSTYPE *yyvsp; | 
|---|
| 654 | int yyerrstatus;      /*  number of tokens to shift before error messages enabled */ | 
|---|
| 655 | int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */ | 
|---|
| 656 |  | 
|---|
| 657 | short yyssa[YYINITDEPTH];     /*  the state stack                     */ | 
|---|
| 658 | YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */ | 
|---|
| 659 |  | 
|---|
| 660 | short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */ | 
|---|
| 661 | YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */ | 
|---|
| 662 |  | 
|---|
| 663 | #ifdef YYLSP_NEEDED | 
|---|
| 664 | YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */ | 
|---|
| 665 | YYLTYPE *yyls = yylsa; | 
|---|
| 666 | YYLTYPE *yylsp; | 
|---|
| 667 |  | 
|---|
| 668 | #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--) | 
|---|
| 669 | #else | 
|---|
| 670 | #define YYPOPSTACK   (yyvsp--, yyssp--) | 
|---|
| 671 | #endif | 
|---|
| 672 |  | 
|---|
| 673 | int yystacksize = YYINITDEPTH; | 
|---|
| 674 |  | 
|---|
| 675 | #ifdef YYPURE | 
|---|
| 676 | int yychar; | 
|---|
| 677 | YYSTYPE yylval; | 
|---|
| 678 | int yynerrs; | 
|---|
| 679 | #ifdef YYLSP_NEEDED | 
|---|
| 680 | YYLTYPE yylloc; | 
|---|
| 681 | #endif | 
|---|
| 682 | #endif | 
|---|
| 683 |  | 
|---|
| 684 | YYSTYPE yyval;                /*  the variable used to return         */ | 
|---|
| 685 | /*  semantic values from the action     */ | 
|---|
| 686 | /*  routines                            */ | 
|---|
| 687 |  | 
|---|
| 688 | int yylen; | 
|---|
| 689 |  | 
|---|
| 690 | #if YYDEBUG != 0 | 
|---|
| 691 | if (yydebug) | 
|---|
| 692 | fprintf(stderr, "Starting parse\n"); | 
|---|
| 693 | #endif | 
|---|
| 694 |  | 
|---|
| 695 | yystate = 0; | 
|---|
| 696 | yyerrstatus = 0; | 
|---|
| 697 | yynerrs = 0; | 
|---|
| 698 | yychar = YYEMPTY;             /* Cause a token to be read.  */ | 
|---|
| 699 |  | 
|---|
| 700 | /* Initialize stack pointers. | 
|---|
| 701 | Waste one element of value and location stack | 
|---|
| 702 | so that they stay on the same level as the state stack. | 
|---|
| 703 | The wasted elements are never initialized.  */ | 
|---|
| 704 |  | 
|---|
| 705 | yyssp = yyss - 1; | 
|---|
| 706 | yyvsp = yyvs; | 
|---|
| 707 | #ifdef YYLSP_NEEDED | 
|---|
| 708 | yylsp = yyls; | 
|---|
| 709 | #endif | 
|---|
| 710 |  | 
|---|
| 711 | /* Push a new state, which is found in  yystate  .  */ | 
|---|
| 712 | /* In all cases, when you get here, the value and location stacks | 
|---|
| 713 | have just been pushed. so pushing a state here evens the stacks.  */ | 
|---|
| 714 | yynewstate: | 
|---|
| 715 |  | 
|---|
| 716 | *++yyssp = yystate; | 
|---|
| 717 |  | 
|---|
| 718 | if (yyssp >= yyss + yystacksize - 1) | 
|---|
| 719 | { | 
|---|
| 720 | /* Give user a chance to reallocate the stack */ | 
|---|
| 721 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | 
|---|
| 722 | YYSTYPE *yyvs1 = yyvs; | 
|---|
| 723 | short *yyss1 = yyss; | 
|---|
| 724 | #ifdef YYLSP_NEEDED | 
|---|
| 725 | YYLTYPE *yyls1 = yyls; | 
|---|
| 726 | #endif | 
|---|
| 727 |  | 
|---|
| 728 | /* Get the current used size of the three stacks, in elements.  */ | 
|---|
| 729 | int size = yyssp - yyss + 1; | 
|---|
| 730 |  | 
|---|
| 731 | #ifdef yyoverflow | 
|---|
| 732 | /* Each stack pointer address is followed by the size of | 
|---|
| 733 | the data in use in that stack, in bytes.  */ | 
|---|
| 734 | #ifdef YYLSP_NEEDED | 
|---|
| 735 | /* This used to be a conditional around just the two extra args, | 
|---|
| 736 | but that might be undefined if yyoverflow is a macro.  */ | 
|---|
| 737 | yyoverflow("parser stack overflow", | 
|---|
| 738 | &yyss1, size * sizeof (*yyssp), | 
|---|
| 739 | &yyvs1, size * sizeof (*yyvsp), | 
|---|
| 740 | &yyls1, size * sizeof (*yylsp), | 
|---|
| 741 | &yystacksize); | 
|---|
| 742 | #else | 
|---|
| 743 | yyoverflow("parser stack overflow", | 
|---|
| 744 | &yyss1, size * sizeof (*yyssp), | 
|---|
| 745 | &yyvs1, size * sizeof (*yyvsp), | 
|---|
| 746 | &yystacksize); | 
|---|
| 747 | #endif | 
|---|
| 748 |  | 
|---|
| 749 | yyss = yyss1; yyvs = yyvs1; | 
|---|
| 750 | #ifdef YYLSP_NEEDED | 
|---|
| 751 | yyls = yyls1; | 
|---|
| 752 | #endif | 
|---|
| 753 | #else /* no yyoverflow */ | 
|---|
| 754 | /* Extend the stack our own way.  */ | 
|---|
| 755 | if (yystacksize >= YYMAXDEPTH) | 
|---|
| 756 | { | 
|---|
| 757 | yyerror("parser stack overflow"); | 
|---|
| 758 | return 2; | 
|---|
| 759 | } | 
|---|
| 760 | yystacksize *= 2; | 
|---|
| 761 | if (yystacksize > YYMAXDEPTH) | 
|---|
| 762 | yystacksize = YYMAXDEPTH; | 
|---|
| 763 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); | 
|---|
| 764 | __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); | 
|---|
| 765 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); | 
|---|
| 766 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); | 
|---|
| 767 | #ifdef YYLSP_NEEDED | 
|---|
| 768 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); | 
|---|
| 769 | __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); | 
|---|
| 770 | #endif | 
|---|
| 771 | #endif /* no yyoverflow */ | 
|---|
| 772 |  | 
|---|
| 773 | yyssp = yyss + size - 1; | 
|---|
| 774 | yyvsp = yyvs + size - 1; | 
|---|
| 775 | #ifdef YYLSP_NEEDED | 
|---|
| 776 | yylsp = yyls + size - 1; | 
|---|
| 777 | #endif | 
|---|
| 778 |  | 
|---|
| 779 | #if YYDEBUG != 0 | 
|---|
| 780 | if (yydebug) | 
|---|
| 781 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | 
|---|
| 782 | #endif | 
|---|
| 783 |  | 
|---|
| 784 | if (yyssp >= yyss + yystacksize - 1) | 
|---|
| 785 | YYABORT; | 
|---|
| 786 | } | 
|---|
| 787 |  | 
|---|
| 788 | #if YYDEBUG != 0 | 
|---|
| 789 | if (yydebug) | 
|---|
| 790 | fprintf(stderr, "Entering state %d\n", yystate); | 
|---|
| 791 | #endif | 
|---|
| 792 |  | 
|---|
| 793 | goto yybackup; | 
|---|
| 794 | yybackup: | 
|---|
| 795 |  | 
|---|
| 796 | /* Do appropriate processing given the current state.  */ | 
|---|
| 797 | /* Read a lookahead token if we need one and don't already have one.  */ | 
|---|
| 798 | /* yyresume: */ | 
|---|
| 799 |  | 
|---|
| 800 | /* First try to decide what to do without reference to lookahead token.  */ | 
|---|
| 801 |  | 
|---|
| 802 | yyn = yypact[yystate]; | 
|---|
| 803 | if (yyn == YYFLAG) | 
|---|
| 804 | goto yydefault; | 
|---|
| 805 |  | 
|---|
| 806 | /* Not known => get a lookahead token if don't already have one.  */ | 
|---|
| 807 |  | 
|---|
| 808 | /* yychar is either YYEMPTY or YYEOF | 
|---|
| 809 | or a valid token in external form.  */ | 
|---|
| 810 |  | 
|---|
| 811 | if (yychar == YYEMPTY) | 
|---|
| 812 | { | 
|---|
| 813 | #if YYDEBUG != 0 | 
|---|
| 814 | if (yydebug) | 
|---|
| 815 | fprintf(stderr, "Reading a token: "); | 
|---|
| 816 | #endif | 
|---|
| 817 | yychar = YYLEX; | 
|---|
| 818 | } | 
|---|
| 819 |  | 
|---|
| 820 | /* Convert token to internal form (in yychar1) for indexing tables with */ | 
|---|
| 821 |  | 
|---|
| 822 | if (yychar <= 0)              /* This means end of input. */ | 
|---|
| 823 | { | 
|---|
| 824 | yychar1 = 0; | 
|---|
| 825 | yychar = YYEOF;           /* Don't call YYLEX any more */ | 
|---|
| 826 |  | 
|---|
| 827 | #if YYDEBUG != 0 | 
|---|
| 828 | if (yydebug) | 
|---|
| 829 | fprintf(stderr, "Now at end of input.\n"); | 
|---|
| 830 | #endif | 
|---|
| 831 | } | 
|---|
| 832 | else | 
|---|
| 833 | { | 
|---|
| 834 | yychar1 = YYTRANSLATE(yychar); | 
|---|
| 835 |  | 
|---|
| 836 | #if YYDEBUG != 0 | 
|---|
| 837 | if (yydebug) | 
|---|
| 838 | { | 
|---|
| 839 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | 
|---|
| 840 | /* Give the individual parser a way to print the precise meaning | 
|---|
| 841 | of a token, for further debugging info.  */ | 
|---|
| 842 | #ifdef YYPRINT | 
|---|
| 843 | YYPRINT (stderr, yychar, yylval); | 
|---|
| 844 | #endif | 
|---|
| 845 | fprintf (stderr, ")\n"); | 
|---|
| 846 | } | 
|---|
| 847 | #endif | 
|---|
| 848 | } | 
|---|
| 849 |  | 
|---|
| 850 | yyn += yychar1; | 
|---|
| 851 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | 
|---|
| 852 | goto yydefault; | 
|---|
| 853 |  | 
|---|
| 854 | yyn = yytable[yyn]; | 
|---|
| 855 |  | 
|---|
| 856 | /* yyn is what to do for this token type in this state. | 
|---|
| 857 | Negative => reduce, -yyn is rule number. | 
|---|
| 858 | Positive => shift, yyn is new state. | 
|---|
| 859 | New state is final state => don't bother to shift, | 
|---|
| 860 | just return success. | 
|---|
| 861 | 0, or most negative number => error.  */ | 
|---|
| 862 |  | 
|---|
| 863 | if (yyn < 0) | 
|---|
| 864 | { | 
|---|
| 865 | if (yyn == YYFLAG) | 
|---|
| 866 | goto yyerrlab; | 
|---|
| 867 | yyn = -yyn; | 
|---|
| 868 | goto yyreduce; | 
|---|
| 869 | } | 
|---|
| 870 | else if (yyn == 0) | 
|---|
| 871 | goto yyerrlab; | 
|---|
| 872 |  | 
|---|
| 873 | if (yyn == YYFINAL) | 
|---|
| 874 | YYACCEPT; | 
|---|
| 875 |  | 
|---|
| 876 | /* Shift the lookahead token.  */ | 
|---|
| 877 |  | 
|---|
| 878 | #if YYDEBUG != 0 | 
|---|
| 879 | if (yydebug) | 
|---|
| 880 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | 
|---|
| 881 | #endif | 
|---|
| 882 |  | 
|---|
| 883 | /* Discard the token being shifted unless it is eof.  */ | 
|---|
| 884 | if (yychar != YYEOF) | 
|---|
| 885 | yychar = YYEMPTY; | 
|---|
| 886 |  | 
|---|
| 887 | *++yyvsp = yylval; | 
|---|
| 888 | #ifdef YYLSP_NEEDED | 
|---|
| 889 | *++yylsp = yylloc; | 
|---|
| 890 | #endif | 
|---|
| 891 |  | 
|---|
| 892 | /* count tokens shifted since error; after three, turn off error status.  */ | 
|---|
| 893 | if (yyerrstatus) yyerrstatus--; | 
|---|
| 894 |  | 
|---|
| 895 | yystate = yyn; | 
|---|
| 896 | goto yynewstate; | 
|---|
| 897 |  | 
|---|
| 898 | /* Do the default action for the current state.  */ | 
|---|
| 899 | yydefault: | 
|---|
| 900 |  | 
|---|
| 901 | yyn = yydefact[yystate]; | 
|---|
| 902 | if (yyn == 0) | 
|---|
| 903 | goto yyerrlab; | 
|---|
| 904 |  | 
|---|
| 905 | /* Do a reduction.  yyn is the number of a rule to reduce with.  */ | 
|---|
| 906 | yyreduce: | 
|---|
| 907 | yylen = yyr2[yyn]; | 
|---|
| 908 | if (yylen > 0) | 
|---|
| 909 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | 
|---|
| 910 |  | 
|---|
| 911 | #if YYDEBUG != 0 | 
|---|
| 912 | if (yydebug) | 
|---|
| 913 | { | 
|---|
| 914 | int i; | 
|---|
| 915 |  | 
|---|
| 916 | fprintf (stderr, "Reducing via rule %d (line %d), ", | 
|---|
| 917 | yyn, yyrline[yyn]); | 
|---|
| 918 |  | 
|---|
| 919 | /* Print the symbols being reduced, and their result.  */ | 
|---|
| 920 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | 
|---|
| 921 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | 
|---|
| 922 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | 
|---|
| 923 | } | 
|---|
| 924 | #endif | 
|---|
| 925 |  | 
|---|
| 926 |  | 
|---|
| 927 | switch (yyn) { | 
|---|
| 928 |  | 
|---|
| 929 | case 3: | 
|---|
| 930 | #line 169 "ppy.y" | 
|---|
| 931 | { do_include(yyvsp[-1].cptr, 1); ; | 
|---|
| 932 | break;} | 
|---|
| 933 | case 4: | 
|---|
| 934 | #line 170 "ppy.y" | 
|---|
| 935 | { do_include(yyvsp[-1].cptr, 0); ; | 
|---|
| 936 | break;} | 
|---|
| 937 | case 5: | 
|---|
| 938 | #line 171 "ppy.y" | 
|---|
| 939 | { next_if_state(boolean(&yyvsp[-1].cval)); ; | 
|---|
| 940 | break;} | 
|---|
| 941 | case 6: | 
|---|
| 942 | #line 172 "ppy.y" | 
|---|
| 943 | { next_if_state(pplookup(yyvsp[-1].cptr) != NULL); free(yyvsp[-1].cptr); ; | 
|---|
| 944 | break;} | 
|---|
| 945 | case 7: | 
|---|
| 946 | #line 173 "ppy.y" | 
|---|
| 947 | { | 
|---|
| 948 | int t = pplookup(yyvsp[-1].cptr) == NULL; | 
|---|
| 949 | if(include_state == 0 && t && !seen_junk) | 
|---|
| 950 | { | 
|---|
| 951 | include_state   = 1; | 
|---|
| 952 | include_ppp     = yyvsp[-1].cptr; | 
|---|
| 953 | include_ifdepth = get_if_depth(); | 
|---|
| 954 | } | 
|---|
| 955 | else if(include_state != 1) | 
|---|
| 956 | { | 
|---|
| 957 | include_state = -1; | 
|---|
| 958 | free(yyvsp[-1].cptr); | 
|---|
| 959 | } | 
|---|
| 960 | else | 
|---|
| 961 | free(yyvsp[-1].cptr); | 
|---|
| 962 | next_if_state(t); | 
|---|
| 963 | if(debuglevel & DEBUGLEVEL_PPMSG) | 
|---|
| 964 | fprintf(stderr, "tIFNDEF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", input_name, line_number, include_state, include_ppp, include_ifdepth); | 
|---|
| 965 | ; | 
|---|
| 966 | break;} | 
|---|
| 967 | case 8: | 
|---|
| 968 | #line 192 "ppy.y" | 
|---|
| 969 | { | 
|---|
| 970 | if_state_t s = pop_if(); | 
|---|
| 971 | switch(s) | 
|---|
| 972 | { | 
|---|
| 973 | case if_true: | 
|---|
| 974 | case if_elif: | 
|---|
| 975 | push_if(if_elif); | 
|---|
| 976 | break; | 
|---|
| 977 | case if_false: | 
|---|
| 978 | push_if(boolean(&yyvsp[-1].cval) ? if_true : if_false); | 
|---|
| 979 | break; | 
|---|
| 980 | case if_ignore: | 
|---|
| 981 | push_if(if_ignore); | 
|---|
| 982 | break; | 
|---|
| 983 | case if_elsetrue: | 
|---|
| 984 | case if_elsefalse: | 
|---|
| 985 | pperror("#elif cannot follow #else"); | 
|---|
| 986 | default: | 
|---|
| 987 | internal_error(__FILE__, __LINE__, "Invalid if_state (%d) in #elif directive", s); | 
|---|
| 988 | } | 
|---|
| 989 | ; | 
|---|
| 990 | break;} | 
|---|
| 991 | case 9: | 
|---|
| 992 | #line 213 "ppy.y" | 
|---|
| 993 | { | 
|---|
| 994 | if_state_t s = pop_if(); | 
|---|
| 995 | switch(s) | 
|---|
| 996 | { | 
|---|
| 997 | case if_true: | 
|---|
| 998 | push_if(if_elsefalse); | 
|---|
| 999 | break; | 
|---|
| 1000 | case if_elif: | 
|---|
| 1001 | push_if(if_elif); | 
|---|
| 1002 | break; | 
|---|
| 1003 | case if_false: | 
|---|
| 1004 | push_if(if_elsetrue); | 
|---|
| 1005 | break; | 
|---|
| 1006 | case if_ignore: | 
|---|
| 1007 | push_if(if_ignore); | 
|---|
| 1008 | break; | 
|---|
| 1009 | case if_elsetrue: | 
|---|
| 1010 | case if_elsefalse: | 
|---|
| 1011 | pperror("#else clause already defined"); | 
|---|
| 1012 | default: | 
|---|
| 1013 | internal_error(__FILE__, __LINE__, "Invalid if_state (%d) in #else directive", s); | 
|---|
| 1014 | } | 
|---|
| 1015 | ; | 
|---|
| 1016 | break;} | 
|---|
| 1017 | case 10: | 
|---|
| 1018 | #line 236 "ppy.y" | 
|---|
| 1019 | { | 
|---|
| 1020 | pop_if(); | 
|---|
| 1021 | if(include_ifdepth == get_if_depth() && include_state == 1) | 
|---|
| 1022 | { | 
|---|
| 1023 | include_state = 2; | 
|---|
| 1024 | seen_junk = 0; | 
|---|
| 1025 | } | 
|---|
| 1026 | else if(include_state != 1) | 
|---|
| 1027 | { | 
|---|
| 1028 | include_state = -1; | 
|---|
| 1029 | } | 
|---|
| 1030 | if(debuglevel & DEBUGLEVEL_PPMSG) | 
|---|
| 1031 | fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", input_name, line_number, include_state, include_ppp, include_ifdepth); | 
|---|
| 1032 | ; | 
|---|
| 1033 | break;} | 
|---|
| 1034 | case 11: | 
|---|
| 1035 | #line 250 "ppy.y" | 
|---|
| 1036 | { del_define(yyvsp[-1].cptr); free(yyvsp[-1].cptr); ; | 
|---|
| 1037 | break;} | 
|---|
| 1038 | case 12: | 
|---|
| 1039 | #line 251 "ppy.y" | 
|---|
| 1040 | { add_define(yyvsp[-2].cptr, yyvsp[-1].cptr); ; | 
|---|
| 1041 | break;} | 
|---|
| 1042 | case 13: | 
|---|
| 1043 | #line 252 "ppy.y" | 
|---|
| 1044 | { | 
|---|
| 1045 | add_macro(yyvsp[-5].cptr, macro_args, nmacro_args, yyvsp[-1].mtext); | 
|---|
| 1046 | ; | 
|---|
| 1047 | break;} | 
|---|
| 1048 | case 14: | 
|---|
| 1049 | #line 255 "ppy.y" | 
|---|
| 1050 | { fprintf(ppout, "# %d %s\n", yyvsp[-2].sint - 1, yyvsp[-1].cptr); free(yyvsp[-1].cptr); ; | 
|---|
| 1051 | break;} | 
|---|
| 1052 | case 15: | 
|---|
| 1053 | #line 256 "ppy.y" | 
|---|
| 1054 | { fprintf(ppout, "# %d %s\n", yyvsp[-1].sint - 1, yyvsp[-2].cptr); free(yyvsp[-2].cptr); ; | 
|---|
| 1055 | break;} | 
|---|
| 1056 | case 17: | 
|---|
| 1057 | #line 258 "ppy.y" | 
|---|
| 1058 | { pperror("#error directive: '%s'", yyvsp[-1].cptr); if(yyvsp[-1].cptr) free(yyvsp[-1].cptr); ; | 
|---|
| 1059 | break;} | 
|---|
| 1060 | case 18: | 
|---|
| 1061 | #line 259 "ppy.y" | 
|---|
| 1062 | { ppwarning("#warning directive: '%s'", yyvsp[-1].cptr); if(yyvsp[-1].cptr) free(yyvsp[-1].cptr); ; | 
|---|
| 1063 | break;} | 
|---|
| 1064 | case 19: | 
|---|
| 1065 | #line 260 "ppy.y" | 
|---|
| 1066 | { if(pedantic) ppwarning("#pragma ignored (arg: '%s')", yyvsp[-1].cptr); if(yyvsp[-1].cptr) free(yyvsp[-1].cptr); ; | 
|---|
| 1067 | break;} | 
|---|
| 1068 | case 20: | 
|---|
| 1069 | #line 261 "ppy.y" | 
|---|
| 1070 | { if(pedantic) ppwarning("#ident ignored (arg: '%s')", yyvsp[-1].cptr); if(yyvsp[-1].cptr) free(yyvsp[-1].cptr); ; | 
|---|
| 1071 | break;} | 
|---|
| 1072 | case 21: | 
|---|
| 1073 | #line 265 "ppy.y" | 
|---|
| 1074 | { yyval.cptr = NULL; ; | 
|---|
| 1075 | break;} | 
|---|
| 1076 | case 22: | 
|---|
| 1077 | #line 266 "ppy.y" | 
|---|
| 1078 | { yyval.cptr = yyvsp[0].cptr; ; | 
|---|
| 1079 | break;} | 
|---|
| 1080 | case 23: | 
|---|
| 1081 | #line 269 "ppy.y" | 
|---|
| 1082 | { yyval.cptr = yyvsp[0].cptr; ; | 
|---|
| 1083 | break;} | 
|---|
| 1084 | case 24: | 
|---|
| 1085 | #line 270 "ppy.y" | 
|---|
| 1086 | { yyval.cptr = yyvsp[0].cptr; ; | 
|---|
| 1087 | break;} | 
|---|
| 1088 | case 25: | 
|---|
| 1089 | #line 271 "ppy.y" | 
|---|
| 1090 | { yyval.cptr = yyvsp[0].cptr; ; | 
|---|
| 1091 | break;} | 
|---|
| 1092 | case 26: | 
|---|
| 1093 | #line 272 "ppy.y" | 
|---|
| 1094 | { yyval.cptr = merge_text(yyvsp[-1].cptr, yyvsp[0].cptr); ; | 
|---|
| 1095 | break;} | 
|---|
| 1096 | case 27: | 
|---|
| 1097 | #line 273 "ppy.y" | 
|---|
| 1098 | { yyval.cptr = merge_text(yyvsp[-1].cptr, yyvsp[0].cptr); ; | 
|---|
| 1099 | break;} | 
|---|
| 1100 | case 28: | 
|---|
| 1101 | #line 274 "ppy.y" | 
|---|
| 1102 | { yyval.cptr = merge_text(yyvsp[-1].cptr, yyvsp[0].cptr); ; | 
|---|
| 1103 | break;} | 
|---|
| 1104 | case 29: | 
|---|
| 1105 | #line 277 "ppy.y" | 
|---|
| 1106 | { macro_args = NULL; nmacro_args = 0; ; | 
|---|
| 1107 | break;} | 
|---|
| 1108 | case 30: | 
|---|
| 1109 | #line 280 "ppy.y" | 
|---|
| 1110 | { yyval.sint = yyvsp[0].sint; ; | 
|---|
| 1111 | break;} | 
|---|
| 1112 | case 32: | 
|---|
| 1113 | #line 284 "ppy.y" | 
|---|
| 1114 | { yyval.sint = 0; macro_args = NULL; nmacro_args = 0; ; | 
|---|
| 1115 | break;} | 
|---|
| 1116 | case 33: | 
|---|
| 1117 | #line 285 "ppy.y" | 
|---|
| 1118 | { yyval.sint = nmacro_args; ; | 
|---|
| 1119 | break;} | 
|---|
| 1120 | case 34: | 
|---|
| 1121 | #line 288 "ppy.y" | 
|---|
| 1122 | { yyval.marg = yyvsp[0].marg; ; | 
|---|
| 1123 | break;} | 
|---|
| 1124 | case 35: | 
|---|
| 1125 | #line 289 "ppy.y" | 
|---|
| 1126 | { yyval.marg = add_new_marg(NULL, arg_list); nmacro_args *= -1; ; | 
|---|
| 1127 | break;} | 
|---|
| 1128 | case 36: | 
|---|
| 1129 | #line 292 "ppy.y" | 
|---|
| 1130 | { yyval.marg = add_new_marg(yyvsp[0].cptr, arg_single); ; | 
|---|
| 1131 | break;} | 
|---|
| 1132 | case 37: | 
|---|
| 1133 | #line 293 "ppy.y" | 
|---|
| 1134 | { yyval.marg = add_new_marg(yyvsp[0].cptr, arg_single); ; | 
|---|
| 1135 | break;} | 
|---|
| 1136 | case 38: | 
|---|
| 1137 | #line 297 "ppy.y" | 
|---|
| 1138 | { yyval.mtext = NULL; ; | 
|---|
| 1139 | break;} | 
|---|
| 1140 | case 39: | 
|---|
| 1141 | #line 298 "ppy.y" | 
|---|
| 1142 | { | 
|---|
| 1143 | for(yyval.mtext = yyvsp[0].mtext; yyval.mtext && yyval.mtext->prev; yyval.mtext = yyval.mtext->prev) | 
|---|
| 1144 | ; | 
|---|
| 1145 | ; | 
|---|
| 1146 | break;} | 
|---|
| 1147 | case 40: | 
|---|
| 1148 | #line 304 "ppy.y" | 
|---|
| 1149 | { yyval.mtext = yyvsp[0].mtext; ; | 
|---|
| 1150 | break;} | 
|---|
| 1151 | case 41: | 
|---|
| 1152 | #line 305 "ppy.y" | 
|---|
| 1153 | { yyval.mtext = combine_mtext(yyvsp[-1].mtext, yyvsp[0].mtext); ; | 
|---|
| 1154 | break;} | 
|---|
| 1155 | case 42: | 
|---|
| 1156 | #line 308 "ppy.y" | 
|---|
| 1157 | { yyval.mtext = new_mtext(yyvsp[0].cptr, 0, exp_text); ; | 
|---|
| 1158 | break;} | 
|---|
| 1159 | case 43: | 
|---|
| 1160 | #line 309 "ppy.y" | 
|---|
| 1161 | { yyval.mtext = new_mtext(yyvsp[0].cptr, 0, exp_text); ; | 
|---|
| 1162 | break;} | 
|---|
| 1163 | case 44: | 
|---|
| 1164 | #line 310 "ppy.y" | 
|---|
| 1165 | { yyval.mtext = new_mtext(yyvsp[0].cptr, 0, exp_text); ; | 
|---|
| 1166 | break;} | 
|---|
| 1167 | case 45: | 
|---|
| 1168 | #line 311 "ppy.y" | 
|---|
| 1169 | { yyval.mtext = new_mtext(NULL, 0, exp_concat); ; | 
|---|
| 1170 | break;} | 
|---|
| 1171 | case 46: | 
|---|
| 1172 | #line 312 "ppy.y" | 
|---|
| 1173 | { | 
|---|
| 1174 | int mat = marg_index(yyvsp[0].cptr); | 
|---|
| 1175 | if(mat < 0) | 
|---|
| 1176 | pperror("Stringification identifier must be an argument parameter"); | 
|---|
| 1177 | yyval.mtext = new_mtext(NULL, mat, exp_stringize); | 
|---|
| 1178 | ; | 
|---|
| 1179 | break;} | 
|---|
| 1180 | case 47: | 
|---|
| 1181 | #line 318 "ppy.y" | 
|---|
| 1182 | { | 
|---|
| 1183 | int mat = marg_index(yyvsp[0].cptr); | 
|---|
| 1184 | if(mat >= 0) | 
|---|
| 1185 | yyval.mtext = new_mtext(NULL, mat, exp_subst); | 
|---|
| 1186 | else | 
|---|
| 1187 | yyval.mtext = new_mtext(yyvsp[0].cptr, 0, exp_text); | 
|---|
| 1188 | ; | 
|---|
| 1189 | break;} | 
|---|
| 1190 | case 48: | 
|---|
| 1191 | #line 327 "ppy.y" | 
|---|
| 1192 | { yyval.cval.type = cv_sint;  yyval.cval.val.si = yyvsp[0].sint; ; | 
|---|
| 1193 | break;} | 
|---|
| 1194 | case 49: | 
|---|
| 1195 | #line 328 "ppy.y" | 
|---|
| 1196 | { yyval.cval.type = cv_uint;  yyval.cval.val.ui = yyvsp[0].uint; ; | 
|---|
| 1197 | break;} | 
|---|
| 1198 | case 50: | 
|---|
| 1199 | #line 329 "ppy.y" | 
|---|
| 1200 | { yyval.cval.type = cv_slong; yyval.cval.val.sl = yyvsp[0].slong; ; | 
|---|
| 1201 | break;} | 
|---|
| 1202 | case 51: | 
|---|
| 1203 | #line 330 "ppy.y" | 
|---|
| 1204 | { yyval.cval.type = cv_ulong; yyval.cval.val.ul = yyvsp[0].ulong; ; | 
|---|
| 1205 | break;} | 
|---|
| 1206 | case 52: | 
|---|
| 1207 | #line 331 "ppy.y" | 
|---|
| 1208 | { yyval.cval.type = cv_sll;   yyval.cval.val.sl = yyvsp[0].sll; ; | 
|---|
| 1209 | break;} | 
|---|
| 1210 | case 53: | 
|---|
| 1211 | #line 332 "ppy.y" | 
|---|
| 1212 | { yyval.cval.type = cv_ull;   yyval.cval.val.ul = yyvsp[0].ull; ; | 
|---|
| 1213 | break;} | 
|---|
| 1214 | case 54: | 
|---|
| 1215 | #line 333 "ppy.y" | 
|---|
| 1216 | { yyval.cval.type = cv_sint;  yyval.cval.val.si = pplookup(yyvsp[0].cptr) != NULL; ; | 
|---|
| 1217 | break;} | 
|---|
| 1218 | case 55: | 
|---|
| 1219 | #line 334 "ppy.y" | 
|---|
| 1220 | { yyval.cval.type = cv_sint;  yyval.cval.val.si = pplookup(yyvsp[-1].cptr) != NULL; ; | 
|---|
| 1221 | break;} | 
|---|
| 1222 | case 56: | 
|---|
| 1223 | #line 335 "ppy.y" | 
|---|
| 1224 | { yyval.cval.type = cv_sint;  yyval.cval.val.si = 0; ; | 
|---|
| 1225 | break;} | 
|---|
| 1226 | case 57: | 
|---|
| 1227 | #line 336 "ppy.y" | 
|---|
| 1228 | { yyval.cval.type = cv_sint; yyval.cval.val.si = boolean(&yyvsp[-2].cval) || boolean(&yyvsp[0].cval); ; | 
|---|
| 1229 | break;} | 
|---|
| 1230 | case 58: | 
|---|
| 1231 | #line 337 "ppy.y" | 
|---|
| 1232 | { yyval.cval.type = cv_sint; yyval.cval.val.si = boolean(&yyvsp[-2].cval) && boolean(&yyvsp[0].cval); ; | 
|---|
| 1233 | break;} | 
|---|
| 1234 | case 59: | 
|---|
| 1235 | #line 338 "ppy.y" | 
|---|
| 1236 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval, ==) ; | 
|---|
| 1237 | break;} | 
|---|
| 1238 | case 60: | 
|---|
| 1239 | #line 339 "ppy.y" | 
|---|
| 1240 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval, !=) ; | 
|---|
| 1241 | break;} | 
|---|
| 1242 | case 61: | 
|---|
| 1243 | #line 340 "ppy.y" | 
|---|
| 1244 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  <) ; | 
|---|
| 1245 | break;} | 
|---|
| 1246 | case 62: | 
|---|
| 1247 | #line 341 "ppy.y" | 
|---|
| 1248 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  >) ; | 
|---|
| 1249 | break;} | 
|---|
| 1250 | case 63: | 
|---|
| 1251 | #line 342 "ppy.y" | 
|---|
| 1252 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval, <=) ; | 
|---|
| 1253 | break;} | 
|---|
| 1254 | case 64: | 
|---|
| 1255 | #line 343 "ppy.y" | 
|---|
| 1256 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval, >=) ; | 
|---|
| 1257 | break;} | 
|---|
| 1258 | case 65: | 
|---|
| 1259 | #line 344 "ppy.y" | 
|---|
| 1260 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  +) ; | 
|---|
| 1261 | break;} | 
|---|
| 1262 | case 66: | 
|---|
| 1263 | #line 345 "ppy.y" | 
|---|
| 1264 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  -) ; | 
|---|
| 1265 | break;} | 
|---|
| 1266 | case 67: | 
|---|
| 1267 | #line 346 "ppy.y" | 
|---|
| 1268 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  ^) ; | 
|---|
| 1269 | break;} | 
|---|
| 1270 | case 68: | 
|---|
| 1271 | #line 347 "ppy.y" | 
|---|
| 1272 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  &) ; | 
|---|
| 1273 | break;} | 
|---|
| 1274 | case 69: | 
|---|
| 1275 | #line 348 "ppy.y" | 
|---|
| 1276 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  |) ; | 
|---|
| 1277 | break;} | 
|---|
| 1278 | case 70: | 
|---|
| 1279 | #line 349 "ppy.y" | 
|---|
| 1280 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  *) ; | 
|---|
| 1281 | break;} | 
|---|
| 1282 | case 71: | 
|---|
| 1283 | #line 350 "ppy.y" | 
|---|
| 1284 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval,  /) ; | 
|---|
| 1285 | break;} | 
|---|
| 1286 | case 72: | 
|---|
| 1287 | #line 351 "ppy.y" | 
|---|
| 1288 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval, <<) ; | 
|---|
| 1289 | break;} | 
|---|
| 1290 | case 73: | 
|---|
| 1291 | #line 352 "ppy.y" | 
|---|
| 1292 | { promote_equal_size(&yyvsp[-2].cval, &yyvsp[0].cval); BIN_OP(yyval.cval, yyvsp[-2].cval, yyvsp[0].cval, >>) ; | 
|---|
| 1293 | break;} | 
|---|
| 1294 | case 74: | 
|---|
| 1295 | #line 353 "ppy.y" | 
|---|
| 1296 | { yyval.cval =  yyvsp[0].cval; ; | 
|---|
| 1297 | break;} | 
|---|
| 1298 | case 75: | 
|---|
| 1299 | #line 354 "ppy.y" | 
|---|
| 1300 | { UNARY_OP(yyval.cval, yyvsp[0].cval, -) ; | 
|---|
| 1301 | break;} | 
|---|
| 1302 | case 76: | 
|---|
| 1303 | #line 355 "ppy.y" | 
|---|
| 1304 | { UNARY_OP(yyval.cval, yyvsp[0].cval, ~) ; | 
|---|
| 1305 | break;} | 
|---|
| 1306 | case 77: | 
|---|
| 1307 | #line 356 "ppy.y" | 
|---|
| 1308 | { yyval.cval.type = cv_sint; yyval.cval.val.si = !boolean(&yyvsp[0].cval); ; | 
|---|
| 1309 | break;} | 
|---|
| 1310 | case 78: | 
|---|
| 1311 | #line 357 "ppy.y" | 
|---|
| 1312 | { yyval.cval =  yyvsp[-1].cval; ; | 
|---|
| 1313 | break;} | 
|---|
| 1314 | case 79: | 
|---|
| 1315 | #line 358 "ppy.y" | 
|---|
| 1316 | { yyval.cval = boolean(&yyvsp[-4].cval) ? yyvsp[-2].cval : yyvsp[0].cval; ; | 
|---|
| 1317 | break;} | 
|---|
| 1318 | } | 
|---|
| 1319 | /* the action file gets copied in in place of this dollarsign */ | 
|---|
| 1320 | #line 498 "bison.simple" | 
|---|
| 1321 |  | 
|---|
| 1322 |  | 
|---|
| 1323 | yyvsp -= yylen; | 
|---|
| 1324 | yyssp -= yylen; | 
|---|
| 1325 | #ifdef YYLSP_NEEDED | 
|---|
| 1326 | yylsp -= yylen; | 
|---|
| 1327 | #endif | 
|---|
| 1328 |  | 
|---|
| 1329 | #if YYDEBUG != 0 | 
|---|
| 1330 | if (yydebug) | 
|---|
| 1331 | { | 
|---|
| 1332 | short *ssp1 = yyss - 1; | 
|---|
| 1333 | fprintf (stderr, "state stack now"); | 
|---|
| 1334 | while (ssp1 != yyssp) | 
|---|
| 1335 | fprintf (stderr, " %d", *++ssp1); | 
|---|
| 1336 | fprintf (stderr, "\n"); | 
|---|
| 1337 | } | 
|---|
| 1338 | #endif | 
|---|
| 1339 |  | 
|---|
| 1340 | *++yyvsp = yyval; | 
|---|
| 1341 |  | 
|---|
| 1342 | #ifdef YYLSP_NEEDED | 
|---|
| 1343 | yylsp++; | 
|---|
| 1344 | if (yylen == 0) | 
|---|
| 1345 | { | 
|---|
| 1346 | yylsp->first_line = yylloc.first_line; | 
|---|
| 1347 | yylsp->first_column = yylloc.first_column; | 
|---|
| 1348 | yylsp->last_line = (yylsp-1)->last_line; | 
|---|
| 1349 | yylsp->last_column = (yylsp-1)->last_column; | 
|---|
| 1350 | yylsp->text = 0; | 
|---|
| 1351 | } | 
|---|
| 1352 | else | 
|---|
| 1353 | { | 
|---|
| 1354 | yylsp->last_line = (yylsp+yylen-1)->last_line; | 
|---|
| 1355 | yylsp->last_column = (yylsp+yylen-1)->last_column; | 
|---|
| 1356 | } | 
|---|
| 1357 | #endif | 
|---|
| 1358 |  | 
|---|
| 1359 | /* Now "shift" the result of the reduction. | 
|---|
| 1360 | Determine what state that goes to, | 
|---|
| 1361 | based on the state we popped back to | 
|---|
| 1362 | and the rule number reduced by.  */ | 
|---|
| 1363 |  | 
|---|
| 1364 | yyn = yyr1[yyn]; | 
|---|
| 1365 |  | 
|---|
| 1366 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | 
|---|
| 1367 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | 
|---|
| 1368 | yystate = yytable[yystate]; | 
|---|
| 1369 | else | 
|---|
| 1370 | yystate = yydefgoto[yyn - YYNTBASE]; | 
|---|
| 1371 |  | 
|---|
| 1372 | goto yynewstate; | 
|---|
| 1373 |  | 
|---|
| 1374 | yyerrlab:   /* here on detecting error */ | 
|---|
| 1375 |  | 
|---|
| 1376 | if (! yyerrstatus) | 
|---|
| 1377 | /* If not already recovering from an error, report this error.  */ | 
|---|
| 1378 | { | 
|---|
| 1379 | ++yynerrs; | 
|---|
| 1380 |  | 
|---|
| 1381 | #ifdef YYERROR_VERBOSE | 
|---|
| 1382 | yyn = yypact[yystate]; | 
|---|
| 1383 |  | 
|---|
| 1384 | if (yyn > YYFLAG && yyn < YYLAST) | 
|---|
| 1385 | { | 
|---|
| 1386 | int size = 0; | 
|---|
| 1387 | char *msg; | 
|---|
| 1388 | int x, count; | 
|---|
| 1389 |  | 
|---|
| 1390 | count = 0; | 
|---|
| 1391 | /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */ | 
|---|
| 1392 | for (x = (yyn < 0 ? -yyn : 0); | 
|---|
| 1393 | x < (sizeof(yytname) / sizeof(char *)); x++) | 
|---|
| 1394 | if (yycheck[x + yyn] == x) | 
|---|
| 1395 | size += strlen(yytname[x]) + 15, count++; | 
|---|
| 1396 | msg = (char *) malloc(size + 15); | 
|---|
| 1397 | if (msg != 0) | 
|---|
| 1398 | { | 
|---|
| 1399 | strcpy(msg, "parse error"); | 
|---|
| 1400 |  | 
|---|
| 1401 | if (count < 5) | 
|---|
| 1402 | { | 
|---|
| 1403 | count = 0; | 
|---|
| 1404 | for (x = (yyn < 0 ? -yyn : 0); | 
|---|
| 1405 | x < (sizeof(yytname) / sizeof(char *)); x++) | 
|---|
| 1406 | if (yycheck[x + yyn] == x) | 
|---|
| 1407 | { | 
|---|
| 1408 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | 
|---|
| 1409 | strcat(msg, yytname[x]); | 
|---|
| 1410 | strcat(msg, "'"); | 
|---|
| 1411 | count++; | 
|---|
| 1412 | } | 
|---|
| 1413 | } | 
|---|
| 1414 | yyerror(msg); | 
|---|
| 1415 | free(msg); | 
|---|
| 1416 | } | 
|---|
| 1417 | else | 
|---|
| 1418 | yyerror ("parse error; also virtual memory exceeded"); | 
|---|
| 1419 | } | 
|---|
| 1420 | else | 
|---|
| 1421 | #endif /* YYERROR_VERBOSE */ | 
|---|
| 1422 | yyerror("parse error"); | 
|---|
| 1423 | } | 
|---|
| 1424 |  | 
|---|
| 1425 | goto yyerrlab1; | 
|---|
| 1426 | yyerrlab1:   /* here on error raised explicitly by an action */ | 
|---|
| 1427 |  | 
|---|
| 1428 | if (yyerrstatus == 3) | 
|---|
| 1429 | { | 
|---|
| 1430 | /* if just tried and failed to reuse lookahead token after an error, discard it.  */ | 
|---|
| 1431 |  | 
|---|
| 1432 | /* return failure if at end of input */ | 
|---|
| 1433 | if (yychar == YYEOF) | 
|---|
| 1434 | YYABORT; | 
|---|
| 1435 |  | 
|---|
| 1436 | #if YYDEBUG != 0 | 
|---|
| 1437 | if (yydebug) | 
|---|
| 1438 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | 
|---|
| 1439 | #endif | 
|---|
| 1440 |  | 
|---|
| 1441 | yychar = YYEMPTY; | 
|---|
| 1442 | } | 
|---|
| 1443 |  | 
|---|
| 1444 | /* Else will try to reuse lookahead token | 
|---|
| 1445 | after shifting the error token.  */ | 
|---|
| 1446 |  | 
|---|
| 1447 | yyerrstatus = 3;              /* Each real token shifted decrements this */ | 
|---|
| 1448 |  | 
|---|
| 1449 | goto yyerrhandle; | 
|---|
| 1450 |  | 
|---|
| 1451 | yyerrdefault:  /* current state does not do anything special for the error token. */ | 
|---|
| 1452 |  | 
|---|
| 1453 | #if 0 | 
|---|
| 1454 | /* This is wrong; only states that explicitly want error tokens | 
|---|
| 1455 | should shift them.  */ | 
|---|
| 1456 | yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/ | 
|---|
| 1457 | if (yyn) goto yydefault; | 
|---|
| 1458 | #endif | 
|---|
| 1459 |  | 
|---|
| 1460 | yyerrpop:   /* pop the current state because it cannot handle the error token */ | 
|---|
| 1461 |  | 
|---|
| 1462 | if (yyssp == yyss) YYABORT; | 
|---|
| 1463 | yyvsp--; | 
|---|
| 1464 | yystate = *--yyssp; | 
|---|
| 1465 | #ifdef YYLSP_NEEDED | 
|---|
| 1466 | yylsp--; | 
|---|
| 1467 | #endif | 
|---|
| 1468 |  | 
|---|
| 1469 | #if YYDEBUG != 0 | 
|---|
| 1470 | if (yydebug) | 
|---|
| 1471 | { | 
|---|
| 1472 | short *ssp1 = yyss - 1; | 
|---|
| 1473 | fprintf (stderr, "Error: state stack now"); | 
|---|
| 1474 | while (ssp1 != yyssp) | 
|---|
| 1475 | fprintf (stderr, " %d", *++ssp1); | 
|---|
| 1476 | fprintf (stderr, "\n"); | 
|---|
| 1477 | } | 
|---|
| 1478 | #endif | 
|---|
| 1479 |  | 
|---|
| 1480 | yyerrhandle: | 
|---|
| 1481 |  | 
|---|
| 1482 | yyn = yypact[yystate]; | 
|---|
| 1483 | if (yyn == YYFLAG) | 
|---|
| 1484 | goto yyerrdefault; | 
|---|
| 1485 |  | 
|---|
| 1486 | yyn += YYTERROR; | 
|---|
| 1487 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | 
|---|
| 1488 | goto yyerrdefault; | 
|---|
| 1489 |  | 
|---|
| 1490 | yyn = yytable[yyn]; | 
|---|
| 1491 | if (yyn < 0) | 
|---|
| 1492 | { | 
|---|
| 1493 | if (yyn == YYFLAG) | 
|---|
| 1494 | goto yyerrpop; | 
|---|
| 1495 | yyn = -yyn; | 
|---|
| 1496 | goto yyreduce; | 
|---|
| 1497 | } | 
|---|
| 1498 | else if (yyn == 0) | 
|---|
| 1499 | goto yyerrpop; | 
|---|
| 1500 |  | 
|---|
| 1501 | if (yyn == YYFINAL) | 
|---|
| 1502 | YYACCEPT; | 
|---|
| 1503 |  | 
|---|
| 1504 | #if YYDEBUG != 0 | 
|---|
| 1505 | if (yydebug) | 
|---|
| 1506 | fprintf(stderr, "Shifting error token, "); | 
|---|
| 1507 | #endif | 
|---|
| 1508 |  | 
|---|
| 1509 | *++yyvsp = yylval; | 
|---|
| 1510 | #ifdef YYLSP_NEEDED | 
|---|
| 1511 | *++yylsp = yylloc; | 
|---|
| 1512 | #endif | 
|---|
| 1513 |  | 
|---|
| 1514 | yystate = yyn; | 
|---|
| 1515 | goto yynewstate; | 
|---|
| 1516 | } | 
|---|
| 1517 | #line 361 "ppy.y" | 
|---|
| 1518 |  | 
|---|
| 1519 |  | 
|---|
| 1520 | /* | 
|---|
| 1521 | ************************************************************************** | 
|---|
| 1522 | * Support functions | 
|---|
| 1523 | ************************************************************************** | 
|---|
| 1524 | */ | 
|---|
| 1525 |  | 
|---|
| 1526 | static void cast_to_sint(cval_t *v) | 
|---|
| 1527 | { | 
|---|
| 1528 | switch(v->type) | 
|---|
| 1529 | { | 
|---|
| 1530 | case cv_sint:   break; | 
|---|
| 1531 | case cv_uint:   break; | 
|---|
| 1532 | case cv_slong:  v->val.si = v->val.sl;  break; | 
|---|
| 1533 | case cv_ulong:  v->val.si = v->val.ul;  break; | 
|---|
| 1534 | case cv_sll:    v->val.si = v->val.sll; break; | 
|---|
| 1535 | case cv_ull:    v->val.si = v->val.ull; break; | 
|---|
| 1536 | } | 
|---|
| 1537 | v->type = cv_sint; | 
|---|
| 1538 | } | 
|---|
| 1539 |  | 
|---|
| 1540 | static void cast_to_uint(cval_t *v) | 
|---|
| 1541 | { | 
|---|
| 1542 | switch(v->type) | 
|---|
| 1543 | { | 
|---|
| 1544 | case cv_sint:   break; | 
|---|
| 1545 | case cv_uint:   break; | 
|---|
| 1546 | case cv_slong:  v->val.ui = v->val.sl;  break; | 
|---|
| 1547 | case cv_ulong:  v->val.ui = v->val.ul;  break; | 
|---|
| 1548 | case cv_sll:    v->val.ui = v->val.sll; break; | 
|---|
| 1549 | case cv_ull:    v->val.ui = v->val.ull; break; | 
|---|
| 1550 | } | 
|---|
| 1551 | v->type = cv_uint; | 
|---|
| 1552 | } | 
|---|
| 1553 |  | 
|---|
| 1554 | static void cast_to_slong(cval_t *v) | 
|---|
| 1555 | { | 
|---|
| 1556 | switch(v->type) | 
|---|
| 1557 | { | 
|---|
| 1558 | case cv_sint:   v->val.sl = v->val.si;  break; | 
|---|
| 1559 | case cv_uint:   v->val.sl = v->val.ui;  break; | 
|---|
| 1560 | case cv_slong:  break; | 
|---|
| 1561 | case cv_ulong:  break; | 
|---|
| 1562 | case cv_sll:    v->val.sl = v->val.sll; break; | 
|---|
| 1563 | case cv_ull:    v->val.sl = v->val.ull; break; | 
|---|
| 1564 | } | 
|---|
| 1565 | v->type = cv_slong; | 
|---|
| 1566 | } | 
|---|
| 1567 |  | 
|---|
| 1568 | static void cast_to_ulong(cval_t *v) | 
|---|
| 1569 | { | 
|---|
| 1570 | switch(v->type) | 
|---|
| 1571 | { | 
|---|
| 1572 | case cv_sint:   v->val.ul = v->val.si;  break; | 
|---|
| 1573 | case cv_uint:   v->val.ul = v->val.ui;  break; | 
|---|
| 1574 | case cv_slong:  break; | 
|---|
| 1575 | case cv_ulong:  break; | 
|---|
| 1576 | case cv_sll:    v->val.ul = v->val.sll; break; | 
|---|
| 1577 | case cv_ull:    v->val.ul = v->val.ull; break; | 
|---|
| 1578 | } | 
|---|
| 1579 | v->type = cv_ulong; | 
|---|
| 1580 | } | 
|---|
| 1581 |  | 
|---|
| 1582 | static void cast_to_sll(cval_t *v) | 
|---|
| 1583 | { | 
|---|
| 1584 | switch(v->type) | 
|---|
| 1585 | { | 
|---|
| 1586 | case cv_sint:   v->val.sll = v->val.si; break; | 
|---|
| 1587 | case cv_uint:   v->val.sll = v->val.ui; break; | 
|---|
| 1588 | case cv_slong:  v->val.sll = v->val.sl; break; | 
|---|
| 1589 | case cv_ulong:  v->val.sll = v->val.ul; break; | 
|---|
| 1590 | case cv_sll:    break; | 
|---|
| 1591 | case cv_ull:    break; | 
|---|
| 1592 | } | 
|---|
| 1593 | v->type = cv_sll; | 
|---|
| 1594 | } | 
|---|
| 1595 |  | 
|---|
| 1596 | static void cast_to_ull(cval_t *v) | 
|---|
| 1597 | { | 
|---|
| 1598 | switch(v->type) | 
|---|
| 1599 | { | 
|---|
| 1600 | case cv_sint:   v->val.ull = v->val.si; break; | 
|---|
| 1601 | case cv_uint:   v->val.ull = v->val.ui; break; | 
|---|
| 1602 | case cv_slong:  v->val.ull = v->val.sl; break; | 
|---|
| 1603 | case cv_ulong:  v->val.ull = v->val.ul; break; | 
|---|
| 1604 | case cv_sll:    break; | 
|---|
| 1605 | case cv_ull:    break; | 
|---|
| 1606 | } | 
|---|
| 1607 | v->type = cv_ull; | 
|---|
| 1608 | } | 
|---|
| 1609 |  | 
|---|
| 1610 |  | 
|---|
| 1611 | static void promote_equal_size(cval_t *v1, cval_t *v2) | 
|---|
| 1612 | { | 
|---|
| 1613 | #define cv_sizeof(v)    ((int)(v->type & SIZE_MASK)) | 
|---|
| 1614 | int s1 = cv_sizeof(v1); | 
|---|
| 1615 | int s2 = cv_sizeof(v2); | 
|---|
| 1616 | #undef cv_sizeof | 
|---|
| 1617 |  | 
|---|
| 1618 | if(s1 == s2) | 
|---|
| 1619 | return; | 
|---|
| 1620 | else if(s1 > s2) | 
|---|
| 1621 | { | 
|---|
| 1622 | switch(v1->type) | 
|---|
| 1623 | { | 
|---|
| 1624 | case cv_sint:   cast_to_sint(v2); break; | 
|---|
| 1625 | case cv_uint:   cast_to_uint(v2); break; | 
|---|
| 1626 | case cv_slong:  cast_to_slong(v2); break; | 
|---|
| 1627 | case cv_ulong:  cast_to_ulong(v2); break; | 
|---|
| 1628 | case cv_sll:    cast_to_sll(v2); break; | 
|---|
| 1629 | case cv_ull:    cast_to_ull(v2); break; | 
|---|
| 1630 | } | 
|---|
| 1631 | } | 
|---|
| 1632 | else | 
|---|
| 1633 | { | 
|---|
| 1634 | switch(v2->type) | 
|---|
| 1635 | { | 
|---|
| 1636 | case cv_sint:   cast_to_sint(v1); break; | 
|---|
| 1637 | case cv_uint:   cast_to_uint(v1); break; | 
|---|
| 1638 | case cv_slong:  cast_to_slong(v1); break; | 
|---|
| 1639 | case cv_ulong:  cast_to_ulong(v1); break; | 
|---|
| 1640 | case cv_sll:    cast_to_sll(v1); break; | 
|---|
| 1641 | case cv_ull:    cast_to_ull(v1); break; | 
|---|
| 1642 | } | 
|---|
| 1643 | } | 
|---|
| 1644 | } | 
|---|
| 1645 |  | 
|---|
| 1646 |  | 
|---|
| 1647 | static int boolean(cval_t *v) | 
|---|
| 1648 | { | 
|---|
| 1649 | switch(v->type) | 
|---|
| 1650 | { | 
|---|
| 1651 | case cv_sint:   return v->val.si != (int)0; | 
|---|
| 1652 | case cv_uint:   return v->val.ui != (unsigned int)0; | 
|---|
| 1653 | case cv_slong:  return v->val.sl != (long)0; | 
|---|
| 1654 | case cv_ulong:  return v->val.ul != (unsigned long)0; | 
|---|
| 1655 | case cv_sll:    return v->val.sll != (wrc_sll_t)0; | 
|---|
| 1656 | case cv_ull:    return v->val.ull != (wrc_ull_t)0; | 
|---|
| 1657 | } | 
|---|
| 1658 | return 0; | 
|---|
| 1659 | } | 
|---|
| 1660 |  | 
|---|
| 1661 | static marg_t *new_marg(char *str, def_arg_t type) | 
|---|
| 1662 | { | 
|---|
| 1663 | marg_t *ma = (marg_t *)xmalloc(sizeof(marg_t)); | 
|---|
| 1664 | ma->arg = str; | 
|---|
| 1665 | ma->type = type; | 
|---|
| 1666 | return ma; | 
|---|
| 1667 | } | 
|---|
| 1668 |  | 
|---|
| 1669 | static marg_t *add_new_marg(char *str, def_arg_t type) | 
|---|
| 1670 | { | 
|---|
| 1671 | marg_t *ma = new_marg(str, type); | 
|---|
| 1672 | nmacro_args++; | 
|---|
| 1673 | macro_args = (marg_t **)xrealloc(macro_args, nmacro_args * sizeof(macro_args[0])); | 
|---|
| 1674 | macro_args[nmacro_args-1] = ma; | 
|---|
| 1675 | return ma; | 
|---|
| 1676 | } | 
|---|
| 1677 |  | 
|---|
| 1678 | static int marg_index(char *id) | 
|---|
| 1679 | { | 
|---|
| 1680 | int t; | 
|---|
| 1681 | for(t = 0; t < nmacro_args; t++) | 
|---|
| 1682 | { | 
|---|
| 1683 | if(!strcmp(id, macro_args[t]->arg)) | 
|---|
| 1684 | break; | 
|---|
| 1685 | } | 
|---|
| 1686 | return t < nmacro_args ? t : -1; | 
|---|
| 1687 | } | 
|---|
| 1688 |  | 
|---|
| 1689 | static mtext_t *new_mtext(char *str, int idx, def_exp_t type) | 
|---|
| 1690 | { | 
|---|
| 1691 | mtext_t *mt = (mtext_t *)xmalloc(sizeof(mtext_t)); | 
|---|
| 1692 | if(str == NULL) | 
|---|
| 1693 | mt->subst.argidx = idx; | 
|---|
| 1694 | else | 
|---|
| 1695 | mt->subst.text = str; | 
|---|
| 1696 | mt->type = type; | 
|---|
| 1697 | return mt; | 
|---|
| 1698 | } | 
|---|
| 1699 |  | 
|---|
| 1700 | static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) | 
|---|
| 1701 | { | 
|---|
| 1702 | if(!tail) | 
|---|
| 1703 | return mtp; | 
|---|
| 1704 |  | 
|---|
| 1705 | if(!mtp) | 
|---|
| 1706 | return tail; | 
|---|
| 1707 |  | 
|---|
| 1708 | if(tail->type == exp_text && mtp->type == exp_text) | 
|---|
| 1709 | { | 
|---|
| 1710 | tail->subst.text = xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); | 
|---|
| 1711 | strcat(tail->subst.text, mtp->subst.text); | 
|---|
| 1712 | free(mtp->subst.text); | 
|---|
| 1713 | free(mtp); | 
|---|
| 1714 | return tail; | 
|---|
| 1715 | } | 
|---|
| 1716 |  | 
|---|
| 1717 | if(tail->type == exp_concat && mtp->type == exp_concat) | 
|---|
| 1718 | { | 
|---|
| 1719 | free(mtp); | 
|---|
| 1720 | return tail; | 
|---|
| 1721 | } | 
|---|
| 1722 |  | 
|---|
| 1723 | if(tail->type == exp_concat && mtp->type == exp_text) | 
|---|
| 1724 | { | 
|---|
| 1725 | int len = strlen(mtp->subst.text); | 
|---|
| 1726 | while(len) | 
|---|
| 1727 | { | 
|---|
| 1728 | /* FIXME: should delete space from head of string */ | 
|---|
| 1729 | if(isspace(mtp->subst.text[len-1] & 0xff)) | 
|---|
| 1730 | mtp->subst.text[--len] = '\0'; | 
|---|
| 1731 | else | 
|---|
| 1732 | break; | 
|---|
| 1733 | } | 
|---|
| 1734 |  | 
|---|
| 1735 | if(!len) | 
|---|
| 1736 | { | 
|---|
| 1737 | free(mtp->subst.text); | 
|---|
| 1738 | free(mtp); | 
|---|
| 1739 | return tail; | 
|---|
| 1740 | } | 
|---|
| 1741 | } | 
|---|
| 1742 |  | 
|---|
| 1743 | if(tail->type == exp_text && mtp->type == exp_concat) | 
|---|
| 1744 | { | 
|---|
| 1745 | int len = strlen(tail->subst.text); | 
|---|
| 1746 | while(len) | 
|---|
| 1747 | { | 
|---|
| 1748 | if(isspace(tail->subst.text[len-1] & 0xff)) | 
|---|
| 1749 | tail->subst.text[--len] = '\0'; | 
|---|
| 1750 | else | 
|---|
| 1751 | break; | 
|---|
| 1752 | } | 
|---|
| 1753 |  | 
|---|
| 1754 | if(!len) | 
|---|
| 1755 | { | 
|---|
| 1756 | mtp->prev = tail->prev; | 
|---|
| 1757 | mtp->next = tail->next; | 
|---|
| 1758 | if(tail->prev) | 
|---|
| 1759 | tail->prev->next = mtp; | 
|---|
| 1760 | free(tail->subst.text); | 
|---|
| 1761 | free(tail); | 
|---|
| 1762 | return mtp; | 
|---|
| 1763 | } | 
|---|
| 1764 | } | 
|---|
| 1765 |  | 
|---|
| 1766 | tail->next = mtp; | 
|---|
| 1767 | mtp->prev = tail; | 
|---|
| 1768 |  | 
|---|
| 1769 | return mtp; | 
|---|
| 1770 | } | 
|---|
| 1771 |  | 
|---|
| 1772 | static char *merge_text(char *s1, char *s2) | 
|---|
| 1773 | { | 
|---|
| 1774 | int l1 = strlen(s1); | 
|---|
| 1775 | int l2 = strlen(s2); | 
|---|
| 1776 | s1 = xrealloc(s1, l1+l2+1); | 
|---|
| 1777 | memcpy(s1+l1, s2, l2+1); | 
|---|
| 1778 | free(s2); | 
|---|
| 1779 | return s1; | 
|---|
| 1780 | } | 
|---|
| 1781 |  | 
|---|