00001
00002
00003
00004 #define YYBISON 1
00005
00006 # define tBEHAVIOR 257
00007 # define tID 258
00008 # define tSTRING 259
00009 # define tTERMSTRING 260
00010 # define tNUMBER 261
00011 # define tMESSAGE 262
00012 # define tIMPORT 263
00013 # define tEXTERNAL 264
00014 # define tBEGIN 265
00015 # define tEND 266
00016 # define tBITS 267
00017 # define tBYTES 268
00018 # define tSTRTYPE 269
00019 # define tBLANKS 270
00020 # define tPROCESS 271
00021 # define tGLOBAL 272
00022 # define tCONST 273
00023 # define tVAR 274
00024 # define tINTEGER 275
00025 # define tADDRESS 276
00026 # define tCLIENTADDRESS 277
00027 # define tSERVERADDRESS 278
00028 # define tARRAY 279
00029 # define tOF 280
00030 # define tRCV 281
00031 # define tFROM 282
00032 # define tTIMEOUT 283
00033 # define tSKIP 284
00034 # define tSEND 285
00035 # define tTO 286
00036 # define tIF 287
00037 # define tFI 288
00038 # define tDO 289
00039 # define tOD 290
00040 # define tACT 291
00041 # define tIN 292
00042 # define tPLUS 293
00043 # define tMINUS 294
00044 # define tTIMES 295
00045 # define tDIVIDE 296
00046 # define tBAND 297
00047 # define tBOR 298
00048 # define tNEG 299
00049 # define tDIFFERENT 300
00050 # define tLTE 301
00051 # define tGTE 302
00052 # define tEQUAL 303
00053 # define tLT 304
00054 # define tGT 305
00055 # define tGUARD 306
00056 # define tLBRACKET 307
00057 # define tRBRACKET 308
00058 # define tLPAR 309
00059 # define tRPAR 310
00060 # define tCOMMA 311
00061 # define tCOLON 312
00062 # define tSCOLON 313
00063 # define tACTION 314
00064 # define tDOT 315
00065 # define tRANGE 316
00066 # define tASSIGN 317
00067 # define tDQUOTE 318
00068 # define tSTART 319
00069 # define tSTOP 320
00070 # define UMINUS 321
00071
00072 #line 1 "protomake.y"
00073
00081 #include <map>
00082 #include <vector>
00083 #include <typeinfo>
00084 #include <stdio.h>
00085 #include <stdlib.h>
00086 #include <string.h>
00087 #include <ctype.h>
00088 using namespace std;
00089
00090 #include "nodes/protomake.h"
00091
00093 int yylex(void);
00094
00099 extern int lines;
00100
00104 Program *root;
00105
00106 int yyerror(char *msg);
00107
00108 typedef struct FieldTypeInfo
00109 {
00110 FieldType::FType fType;
00111
00112 union {
00113 int numChars;
00114 char *cteStr;
00115 char *terminator;
00116 char *blanks;
00117 } info;
00118 } FieldTypeInfo;
00119
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 #line 64 "protomake.y"
00135 #ifndef YYSTYPE
00136 typedef union {
00137 long number;
00138 char *string;
00139 SimpleImport *simpImp;
00140 Import *import;
00141 IdentifierList *idLst;
00142 Behavior *behavior;
00143 SimpleBehavior *simpBhv;
00144 Message *message;
00145 SimpleMessage *simpMsg;
00146 FieldType::FType fType;
00147 FieldTypeInfo fTypeInfo;
00148 FieldType *fieldType
00149 Expression *exp;
00150 FieldDeclaration *fieldDcl;
00151 SimpleFieldDeclaration *simpFld;
00152 StringLiteral *strLit;
00153 Process *proc;
00154 SimpleProcess *simpProc;
00155 Declaration *decl;
00156 SimpleDeclaration *simpDecl;
00157 Action *action;
00158 SimpleAction *simpAct;
00159 Type *type;
00160 Guard *guard;
00161 Statement *stmt;
00162 SimpleStatement *simpStmt;
00163 ArrayReference *arrayRef;
00164 LeftSideList *leftSideLst;
00165 LeftSide *leftSide;
00166 GuardedStatement *guardStmt;
00167 SimpleGuardedStatement *simpGuardStmt;
00168 FieldReference *fieldRef;
00169 ExpressionList *expLst;
00170 } yystype;
00171 # define YYSTYPE yystype
00172 # define YYSTYPE_IS_TRIVIAL 1
00173 #endif
00174 #ifndef YYDEBUG
00175 # define YYDEBUG 0
00176 #endif
00177
00178
00179
00180 #define YYFINAL 223
00181 #define YYFLAG -32768
00182 #define YYNTBASE 68
00183
00184
00185 #define YYTRANSLATE(x) ((unsigned)(x) <= 321 ? yytranslate[x] : 106)
00186
00187
00188 static const char yytranslate[] =
00189 {
00190 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00215 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
00216 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
00217 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
00218 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
00219 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
00220 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
00221 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
00222 66, 67
00223 };
00224
00225 #if YYDEBUG
00226 static const short yyprhs[] =
00227 {
00228 0, 0, 5, 7, 8, 10, 13, 16, 18, 20,
00229 21, 23, 26, 29, 31, 34, 44, 49, 51, 52,
00230 56, 58, 60, 64, 69, 81, 83, 86, 87, 90,
00231 92, 94, 96, 98, 100, 105, 110, 115, 120, 122,
00232 124, 127, 134, 136, 142, 149, 150, 152, 154, 155,
00233 157, 161, 163, 167, 169, 171, 175, 177, 179, 181,
00234 188, 190, 192, 196, 200, 202, 204, 209, 212, 214,
00235 218, 222, 226, 230, 234, 238, 242, 246, 250, 254,
00236 258, 262, 266, 269, 272, 274, 276, 278, 280, 282,
00237 286, 289, 292, 296, 298, 302, 304, 308, 313, 318,
00238 322, 326, 331, 334, 336, 343, 345, 349, 351, 353,
00239 355, 357, 361, 363, 367
00240 };
00241 static const short yyrhs[] =
00242 {
00243 69, 72, 75, 85, 0, 70, 0, 0, 71, 0,
00244 70, 71, 0, 9, 5, 0, 1, 0, 73, 0,
00245 0, 74, 0, 73, 74, 0, 3, 90, 0, 76,
00246 0, 75, 76, 0, 77, 8, 4, 55, 4, 57,
00247 4, 56, 78, 0, 77, 8, 4, 78, 0, 10,
00248 0, 0, 11, 79, 12, 0, 1, 0, 80, 0,
00249 79, 57, 80, 0, 4, 58, 82, 81, 0, 4,
00250 52, 58, 15, 55, 6, 56, 66, 55, 6, 56,
00251 0, 1, 0, 49, 95, 0, 0, 95, 83, 0,
00252 84, 0, 1, 0, 13, 0, 14, 0, 1, 0,
00253 15, 55, 7, 56, 0, 15, 55, 5, 56, 0,
00254 15, 55, 6, 56, 0, 16, 55, 6, 56, 0,
00255 1, 0, 86, 0, 85, 86, 0, 17, 4, 89,
00256 11, 92, 12, 0, 1, 0, 19, 90, 58, 91,
00257 81, 0, 88, 20, 90, 58, 91, 81, 0, 0,
00258 1, 0, 18, 0, 0, 87, 0, 89, 59, 87,
00259 0, 4, 0, 90, 57, 4, 0, 1, 0, 21,
00260 0, 7, 62, 7, 0, 22, 0, 23, 0, 24,
00261 0, 25, 53, 7, 54, 26, 91, 0, 1, 0,
00262 93, 0, 92, 52, 93, 0, 94, 60, 99, 0,
00263 1, 0, 95, 0, 27, 4, 28, 4, 0, 29,
00264 4, 0, 1, 0, 55, 95, 56, 0, 95, 49,
00265 95, 0, 95, 51, 95, 0, 95, 50, 95, 0,
00266 95, 48, 95, 0, 95, 47, 95, 0, 95, 46,
00267 95, 0, 95, 44, 95, 0, 95, 43, 95, 0,
00268 95, 39, 95, 0, 95, 40, 95, 0, 95, 41,
00269 95, 0, 95, 42, 95, 0, 45, 95, 0, 40,
00270 95, 0, 96, 0, 97, 0, 4, 0, 7, 0,
00271 5, 0, 4, 61, 4, 0, 4, 98, 0, 97,
00272 98, 0, 53, 95, 54, 0, 100, 0, 99, 59,
00273 100, 0, 30, 0, 101, 63, 103, 0, 27, 4,
00274 28, 4, 0, 31, 4, 32, 4, 0, 33, 104,
00275 34, 0, 35, 105, 36, 0, 37, 4, 38, 95,
00276 0, 65, 4, 0, 66, 0, 4, 61, 4, 55,
00277 103, 56, 0, 102, 0, 101, 57, 102, 0, 4,
00278 0, 96, 0, 97, 0, 95, 0, 103, 57, 95,
00279 0, 105, 0, 104, 52, 105, 0, 95, 60, 99,
00280 0
00281 };
00282
00283 #endif
00284
00285 #if YYDEBUG
00286
00287 static const short yyrline[] =
00288 {
00289 0, 222, 230, 231, 235, 240, 247, 254, 259, 260,
00290 264, 268, 275, 283, 284, 289, 295, 304, 305, 310,
00291 311, 316, 317, 322, 328, 333, 338, 339, 344, 349,
00292 355, 360, 361, 362, 365, 371, 376, 381, 387, 392,
00293 396, 403, 409, 414, 418, 423, 424, 427, 428, 433,
00294 437, 446, 452, 459, 464, 465, 466, 467, 468, 469,
00295 470, 475, 476, 484, 485, 490, 491, 500, 506, 511,
00296 513, 516, 519, 522, 525, 528, 531, 534, 537, 540,
00297 543, 546, 549, 551, 553, 554, 555, 556, 557, 562,
00298 571, 572, 577, 582, 583, 588, 589, 590, 596, 602,
00299 603, 604, 605, 610, 612, 623, 624, 633, 634, 635,
00300 640, 641, 650, 651, 659
00301 };
00302 #endif
00303
00304
00305 #if (YYDEBUG) || defined YYERROR_VERBOSE
00306
00307
00308 static const char *const yytname[] =
00309 {
00310 "$", "error", "$undefined.", "tBEHAVIOR", "tID", "tSTRING", "tTERMSTRING",
00311 "tNUMBER", "tMESSAGE", "tIMPORT", "tEXTERNAL", "tBEGIN", "tEND",
00312 "tBITS", "tBYTES", "tSTRTYPE", "tBLANKS", "tPROCESS", "tGLOBAL",
00313 "tCONST", "tVAR", "tINTEGER", "tADDRESS", "tCLIENTADDRESS",
00314 "tSERVERADDRESS", "tARRAY", "tOF", "tRCV", "tFROM", "tTIMEOUT", "tSKIP",
00315 "tSEND", "tTO", "tIF", "tFI", "tDO", "tOD", "tACT", "tIN", "tPLUS",
00316 "tMINUS", "tTIMES", "tDIVIDE", "tBAND", "tBOR", "tNEG", "tDIFFERENT",
00317 "tLTE", "tGTE", "tEQUAL", "tLT", "tGT", "tGUARD", "tLBRACKET",
00318 "tRBRACKET", "tLPAR", "tRPAR", "tCOMMA", "tCOLON", "tSCOLON", "tACTION",
00319 "tDOT", "tRANGE", "tASSIGN", "tDQUOTE", "tSTART", "tSTOP", "UMINUS",
00320 "Program", "Imports", "ReallyImport", "Import", "Behaviors",
00321 "RealBehavior", "Behavior", "Messages", "Message", "External",
00322 "MessageBody", "Fields", "Field", "Init", "FieldType", "BitByte",
00323 "StrType", "Processes", "RealProcess", "DeclarationTypes", "Global",
00324 "Declarations", "IDs", "Type", "Actions", "Action", "GuardedAction",
00325 "Expression", "FieldReference", "ArrayReference", "ArrayPosition",
00326 "Statements", "Statement", "LeftSides", "LeftSide", "Expressions",
00327 "GuardedStatements", "GuardedStatement", 0
00328 };
00329 #endif
00330
00331
00332 static const short yyr1[] =
00333 {
00334 0, 68, 69, 69, 70, 70, 71, 71, 72, 72,
00335 73, 73, 74, 75, 75, 76, 76, 77, 77, 78,
00336 78, 79, 79, 80, 80, 80, 81, 81, 82, 82,
00337 82, 83, 83, 83, 84, 84, 84, 84, 84, 85,
00338 85, 86, 86, 87, 87, 87, 87, 88, 88, 89,
00339 89, 90, 90, 90, 91, 91, 91, 91, 91, 91,
00340 91, 92, 92, 93, 93, 94, 94, 94, 94, 95,
00341 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
00342 95, 95, 95, 95, 95, 95, 95, 95, 95, 96,
00343 97, 97, 98, 99, 99, 100, 100, 100, 100, 100,
00344 100, 100, 100, 100, 100, 101, 101, 102, 102, 102,
00345 103, 103, 104, 104, 105
00346 };
00347
00348
00349 static const short yyr2[] =
00350 {
00351 0, 4, 1, 0, 1, 2, 2, 1, 1, 0,
00352 1, 2, 2, 1, 2, 9, 4, 1, 0, 3,
00353 1, 1, 3, 4, 11, 1, 2, 0, 2, 1,
00354 1, 1, 1, 1, 4, 4, 4, 4, 1, 1,
00355 2, 6, 1, 5, 6, 0, 1, 1, 0, 1,
00356 3, 1, 3, 1, 1, 3, 1, 1, 1, 6,
00357 1, 1, 3, 3, 1, 1, 4, 2, 1, 3,
00358 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
00359 3, 3, 2, 2, 1, 1, 1, 1, 1, 3,
00360 2, 2, 3, 1, 3, 1, 3, 4, 4, 3,
00361 3, 4, 2, 1, 6, 1, 3, 1, 1, 1,
00362 1, 3, 1, 3, 3
00363 };
00364
00365
00366
00367
00368 static const short yydefact[] =
00369 {
00370 0, 7, 0, 9, 0, 4, 6, 0, 18, 8,
00371 10, 5, 53, 51, 12, 17, 0, 13, 0, 11,
00372 0, 42, 0, 14, 0, 39, 0, 52, 0, 40,
00373 0, 46, 47, 0, 49, 0, 0, 20, 0, 0,
00374 16, 0, 0, 0, 0, 25, 0, 0, 21, 0,
00375 0, 0, 64, 86, 88, 87, 0, 0, 0, 0,
00376 0, 0, 61, 0, 65, 84, 85, 50, 0, 0,
00377 19, 0, 0, 60, 0, 54, 56, 57, 58, 0,
00378 27, 0, 0, 0, 90, 0, 67, 83, 82, 0,
00379 41, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00380 0, 0, 0, 0, 0, 91, 0, 30, 0, 0,
00381 27, 29, 0, 22, 0, 0, 0, 0, 43, 27,
00382 0, 89, 0, 69, 62, 107, 0, 95, 0, 0,
00383 0, 0, 0, 103, 108, 109, 63, 93, 0, 105,
00384 78, 79, 80, 81, 77, 76, 75, 74, 73, 70,
00385 72, 71, 0, 0, 0, 23, 33, 31, 32, 28,
00386 0, 55, 0, 26, 44, 92, 66, 0, 0, 0,
00387 0, 0, 112, 0, 0, 102, 0, 0, 0, 0,
00388 0, 0, 0, 0, 15, 0, 89, 0, 0, 0,
00389 99, 0, 100, 0, 94, 107, 106, 110, 96, 0,
00390 35, 36, 34, 37, 0, 0, 97, 98, 114, 113,
00391 101, 0, 0, 59, 0, 111, 0, 104, 0, 0,
00392 24, 0, 0, 0
00393 };
00394
00395 static const short yydefgoto[] =
00396 {
00397 221, 3, 4, 5, 8, 9, 10, 16, 17, 18,
00398 40, 47, 48, 118, 110, 159, 111, 24, 25, 34,
00399 35, 36, 14, 80, 61, 62, 63, 170, 65, 66,
00400 84, 136, 137, 138, 139, 198, 171, 172
00401 };
00402
00403 static const short yypact[] =
00404 {
00405 109,-32768, 20, 44, 113,-32768,-32768, 69, 73, 44,
00406 -32768,-32768,-32768,-32768, -46,-32768, 83,-32768, 77,-32768,
00407 86,-32768, 90,-32768, 12,-32768, 93,-32768, 22,-32768,
00408 7,-32768,-32768, 69,-32768, 85, 10,-32768, 74, 99,
00409 -32768, 6, 69, 75, 22,-32768, -9, 8,-32768, 56,
00410 133, 71, 81, -31,-32768,-32768, 139, 141, 104, 104,
00411 104, -6,-32768, 82, 200,-32768, 94,-32768, 95, 91,
00412 -32768, 74, 144,-32768, 98,-32768,-32768,-32768,-32768, 108,
00413 118, 133, 104, 165,-32768, 148,-32768,-32768, 124, 166,
00414 -32768, 75, 1, 104, 104, 104, 104, 104, 104, 104,
00415 104, 104, 104, 104, 104,-32768, 168,-32768, 149, 163,
00416 118,-32768, 138,-32768, 140, 196, 212, 104,-32768, 118,
00417 184,-32768, 216,-32768,-32768, -16, 217,-32768, 225, 104,
00418 104, 232, 233,-32768,-32768, 94, 186,-32768, 14,-32768,
00419 96, 96,-32768,-32768, 213, 213, 226, 226, 226, 226,
00420 226, 226, 203, 120, 263,-32768,-32768,-32768,-32768,-32768,
00421 13,-32768, 224, 200,-32768,-32768,-32768, 266, 243, 247,
00422 151, -25,-32768, 244, 245,-32768, 1, 277, 104, 276,
00423 228, 229, 230, 231,-32768, 262, 234, 286, 287, 1,
00424 -32768, 104,-32768, 104,-32768, -31,-32768, 200, 235, 237,
00425 -32768,-32768,-32768,-32768, 133, 104,-32768,-32768, 186,-32768,
00426 200, 104, 236,-32768, 76, 200, 239,-32768, 289, 240,
00427 -32768, 297, 298,-32768
00428 };
00429
00430 static const short yypgoto[] =
00431 {
00432 -32768,-32768,-32768, 295,-32768,-32768, 291,-32768, 285,-32768,
00433 143,-32768, 238, -100,-32768,-32768,-32768,-32768, 280, 261,
00434 -32768,-32768, 2, -80,-32768, 215,-32768, -43, -90, -88,
00435 -63, 119, 131,-32768, 134, 105,-32768, -123
00436 };
00437
00438
00439 #define YYLAST 311
00440
00441
00442 static const short yytable[] =
00443 {
00444 64, 119, 134, 105, 135, 125, 90, 173, 37, 190,
00445 155, 20, -1, 21, 37, 87, 88, 89, 38, 164,
00446 70, 43, 82, 31, 38, 6, 112, 191, 126, 22,
00447 83, 127, 128, -45, 129, 41, 130, 82, 131, 120,
00448 32, 33, -48, 68, 51, 167, 91, 7, 64, 69,
00449 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
00450 150, 151, 39, 20, 50, 71, 132, 133, 209, 44,
00451 12, 177, 105, 13, 163, 45, 52, 178, 46, 53,
00452 54, -45, 55, 15, 21, 26, 134, 134, 135, 135,
00453 27, -18, 107, 15, 28, 53, 54, 30, 55, 134,
00454 22, 135, 56, 49, 57, 42, 108, 109, 53, 54,
00455 1, 55, -3, 72, 1, 58, -2, -3, 2, -3,
00456 59, -2, 2, -2, 213, 180, 181, 182, 20, 81,
00457 60, 58, 217, 211, 73, 197, 59, 95, 96, 156,
00458 74, -68, 92, 85, 58, 86, 60, 82, 114, 59,
00459 210, 157, 158, 106, 75, 76, 77, 78, 79, 60,
00460 115, 116, 197, 93, 94, 95, 96, 117, 215, 121,
00461 99, 100, 101, 102, 103, 104, 122, 93, 94, 95,
00462 96, 97, 98, 152, 99, 100, 101, 102, 103, 104,
00463 93, 94, 95, 96, 97, 98, 160, 99, 100, 101,
00464 102, 103, 104, 161, 153, 93, 94, 95, 96, 97,
00465 98, 189, 99, 100, 101, 102, 103, 104, 154, 162,
00466 166, 168, 123, 93, 94, 95, 96, 97, 98, 169,
00467 99, 100, 101, 102, 103, 104, 174, 175, 165, 93,
00468 94, 95, 96, 97, 98, 176, 99, 100, 101, 102,
00469 103, 104, 93, 94, 95, 96,-32768,-32768, 179, 99,
00470 100, 101, 102, 103, 104, 93, 94, 95, 96, 183,
00471 186, 187,-32768,-32768,-32768,-32768,-32768,-32768, 185, 188,
00472 192, 195, 199, 193, 200, 201, 202, 203, 204, 205,
00473 206, 207, 211, 212, 218, 219, 220, 222, 223, 11,
00474 19, 23, 216, 184, 29, 67, 124, 194, 208, 113,
00475 214, 196
00476 };
00477
00478 static const short yycheck[] =
00479 {
00480 43, 81, 92, 66, 92, 4, 12, 130, 1, 34,
00481 110, 57, 0, 1, 1, 58, 59, 60, 11, 119,
00482 12, 11, 53, 1, 11, 5, 69, 52, 27, 17,
00483 61, 30, 31, 11, 33, 33, 35, 53, 37, 82,
00484 18, 19, 20, 52, 42, 61, 52, 3, 91, 58,
00485 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
00486 103, 104, 55, 57, 58, 57, 65, 66, 191, 59,
00487 1, 57, 135, 4, 117, 1, 1, 63, 4, 4,
00488 5, 59, 7, 10, 1, 8, 176, 177, 176, 177,
00489 4, 8, 1, 10, 4, 4, 5, 4, 7, 189,
00490 17, 189, 27, 4, 29, 20, 15, 16, 4, 5,
00491 1, 7, 3, 57, 1, 40, 3, 8, 9, 10,
00492 45, 8, 9, 10, 204, 5, 6, 7, 57, 58,
00493 55, 40, 56, 57, 1, 178, 45, 41, 42, 1,
00494 7, 60, 60, 4, 40, 4, 55, 53, 4, 45,
00495 193, 13, 14, 58, 21, 22, 23, 24, 25, 55,
00496 62, 53, 205, 39, 40, 41, 42, 49, 211, 4,
00497 46, 47, 48, 49, 50, 51, 28, 39, 40, 41,
00498 42, 43, 44, 15, 46, 47, 48, 49, 50, 51,
00499 39, 40, 41, 42, 43, 44, 56, 46, 47, 48,
00500 49, 50, 51, 7, 55, 39, 40, 41, 42, 43,
00501 44, 60, 46, 47, 48, 49, 50, 51, 55, 7,
00502 4, 4, 56, 39, 40, 41, 42, 43, 44, 4,
00503 46, 47, 48, 49, 50, 51, 4, 4, 54, 39,
00504 40, 41, 42, 43, 44, 59, 46, 47, 48, 49,
00505 50, 51, 39, 40, 41, 42, 43, 44, 55, 46,
00506 47, 48, 49, 50, 51, 39, 40, 41, 42, 6,
00507 4, 28, 46, 47, 48, 49, 50, 51, 54, 32,
00508 36, 4, 6, 38, 56, 56, 56, 56, 26, 55,
00509 4, 4, 57, 56, 55, 6, 56, 0, 0, 4,
00510 9, 16, 66, 160, 24, 44, 91, 176, 189, 71,
00511 205, 177
00512 };
00513
00514 #line 3 "/usr/share/bison/bison.simple"
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
00554
00555
00556
00557 # if YYSTACK_USE_ALLOCA
00558 # define YYSTACK_ALLOC alloca
00559 # else
00560 # ifndef YYSTACK_USE_ALLOCA
00561 # if defined (alloca) || defined (_ALLOCA_H)
00562 # define YYSTACK_ALLOC alloca
00563 # else
00564 # ifdef __GNUC__
00565 # define YYSTACK_ALLOC __builtin_alloca
00566 # endif
00567 # endif
00568 # endif
00569 # endif
00570
00571 # ifdef YYSTACK_ALLOC
00572
00573 # define YYSTACK_FREE(Ptr) do { ; } while (0)
00574 # else
00575 # if defined (__STDC__) || defined (__cplusplus)
00576 # include <stdlib.h>
00577 # define YYSIZE_T size_t
00578 # endif
00579 # define YYSTACK_ALLOC malloc
00580 # define YYSTACK_FREE free
00581 # endif
00582 #endif
00583
00584
00585 #if (! defined (yyoverflow) \
00586 && (! defined (__cplusplus) \
00587 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00588
00589
00590 union yyalloc
00591 {
00592 short yyss;
00593 YYSTYPE yyvs;
00594 # if YYLSP_NEEDED
00595 YYLTYPE yyls;
00596 # endif
00597 };
00598
00599
00600 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
00601
00602
00603
00604 # if YYLSP_NEEDED
00605 # define YYSTACK_BYTES(N) \
00606 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
00607 + 2 * YYSTACK_GAP_MAX)
00608 # else
00609 # define YYSTACK_BYTES(N) \
00610 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
00611 + YYSTACK_GAP_MAX)
00612 # endif
00613
00614
00615
00616 # ifndef YYCOPY
00617 # if 1 < __GNUC__
00618 # define YYCOPY(To, From, Count) \
00619 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00620 # else
00621 # define YYCOPY(To, From, Count) \
00622 do \
00623 { \
00624 register YYSIZE_T yyi; \
00625 for (yyi = 0; yyi < (Count); yyi++) \
00626 (To)[yyi] = (From)[yyi]; \
00627 } \
00628 while (0)
00629 # endif
00630 # endif
00631
00632
00633
00634
00635
00636
00637 # define YYSTACK_RELOCATE(Stack) \
00638 do \
00639 { \
00640 YYSIZE_T yynewbytes; \
00641 YYCOPY (&yyptr->Stack, Stack, yysize); \
00642 Stack = &yyptr->Stack; \
00643 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
00644 yyptr += yynewbytes / sizeof (*yyptr); \
00645 } \
00646 while (0)
00647
00648 #endif
00649
00650
00651 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00652 # define YYSIZE_T __SIZE_TYPE__
00653 #endif
00654 #if ! defined (YYSIZE_T) && defined (size_t)
00655 # define YYSIZE_T size_t
00656 #endif
00657 #if ! defined (YYSIZE_T)
00658 # if defined (__STDC__) || defined (__cplusplus)
00659 # include <stddef.h>
00660 # define YYSIZE_T size_t
00661 # endif
00662 #endif
00663 #if ! defined (YYSIZE_T)
00664 # define YYSIZE_T unsigned int
00665 #endif
00666
00667 #define yyerrok (yyerrstatus = 0)
00668 #define yyclearin (yychar = YYEMPTY)
00669 #define YYEMPTY -2
00670 #define YYEOF 0
00671 #define YYACCEPT goto yyacceptlab
00672 #define YYABORT goto yyabortlab
00673 #define YYERROR goto yyerrlab1
00674
00675
00676
00677 #define YYFAIL goto yyerrlab
00678 #define YYRECOVERING() (!!yyerrstatus)
00679 #define YYBACKUP(Token, Value) \
00680 do \
00681 if (yychar == YYEMPTY && yylen == 1) \
00682 { \
00683 yychar = (Token); \
00684 yylval = (Value); \
00685 yychar1 = YYTRANSLATE (yychar); \
00686 YYPOPSTACK; \
00687 goto yybackup; \
00688 } \
00689 else \
00690 { \
00691 yyerror ("syntax error: cannot back up"); \
00692 YYERROR; \
00693 } \
00694 while (0)
00695
00696 #define YYTERROR 1
00697 #define YYERRCODE 256
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707 #ifndef YYLLOC_DEFAULT
00708 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00709 Current.last_line = Rhs[N].last_line; \
00710 Current.last_column = Rhs[N].last_column;
00711 #endif
00712
00713
00714
00715
00716 #if YYPURE
00717 # if YYLSP_NEEDED
00718 # ifdef YYLEX_PARAM
00719 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
00720 # else
00721 # define YYLEX yylex (&yylval, &yylloc)
00722 # endif
00723 # else
00724 # ifdef YYLEX_PARAM
00725 # define YYLEX yylex (&yylval, YYLEX_PARAM)
00726 # else
00727 # define YYLEX yylex (&yylval)
00728 # endif
00729 # endif
00730 #else
00731 # define YYLEX yylex()
00732 #endif
00733
00734
00735
00736 #if YYDEBUG
00737
00738 # ifndef YYFPRINTF
00739 # include <stdio.h>
00740 # define YYFPRINTF fprintf
00741 # endif
00742
00743 # define YYDPRINTF(Args) \
00744 do { \
00745 if (yydebug) \
00746 YYFPRINTF Args; \
00747 } while (0)
00748
00749
00750 int yydebug;
00751 #else
00752 # define YYDPRINTF(Args)
00753 #endif
00754
00755
00756 #ifndef YYINITDEPTH
00757 # define YYINITDEPTH 200
00758 #endif
00759
00760
00761
00762
00763
00764
00765
00766
00767 #if YYMAXDEPTH == 0
00768 # undef YYMAXDEPTH
00769 #endif
00770
00771 #ifndef YYMAXDEPTH
00772 # define YYMAXDEPTH 10000
00773 #endif
00774
00775 #ifdef YYERROR_VERBOSE
00776
00777 # ifndef yystrlen
00778 # if defined (__GLIBC__) && defined (_STRING_H)
00779 # define yystrlen strlen
00780 # else
00781
00782 static YYSIZE_T
00783 # if defined (__STDC__) || defined (__cplusplus)
00784 yystrlen (const char *yystr)
00785 # else
00786 yystrlen (yystr)
00787 const char *yystr;
00788 # endif
00789 {
00790 register const char *yys = yystr;
00791
00792 while (*yys++ != '\0')
00793 continue;
00794
00795 return yys - yystr - 1;
00796 }
00797 # endif
00798 # endif
00799
00800 # ifndef yystpcpy
00801 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00802 # define yystpcpy stpcpy
00803 # else
00804
00805
00806 static char *
00807 # if defined (__STDC__) || defined (__cplusplus)
00808 yystpcpy (char *yydest, const char *yysrc)
00809 # else
00810 yystpcpy (yydest, yysrc)
00811 char *yydest;
00812 const char *yysrc;
00813 # endif
00814 {
00815 register char *yyd = yydest;
00816 register const char *yys = yysrc;
00817
00818 while ((*yyd++ = *yys++) != '\0')
00819 continue;
00820
00821 return yyd - 1;
00822 }
00823 # endif
00824 # endif
00825 #endif
00826
00827 #line 315 "/usr/share/bison/bison.simple"
00828
00829
00830
00831
00832
00833
00834
00835
00836 #ifdef YYPARSE_PARAM
00837 # if defined (__STDC__) || defined (__cplusplus)
00838 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00839 # define YYPARSE_PARAM_DECL
00840 # else
00841 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
00842 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00843 # endif
00844 #else
00845 # define YYPARSE_PARAM_ARG
00846 # define YYPARSE_PARAM_DECL
00847 #endif
00848
00849
00850 #ifdef __GNUC__
00851 # ifdef YYPARSE_PARAM
00852 int yyparse (void *);
00853 # else
00854 int yyparse (void);
00855 # endif
00856 #endif
00857
00858
00859
00860
00861 #define YY_DECL_NON_LSP_VARIABLES \
00862 \
00863 int yychar; \
00864 \
00865 YYSTYPE yylval; \
00866 \
00867 \
00868 int yynerrs;
00869
00870 #if YYLSP_NEEDED
00871 # define YY_DECL_VARIABLES \
00872 YY_DECL_NON_LSP_VARIABLES \
00873 \
00874 \
00875 YYLTYPE yylloc;
00876 #else
00877 # define YY_DECL_VARIABLES \
00878 YY_DECL_NON_LSP_VARIABLES
00879 #endif
00880
00881
00882
00883
00884 #if !YYPURE
00885 YY_DECL_VARIABLES
00886 #endif
00887
00888 int
00889 yyparse (YYPARSE_PARAM_ARG)
00890 YYPARSE_PARAM_DECL
00891 {
00892
00893 #if YYPURE
00894 YY_DECL_VARIABLES
00895 #endif
00896
00897 register int yystate;
00898 register int yyn;
00899 int yyresult;
00900
00901 int yyerrstatus;
00902
00903 int yychar1 = 0;
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914 short yyssa[YYINITDEPTH];
00915 short *yyss = yyssa;
00916 register short *yyssp;
00917
00918
00919 YYSTYPE yyvsa[YYINITDEPTH];
00920 YYSTYPE *yyvs = yyvsa;
00921 register YYSTYPE *yyvsp;
00922
00923 #if YYLSP_NEEDED
00924
00925 YYLTYPE yylsa[YYINITDEPTH];
00926 YYLTYPE *yyls = yylsa;
00927 YYLTYPE *yylsp;
00928 #endif
00929
00930 #if YYLSP_NEEDED
00931 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
00932 #else
00933 # define YYPOPSTACK (yyvsp--, yyssp--)
00934 #endif
00935
00936 YYSIZE_T yystacksize = YYINITDEPTH;
00937
00938
00939
00940
00941 YYSTYPE yyval;
00942 #if YYLSP_NEEDED
00943 YYLTYPE yyloc;
00944 #endif
00945
00946
00947
00948 int yylen;
00949
00950 YYDPRINTF ((stderr, "Starting parse\n"));
00951
00952 yystate = 0;
00953 yyerrstatus = 0;
00954 yynerrs = 0;
00955 yychar = YYEMPTY;
00956
00957
00958
00959
00960
00961
00962 yyssp = yyss;
00963 yyvsp = yyvs;
00964 #if YYLSP_NEEDED
00965 yylsp = yyls;
00966 #endif
00967 goto yysetstate;
00968
00969
00970
00971
00972 yynewstate:
00973
00974
00975
00976 yyssp++;
00977
00978 yysetstate:
00979 *yyssp = yystate;
00980
00981 if (yyssp >= yyss + yystacksize - 1)
00982 {
00983
00984 YYSIZE_T yysize = yyssp - yyss + 1;
00985
00986 #ifdef yyoverflow
00987 {
00988
00989
00990
00991 YYSTYPE *yyvs1 = yyvs;
00992 short *yyss1 = yyss;
00993
00994
00995
00996 # if YYLSP_NEEDED
00997 YYLTYPE *yyls1 = yyls;
00998
00999
01000 yyoverflow ("parser stack overflow",
01001 &yyss1, yysize * sizeof (*yyssp),
01002 &yyvs1, yysize * sizeof (*yyvsp),
01003 &yyls1, yysize * sizeof (*yylsp),
01004 &yystacksize);
01005 yyls = yyls1;
01006 # else
01007 yyoverflow ("parser stack overflow",
01008 &yyss1, yysize * sizeof (*yyssp),
01009 &yyvs1, yysize * sizeof (*yyvsp),
01010 &yystacksize);
01011 # endif
01012 yyss = yyss1;
01013 yyvs = yyvs1;
01014 }
01015 #else
01016 # ifndef YYSTACK_RELOCATE
01017 goto yyoverflowlab;
01018 # else
01019
01020 if (yystacksize >= YYMAXDEPTH)
01021 goto yyoverflowlab;
01022 yystacksize *= 2;
01023 if (yystacksize > YYMAXDEPTH)
01024 yystacksize = YYMAXDEPTH;
01025
01026 {
01027 short *yyss1 = yyss;
01028 union yyalloc *yyptr =
01029 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01030 if (! yyptr)
01031 goto yyoverflowlab;
01032 YYSTACK_RELOCATE (yyss);
01033 YYSTACK_RELOCATE (yyvs);
01034 # if YYLSP_NEEDED
01035 YYSTACK_RELOCATE (yyls);
01036 # endif
01037 # undef YYSTACK_RELOCATE
01038 if (yyss1 != yyssa)
01039 YYSTACK_FREE (yyss1);
01040 }
01041 # endif
01042 #endif
01043
01044 yyssp = yyss + yysize - 1;
01045 yyvsp = yyvs + yysize - 1;
01046 #if YYLSP_NEEDED
01047 yylsp = yyls + yysize - 1;
01048 #endif
01049
01050 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01051 (unsigned long int) yystacksize));
01052
01053 if (yyssp >= yyss + yystacksize - 1)
01054 YYABORT;
01055 }
01056
01057 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01058
01059 goto yybackup;
01060
01061
01062
01063
01064
01065 yybackup:
01066
01067
01068
01069
01070
01071
01072
01073 yyn = yypact[yystate];
01074 if (yyn == YYFLAG)
01075 goto yydefault;
01076
01077
01078
01079
01080
01081
01082 if (yychar == YYEMPTY)
01083 {
01084 YYDPRINTF ((stderr, "Reading a token: "));
01085 yychar = YYLEX;
01086 }
01087
01088
01089
01090 if (yychar <= 0)
01091 {
01092 yychar1 = 0;
01093 yychar = YYEOF;
01094
01095 YYDPRINTF ((stderr, "Now at end of input.\n"));
01096 }
01097 else
01098 {
01099 yychar1 = YYTRANSLATE (yychar);
01100
01101 #if YYDEBUG
01102
01103
01104 if (yydebug)
01105 {
01106 YYFPRINTF (stderr, "Next token is %d (%s",
01107 yychar, yytname[yychar1]);
01108
01109
01110 # ifdef YYPRINT
01111 YYPRINT (stderr, yychar, yylval);
01112 # endif
01113 YYFPRINTF (stderr, ")\n");
01114 }
01115 #endif
01116 }
01117
01118 yyn += yychar1;
01119 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
01120 goto yydefault;
01121
01122 yyn = yytable[yyn];
01123
01124
01125
01126
01127
01128
01129
01130
01131 if (yyn < 0)
01132 {
01133 if (yyn == YYFLAG)
01134 goto yyerrlab;
01135 yyn = -yyn;
01136 goto yyreduce;
01137 }
01138 else if (yyn == 0)
01139 goto yyerrlab;
01140
01141 if (yyn == YYFINAL)
01142 YYACCEPT;
01143
01144
01145 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
01146 yychar, yytname[yychar1]));
01147
01148
01149 if (yychar != YYEOF)
01150 yychar = YYEMPTY;
01151
01152 *++yyvsp = yylval;
01153 #if YYLSP_NEEDED
01154 *++yylsp = yylloc;
01155 #endif
01156
01157
01158
01159 if (yyerrstatus)
01160 yyerrstatus--;
01161
01162 yystate = yyn;
01163 goto yynewstate;
01164
01165
01166
01167
01168
01169 yydefault:
01170 yyn = yydefact[yystate];
01171 if (yyn == 0)
01172 goto yyerrlab;
01173 goto yyreduce;
01174
01175
01176
01177
01178
01179 yyreduce:
01180
01181 yylen = yyr2[yyn];
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191 yyval = yyvsp[1-yylen];
01192
01193 #if YYLSP_NEEDED
01194
01195
01196 yyloc = yylsp[1-yylen];
01197 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
01198 #endif
01199
01200 #if YYDEBUG
01201
01202
01203 if (yydebug)
01204 {
01205 int yyi;
01206
01207 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
01208 yyn, yyrline[yyn]);
01209
01210
01211 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
01212 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
01213 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
01214 }
01215 #endif
01216
01217 switch (yyn) {
01218
01219 case 1:
01220 #line 223 "protomake.y"
01221 {
01222 root = new Program(new SrcPosition(1), yyvsp[-3].import, yyvsp[-2].behavior, yyvsp[-1].message, yyvsp[0].proc);
01223 ;
01224 break;}
01225 case 2:
01226 #line 230 "protomake.y"
01227 { yyval.import = yyvsp[0].import; ;
01228 break;}
01229 case 3:
01230 #line 231 "protomake.y"
01231 { yyval.import = NULL; ;
01232 break;}
01233 case 4:
01234 #line 236 "protomake.y"
01235 {
01237 yyval.import = yyvsp[0].simpImp;
01238 ;
01239 break;}
01240 case 5:
01241 #line 241 "protomake.y"
01242 {
01243 yyval.import = new SequentialImport(yyvsp[0].simpImp->getPosition(), yyvsp[-1].import, yyvsp[0].simpImp);
01244 ;
01245 break;}
01246 case 6:
01247 #line 248 "protomake.y"
01248 {
01250 SrcPosition *srcPos = new SrcPosition(lines);
01251 StringLiteral *str = new StringLiteral(srcPos, yyvsp[0].string);
01252 yyval.simpImp = new SimpleImport(srcPos, str);
01253 ;
01254 break;}
01255 case 7:
01256 #line 254 "protomake.y"
01257 { yyerror("Import sintax error!"); ;
01258 break;}
01259 case 8:
01260 #line 259 "protomake.y"
01261 { yyval.behavior = yyvsp[0].behavior; ;
01262 break;}
01263 case 9:
01264 #line 260 "protomake.y"
01265 { yyval.behavior = NULL;
01266 break;}
01267 case 10:
01268 #line 265 "protomake.y"
01269 {
01270 yyval.behavior = yyvsp[0].simpBhv;
01271 ;
01272 break;}
01273 case 11:
01274 #line 269 "protomake.y"
01275 {
01276 yyval.behavior = new SequentialBehavior(yyvsp[0].simpBhv->getPosition(), yyvsp[-1].behavior, yyvsp[0].simpBhv);
01277 ;
01278 break;}
01279 case 12:
01280 #line 276 "protomake.y"
01281 {
01282 yyval.simpBhv = new SimpleBehavior(yyvsp[0].idLst->getPosition(), yyvsp[0].idLst);
01283 ;
01284 break;}
01285 case 13:
01286 #line 283 "protomake.y"
01287 { yyval.message = yyvsp[0].simpMsg; ;
01288 break;}
01289 case 14:
01290 #line 284 "protomake.y"
01291 { yyval.message = new SequentialMessage(yyvsp[0].simpMsg->getPosition(), yyvsp[-1].message, yyvsp[0].simpMsg); ;
01292 break;}
01293 case 15:
01294 #line 290 "protomake.y"
01295 {
01296 yyval.simpMsg = new SimpleMessage(yyvsp[0].fieldDcl->getPosition(), new Identifier(yyvsp[0].fieldDcl->getPosition(), yyvsp[-6].string),
01297 yyvsp[0].fieldDcl, new Identifier(yyvsp[0].fieldDcl->getPosition(), yyvsp[-4].string),
01298 new Identifier(yyvsp[0].fieldDcl->getPosition(), yyvsp[-2].string), yyvsp[-8].number);
01299 ;
01300 break;}
01301 case 16:
01302 #line 296 "protomake.y"
01303 {
01304 yyval.simpMsg = new SimpleMessage(yyvsp[0].fieldDcl->getPosition(), new Identifier(yyvsp[0].fieldDcl->getPosition(), yyvsp[-1].string),
01305 yyvsp[0].fieldDcl, NULL, NULL, yyvsp[-3].number);
01306 ;
01307 break;}
01308 case 17:
01309 #line 304 "protomake.y"
01310 { yyval.number = 1; ;
01311 break;}
01312 case 18:
01313 #line 305 "protomake.y"
01314 { yyval.number = 0 ;
01315 break;}
01316 case 19:
01317 #line 310 "protomake.y"
01318 { yyval.fieldDcl = yyvsp[-1].fieldDcl; ;
01319 break;}
01320 case 20:
01321 #line 311 "protomake.y"
01322 { yyerror("Message body sintax error!"); ;
01323 break;}
01324 case 21:
01325 #line 316 "protomake.y"
01326 { yyval.fieldDcl = yyvsp[0].simpFld; ;
01327 break;}
01328 case 22:
01329 #line 317 "protomake.y"
01330 { yyval.fieldDcl = new SequentialFieldDeclaration(yyvsp[0].simpFld->getPosition(), yyvsp[-2].fieldDcl, yyvsp[0].simpFld); ;
01331 break;}
01332 case 23:
01333 #line 323 "protomake.y"
01334 {
01335 Identifier *id = new Identifier(yyvsp[-3].string->getPosition(), yyvsp[-3].string);
01336 yyval.simpFld = new SimpleFieldDeclaration(yyvsp[-3].string->getPosition(), id, yyvsp[-2].number, yyvsp[-1].fieldTyp, yyvsp[0].exp);
01337 ;
01338 break;}
01339 case 24:
01340 #line 329 "protomake.y"
01341 {
01342
01343 yyval.simpFld = NULL
01344 ;
01345 break;}
01346 case 25:
01347 #line 333 "protomake.y"
01348 { yyerror("Field declaration sintax error!"); ;
01349 break;}
01350 case 26:
01351 #line 338 "protomake.y"
01352 { yyval.exp = yyvsp[0].exp; ;
01353 break;}
01354 case 27:
01355 #line 339 "protomake.y"
01356 { yyval.exp = NULL; ;
01357 break;}
01358 case 28:
01359 #line 345 "protomake.y"
01360 {
01361 yyval.fieldTyp = new FieldType(yyvsp[-1].exp->getPosition(), yyvsp[-1].exp, yyvsp[0].fType);
01362 ;
01363 break;}
01364 case 29:
01365 #line 350 "protomake.y"
01366 {
01367
01368 yyval.fieldTyp = NULL;
01369 ;
01370 break;}
01371 case 30:
01372 #line 355 "protomake.y"
01373 { yyerror("Field type sintaxe error!"); ;
01374 break;}
01375 case 31:
01376 #line 360 "protomake.y"
01377 { yyval.fType = FieldType::BIT; ;
01378 break;}
01379 case 32:
01380 #line 361 "protomake.y"
01381 { yyval.fType = FieldType::BYTE; ;
01382 break;}
01383 case 33:
01384 #line 362 "protomake.y"
01385 { yyerror("Undefined field type!"); ;
01386 break;}
01387 case 34:
01388 #line 366 "protomake.y"
01389 {
01390 yyval.fTypeInfo.fType = FieldType::STRN;
01391 yyval.fTypeInfo.info.number = yyvsp[-1].number;
01392 ;
01393 break;}
01394 case 35:
01395 #line 372 "protomake.y"
01396 {
01397 yyval.fTypeInfo.fType = FieldType::STRCTE;
01398 yyval.fTypeInfo.info.cteStr = yyvsp[-1].string;
01399 ;
01400 break;}
01401 case 36:
01402 #line 377 "protomake.y"
01403 {
01404 yyval.fTypeInfo.fType = FieldType::STRTERM;
01405 yyval.fTypeInfo.info.terminator = yyvsp[-1].string;
01406 ;
01407 break;}
01408 case 37:
01409 #line 382 "protomake.y"
01410 {
01411 yyval.fTypeInfo.fType = FieldType::BLANKS;
01412 yyval.fTypeInfo.info.blanks = yyvsp[-1].string;
01413 ;
01414 break;}
01415 case 38:
01416 #line 387 "protomake.y"
01417 { yyerror("Undefined field type!"); ;
01418 break;}
01419 case 39:
01420 #line 393 "protomake.y"
01421 {
01422 yyval.proc = yyvsp[0].simpProc;
01423 ;
01424 break;}
01425 case 40:
01426 #line 397 "protomake.y"
01427 {
01428 yyval.proc = new SequentialProcess(yyvsp[0].simpProc->getPosition(), yyvsp[-1].proc, yyvsp[0].simpProc);
01429 ;
01430 break;}
01431 case 41:
01432 #line 404 "protomake.y"
01433 {
01434
01435 yyval.simpProc = new SimpleProcess(yyvsp[-2].string->getPosition(),
01436 new Identifier(yyvsp[-2].string->getPosition(), yyvsp[-3].decl), yyvsp[-2].string, yyvsp[0].string, 0);
01437 ;
01438 break;}
01439 case 42:
01440 #line 409 "protomake.y"
01441 { yyerror("Process defenition sintax error!"); ;
01442 break;}
01443 case 43:
01444 #line 415 "protomake.y"
01445 {
01446 yyval.simpDecl = new SimpleDeclaration(new SrcPosition(lines), yyvsp[-3].idLst, yyvsp[-1].type, yyvsp[0].exp, true);
01447 ;
01448 break;}
01449 case 44:
01450 #line 419 "protomake.y"
01451 {
01452 yyval.simpDecl = new SimpleDeclaration(new SrcPosition(lines), yyvsp[-3].idLst, yyvsp[-1].type, yyvsp[0].exp, false, yyvsp[-5].number);
01453 ;
01454 break;}
01455 case 45:
01456 #line 423 "protomake.y"
01457 { yyval.simpDecl = NULL; ;
01458 break;}
01459 case 46:
01460 #line 424 "protomake.y"
01461 { yyerror("DeclarationType syntax error!"); ;
01462 break;}
01463 case 47:
01464 #line 427 "protomake.y"
01465 { yyval.number = 1;;
01466 break;}
01467 case 48:
01468 #line 428 "protomake.y"
01469 { yyval.number = 0;;
01470 break;}
01471 case 49:
01472 #line 434 "protomake.y"
01473 {
01474 yyval.decl = yyvsp[0].simpDecl;
01475 ;
01476 break;}
01477 case 50:
01478 #line 438 "protomake.y"
01479 {
01480 yyval.decl = new SequentialDeclaration(yyvsp[0].simpDecl->getPosition(), yyvsp[-2].decl, yyvsp[0].simpDecl);
01481 ;
01482 break;}
01483 case 51:
01484 #line 447 "protomake.y"
01485 {
01486 Identifier *identifier = new Identifier(new SrcPosition(lines), yyvsp[0].string);
01487 yyval.idLst = new SimpleIdentifierList(identifier->getPosition(), identifier);
01488 ;
01489 break;}
01490 case 52:
01491 #line 453 "protomake.y"
01492 {
01493 Identifier *identifier = new Identifier(new SrcPosition(lines), yyvsp[0].string);
01494 SimpleIdentifierList *simpIdList = new SimpleIdentifierList(identifier->getPosition(), identifier);
01495 yyval.idLst = new SequentialIdentifierList(identifier->getPosition(), yyvsp[-2].idLst, simpIdList);
01496 ;
01497 break;}
01498 case 53:
01499 #line 459 "protomake.y"
01500 { yyerror("Identifier list sintax error!"); ;
01501 break;}
01502 case 54:
01503 #line 464 "protomake.y"
01504 {yyval.type = new Type(new SrcPosition(lines), Type::INTEGER);;
01505 break;}
01506 case 55:
01507 #line 465 "protomake.y"
01508 { yyval.type = new RangeType(new SrcPosition(lines), Type::RANGE, yyvsp[-2].number, yyvsp[0].number); ;
01509 break;}
01510 case 56:
01511 #line 466 "protomake.y"
01512 { yyval.type = new Type(new SrcPosition(lines), Type::ADDRESS); ;
01513 break;}
01514 case 57:
01515 #line 467 "protomake.y"
01516 { yyval.type = new Type(new SrcPostion(lines), Type::CLIENTADDRESS); ;
01517 break;}
01518 case 58:
01519 #line 468 "protomake.y"
01520 { yyval.type = new Type(new SrcPostion(lines), Type::SERVERADDRESS); ;
01521 break;}
01522 case 59:
01523 #line 469 "protomake.y"
01524 {yyval.type = new ArrayType(new SrcPosition(lines), Type::ARRAY, yyvsp[0].type, yyvsp[-3].number);;
01525 break;}
01526 case 60:
01527 #line 470 "protomake.y"
01528 {yyerror("Undefined type!");;
01529 break;}
01530 case 61:
01531 #line 475 "protomake.y"
01532 {yyval.action = yyvsp[0].simpAct;;
01533 break;}
01534 case 62:
01535 #line 476 "protomake.y"
01536 {yyval.action = new SequentialAction(yyvsp[0].simpAct->getPosition(), yyvsp[-2].action, yyvsp[0].simpAct);;
01537 break;}
01538 case 63:
01539 #line 484 "protomake.y"
01540 {yyval.simpAct = new SimpleAction(yyvsp[-2].guard->getPosition(), yyvsp[-2].guard, yyvsp[0].stmt);;
01541 break;}
01542 case 64:
01543 #line 485 "protomake.y"
01544 {yyerror("Action syntax error!");;
01545 break;}
01546 case 65:
01547 #line 490 "protomake.y"
01548 { yyval.guard = new GuardExpression(yyvsp[0].exp->getPosition(), yyvsp[0].exp); ;
01549 break;}
01550 case 66:
01551 #line 492 "protomake.y"
01552 {
01553
01554 SrcPosition *pos = new SrcPosition(lines);
01555
01556 ReceiveStatement *rs = new ReceiveStatement(pos, new Identifier(pos, yyvsp[-2].string),
01557 new Identifier(pos, yyvsp[0].string), NULL);
01558 yyval.guard = new GuardReceive(pos, rs);
01559 ;
01560 break;}
01561 case 67:
01562 #line 501 "protomake.y"
01563 {
01564 SrcPosition *pos = new SrcPosition(lines);
01565
01566 yyval.guard = new GuardTimeout(pos, new Identifier(pos, yyvsp[0].string));
01567 ;
01568 break;}
01569 case 68:
01570 #line 506 "protomake.y"
01571 { yyerror("Invalid guard!"); ;
01572 break;}
01573 case 69:
01574 #line 511 "protomake.y"
01575 { yyval.exp = yyvsp[-1].exp; ;
01576 break;}
01577 case 70:
01578 #line 514 "protomake.y"
01579 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01580 break;}
01581 case 71:
01582 #line 517 "protomake.y"
01583 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01584 break;}
01585 case 72:
01586 #line 520 "protomake.y"
01587 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01588 break;}
01589 case 73:
01590 #line 523 "protomake.y"
01591 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01592 break;}
01593 case 74:
01594 #line 526 "protomake.y"
01595 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01596 break;}
01597 case 75:
01598 #line 529 "protomake.y"
01599 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01600 break;}
01601 case 76:
01602 #line 532 "protomake.y"
01603 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01604 break;}
01605 case 77:
01606 #line 535 "protomake.y"
01607 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01608 break;}
01609 case 78:
01610 #line 538 "protomake.y"
01611 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01612 break;}
01613 case 79:
01614 #line 541 "protomake.y"
01615 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01616 break;}
01617 case 80:
01618 #line 544 "protomake.y"
01619 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01620 break;}
01621 case 81:
01622 #line 547 "protomake.y"
01623 { yyval.exp = new BinaryExpression(new SrcPosition(lines), yyvsp[-2].exp, yyvsp[0].exp, yyvsp[-1].string); ;
01624 break;}
01625 case 82:
01626 #line 549 "protomake.y"
01627 { yyval.exp = new UnaryExpression(new SrcPosition(lines), yyvsp[0].exp, yyvsp[-1].string); ;
01628 break;}
01629 case 83:
01630 #line 551 "protomake.y"
01631 { yyval.exp = new UnaryExpression(new SrcPosition(lines), yyvsp[0].exp, yyvsp[-1].string); ;
01632 break;}
01633 case 84:
01634 #line 553 "protomake.y"
01635 { yyval.exp = yyvsp[0].fieldRef; ;
01636 break;}
01637 case 85:
01638 #line 554 "protomake.y"
01639 { yyval.exp = yyvsp[0].arrayRef; ;
01640 break;}
01641 case 86:
01642 #line 555 "protomake.y"
01643 { yyval.exp = new Identifier(new SrcPosition(lines), yyvsp[0].string); ;
01644 break;}
01645 case 87:
01646 #line 556 "protomake.y"
01647 { yyval.exp = new IntegerLiteral(new SrcPosition(lines), yyvsp[0].number); ;
01648 break;}
01649 case 88:
01650 #line 557 "protomake.y"
01651 { yyval.exp = new StringLiteral(new SrcPosition(lines), yyvsp[0].string); ;
01652 break;}
01653 case 89:
01654 #line 563 "protomake.y"
01655 {
01656 SrcPosition *pos = new SrcPosition(lines);
01657 yyval.fieldRef = new FieldReference(pos, new Identifier(pos, yyvsp[-2].string), new Identifier(pos, yyvsp[0].string));
01658 ;
01659 break;}
01660 case 90:
01661 #line 571 "protomake.y"
01662 { yyval.arrayRef = new SimpleArrayReference(yyvsp[0].exp->getPosition(), new Identifier(yyvsp[0].exp->getPosition(), yyvsp[-1].string), yyvsp[0].exp); ;
01663 break;}
01664 case 91:
01665 #line 572 "protomake.y"
01666 {yyval.arrayRef = new MultipleArrayReference(yyvsp[-1].arrayRef->getPosition(), yyvsp[-1].arrayRef, yyvsp[0].exp);;
01667 break;}
01668 case 92:
01669 #line 577 "protomake.y"
01670 { yyval.exp = yyvsp[-1].exp; ;
01671 break;}
01672 case 93:
01673 #line 582 "protomake.y"
01674 {yyval.stmt = yyvsp[0].simpStmt;;
01675 break;}
01676 case 94:
01677 #line 583 "protomake.y"
01678 {yyval.stmt = new SequentialStatement(yyvsp[0].simpStmt->getPosition(), yyvsp[-2].stmt, yyvsp[0].simpStmt);;
01679 break;}
01680 case 95:
01681 #line 588 "protomake.y"
01682 {yyval.simpStmt = new SkipStatement(new SrcPosition(lines));;
01683 break;}
01684 case 96:
01685 #line 589 "protomake.y"
01686 {yyval.simpStmt = new AssignStatement(yyvsp[-2].leftSideLst->getPosition(), yyvsp[-2].leftSideLst, yyvsp[0].expLst);;
01687 break;}
01688 case 97:
01689 #line 591 "protomake.y"
01690 {
01691
01692 SrcPosition *pos = new SrcPosition(lines);
01693 yyval.simpStmt = new ReceiveStatement(pos, new Identifier(pos, yyvsp[-2].string), new Identifier(pos, yyvsp[0].string), NULL);
01694 ;
01695 break;}
01696 case 98:
01697 #line 597 "protomake.y"
01698 {
01699
01700 SrcPosition *pos = new SrcPosition(lines);
01701 yyval.simpStmt = new SendStatement(pos, new Identifier(pos, yyvsp[-2].string), new Identifier(pos, yyvsp[0].string), NULL);
01702 ;
01703 break;}
01704 case 99:
01705 #line 602 "protomake.y"
01706 { yyval.simpStmt = new IfStatement(yyvsp[-1].guardStmt->getPosition(), yyvsp[-1].guardStmt); ;
01707 break;}
01708 case 100:
01709 #line 603 "protomake.y"
01710 { yyval.simpStmt = new DoStatement(yyvsp[-1].simpGuardStmt->getPosition(), yyvsp[-1].simpGuardStmt); ;
01711 break;}
01712 case 101:
01713 #line 604 "protomake.y"
01714 { yyval.simpStmt = new ActStatement(yyvsp[0].exp->getPosition(), new Identifier(yyvsp[0].exp->getPosition(), yyvsp[-2].string) ,yyvsp[0].exp); ;
01715 break;}
01716 case 102:
01717 #line 606 "protomake.y"
01718 {
01719 SrcPosition *pos = new SrcPosition(lines);
01720 yyval.simpStmt = new StartStatement(pos, new Identifier(pos, yyvsp[0].string));
01721 ;
01722 break;}
01723 case 103:
01724 #line 610 "protomake.y"
01725 { yyval.simpStmt = new StopStatement(new SrcPosition(lines)); ;
01726 break;}
01727 case 104:
01728 #line 613 "protomake.y"
01729 {
01730 yyval.simpStmt = new BehaviorStatement(yyvsp[-1].expLst->getPosition(),
01731 new Identifier(yyvsp[-1].expLst->getPosition(), yyvsp[-5].string),
01732 new Identifier(yyvsp[-1].expLst->getPosition(), yyvsp[-3].string),
01733 yyvsp[-1].expLst);
01734 ;
01735 break;}
01736 case 105:
01737 #line 623 "protomake.y"
01738 { yyval.leftSideLst = new SimpleLeftSideList(yyvsp[0].leftSide->getPosition(), yyvsp[0].leftSide); ;
01739 break;}
01740 case 106:
01741 #line 625 "protomake.y"
01742 {
01743 yyval.leftSideLst = new SequentialLeftSideList(yyvsp[0].leftSide->getPosition(), yyvsp[-2].leftSideLst,
01744 new SimpleLeftSideList(yyvsp[0].leftSide->getPosition(), yyvsp[0].leftSide));
01745 ;
01746 break;}
01747 case 107:
01748 #line 633 "protomake.y"
01749 { yyval.leftSide = new Identifier(new SrcPosition(lines), yyvsp[0].string); ;
01750 break;}
01751 case 108:
01752 #line 634 "protomake.y"
01753 { yyval.leftSide = yyvsp[0].fieldRef; ;
01754 break;}
01755 case 109:
01756 #line 635 "protomake.y"
01757 { yyval.leftSide = yyvsp[0].arrayRef; ;
01758 break;}
01759 case 110:
01760 #line 640 "protomake.y"
01761 { yyval.expLst = new SimpleExpressionList(yyvsp[0].exp->getPosition(), yyvsp[0].exp); ;
01762 break;}
01763 case 111:
01764 #line 642 "protomake.y"
01765 {
01766 yyval.expLst = new SequentialExpressionList(yyvsp[-2].expLst->getPosition(), yyvsp[-2].expLst,
01767 new SimpleExpressionList(yyvsp[-2].expLst->getPosition(), yyvsp[0].exp));
01768 ;
01769 break;}
01770 case 112:
01771 #line 650 "protomake.y"
01772 { yyval.guardStmt = yyvsp[0].simpGuardStmt; ;
01773 break;}
01774 case 113:
01775 #line 652 "protomake.y"
01776 {
01777 yyval.guardStmt = new SequentialGuardedStatement(yyvsp[-2].guardStmt->getPosition(), yyvsp[-2].guardStmt, yyvsp[0].simpGuardStmt);
01778 ;
01779 break;}
01780 case 114:
01781 #line 660 "protomake.y"
01782 {
01783 yyval.simpGuardStmt = new SimpleGuardedStatement(yyvsp[-2].exp->getPosition(), yyvsp[-2].exp, yyvsp[0].stmt);
01784 ;
01785 break;}
01786 }
01787
01788 #line 704 "/usr/share/bison/bison.simple"
01789
01790
01791 yyvsp -= yylen;
01792 yyssp -= yylen;
01793 #if YYLSP_NEEDED
01794 yylsp -= yylen;
01795 #endif
01796
01797 #if YYDEBUG
01798 if (yydebug)
01799 {
01800 short *yyssp1 = yyss - 1;
01801 YYFPRINTF (stderr, "state stack now");
01802 while (yyssp1 != yyssp)
01803 YYFPRINTF (stderr, " %d", *++yyssp1);
01804 YYFPRINTF (stderr, "\n");
01805 }
01806 #endif
01807
01808 *++yyvsp = yyval;
01809 #if YYLSP_NEEDED
01810 *++yylsp = yyloc;
01811 #endif
01812
01813
01814
01815
01816
01817 yyn = yyr1[yyn];
01818
01819 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01820 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01821 yystate = yytable[yystate];
01822 else
01823 yystate = yydefgoto[yyn - YYNTBASE];
01824
01825 goto yynewstate;
01826
01827
01828
01829
01830
01831 yyerrlab:
01832
01833 if (!yyerrstatus)
01834 {
01835 ++yynerrs;
01836
01837 #ifdef YYERROR_VERBOSE
01838 yyn = yypact[yystate];
01839
01840 if (yyn > YYFLAG && yyn < YYLAST)
01841 {
01842 YYSIZE_T yysize = 0;
01843 char *yymsg;
01844 int yyx, yycount;
01845
01846 yycount = 0;
01847
01848
01849 for (yyx = yyn < 0 ? -yyn : 0;
01850 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
01851 if (yycheck[yyx + yyn] == yyx)
01852 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
01853 yysize += yystrlen ("parse error, unexpected ") + 1;
01854 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
01855 yymsg = (char *) YYSTACK_ALLOC (yysize);
01856 if (yymsg != 0)
01857 {
01858 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
01859 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
01860
01861 if (yycount < 5)
01862 {
01863 yycount = 0;
01864 for (yyx = yyn < 0 ? -yyn : 0;
01865 yyx < (int) (sizeof (yytname) / sizeof (char *));
01866 yyx++)
01867 if (yycheck[yyx + yyn] == yyx)
01868 {
01869 const char *yyq = ! yycount ? ", expecting " : " or ";
01870 yyp = yystpcpy (yyp, yyq);
01871 yyp = yystpcpy (yyp, yytname[yyx]);
01872 yycount++;
01873 }
01874 }
01875 yyerror (yymsg);
01876 YYSTACK_FREE (yymsg);
01877 }
01878 else
01879 yyerror ("parse error; also virtual memory exhausted");
01880 }
01881 else
01882 #endif
01883 yyerror ("parse error");
01884 }
01885 goto yyerrlab1;
01886
01887
01888
01889
01890
01891 yyerrlab1:
01892 if (yyerrstatus == 3)
01893 {
01894
01895
01896
01897
01898 if (yychar == YYEOF)
01899 YYABORT;
01900 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
01901 yychar, yytname[yychar1]));
01902 yychar = YYEMPTY;
01903 }
01904
01905
01906
01907
01908 yyerrstatus = 3;
01909
01910 goto yyerrhandle;
01911
01912
01913
01914
01915
01916
01917 yyerrdefault:
01918 #if 0
01919
01920
01921
01922
01923 yyn = yydefact[yystate];
01924 if (yyn)
01925 goto yydefault;
01926 #endif
01927
01928
01929
01930
01931
01932
01933 yyerrpop:
01934 if (yyssp == yyss)
01935 YYABORT;
01936 yyvsp--;
01937 yystate = *--yyssp;
01938 #if YYLSP_NEEDED
01939 yylsp--;
01940 #endif
01941
01942 #if YYDEBUG
01943 if (yydebug)
01944 {
01945 short *yyssp1 = yyss - 1;
01946 YYFPRINTF (stderr, "Error: state stack now");
01947 while (yyssp1 != yyssp)
01948 YYFPRINTF (stderr, " %d", *++yyssp1);
01949 YYFPRINTF (stderr, "\n");
01950 }
01951 #endif
01952
01953
01954
01955
01956 yyerrhandle:
01957 yyn = yypact[yystate];
01958 if (yyn == YYFLAG)
01959 goto yyerrdefault;
01960
01961 yyn += YYTERROR;
01962 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01963 goto yyerrdefault;
01964
01965 yyn = yytable[yyn];
01966 if (yyn < 0)
01967 {
01968 if (yyn == YYFLAG)
01969 goto yyerrpop;
01970 yyn = -yyn;
01971 goto yyreduce;
01972 }
01973 else if (yyn == 0)
01974 goto yyerrpop;
01975
01976 if (yyn == YYFINAL)
01977 YYACCEPT;
01978
01979 YYDPRINTF ((stderr, "Shifting error token, "));
01980
01981 *++yyvsp = yylval;
01982 #if YYLSP_NEEDED
01983 *++yylsp = yylloc;
01984 #endif
01985
01986 yystate = yyn;
01987 goto yynewstate;
01988
01989
01990
01991
01992
01993 yyacceptlab:
01994 yyresult = 0;
01995 goto yyreturn;
01996
01997
01998
01999
02000 yyabortlab:
02001 yyresult = 1;
02002 goto yyreturn;
02003
02004
02005
02006
02007 yyoverflowlab:
02008 yyerror ("parser stack overflow");
02009 yyresult = 2;
02010
02011
02012 yyreturn:
02013 #ifndef yyoverflow
02014 if (yyss != yyssa)
02015 YYSTACK_FREE (yyss);
02016 #endif
02017 return yyresult;
02018 }
02019 #line 665 "protomake.y"
02020
02021
02022 int main(int argc, char **argv)
02023 {
02024 extern FILE *yyin;
02025
02026 if (argc != 2)
02027 {
02028 fprintf(stderr, "Uso: protomake <arquivo-entrada>\n");
02029 exit(1);
02030 }
02031
02032 if ((yyin = fopen(argv[1], "r")) == NULL)
02033 {
02034 fprintf(stderr, "Erro ao tentar abrir o arquivo %s!\n", argv[1]);
02035 exit(1);
02036 }
02037
02038 if (yyparse())
02039 {
02040 fprintf(stderr, "Não foi possível compilar %s!\n", argv[1]);
02041 exit(1);
02042 }
02043
02044 TypeCheckerVisitor typeChecker;
02045 root->visit(typeChecker);
02046
02047 CCodeGeneratorVisitor ccodeGenerator;
02048 root->visit(ccodeGenerator);
02049
02050 JavaCodeGeneratorVisitor java("./code/teste.java");
02051 root->visit(java);
02052
02053 fprintf(stderr, "Sintaxe de %s correta!\n", argv[1]);
02054 fclose(yyin);
02055
02056 if (etherInfo != NULL)
02057 {
02058 fprintf(stderr, "Gerando o plugin do ethereal para o protocolo...\n");
02059 generateEtherealPlugin(&fiMap, etherInfo);
02060 fprintf(stderr, "Plugin gerado!\n");
02061 }
02062
02063 return 0;
02064 }
02065
02066 int yyerror(char *msg)
02067 {
02068 fprintf(stderr, "Line %d: %s\n", lines+1, msg);
02069 exit(1);
02070
02071 return 0;
02072 }
02073
02075 static void generateEtherealPlugin(map<string, vector<FieldInfo> > *fiMap,
02076 multimap<EtherType, EtherInfoType> *eit)
02077 {
02078 multimap<EtherType, EtherInfoType>::iterator itr;
02079
02081 if (eit->count(NAME) > 1)
02082 {
02083 itr = eit->find(NAME);
02084 itr++;
02085 fprintf(stderr, "Line %d: More than one name was defined for the protocol!\n",
02086 (*itr).second.lines + 1);
02087 exit(1);
02088 }
02089 else if (eit->count(NAME) == 0)
02090 {
02091 fprintf(stderr, "No name was defined for the protocol!\n");
02092 exit(1);
02093 }
02094 if (eit->count(ABBREV) > 1)
02095 {
02096 itr = eit->find(ABBREV);
02097 itr++;
02098 fprintf(stderr, "Line %d: More than one short name was defined for the protocol!\n",
02099 (*itr).second.lines + 1);
02100 exit(1);
02101 }
02102 else if (eit->count(ABBREV) == 0)
02103 {
02104 fprintf(stderr, "No short name was defined for the protocol!\n");
02105 exit(1);
02106 }
02107 else if (eit->count(PORT) > 1)
02108 {
02109 itr = eit->find(PORT);
02110 itr++;
02111 fprintf(stderr, "Line %d: More than one port was defined for the protocol!\n",
02112 (*itr).second.lines + 1);
02113 exit(1);
02114 }
02115 else if (eit->count(PORT) == 0)
02116 {
02117 fprintf(stderr, "No port was defined for the protocol!\n");
02118 exit(1);
02119 }
02120 else if (eit->count(TRANSPORT) > 1)
02121 {
02122 itr = eit->find(TRANSPORT);
02123 itr++;
02124 fprintf(stderr, "Line %d: More than one transport protocol was defined for the protocol!\n",
02125 (*itr).second.lines + 1);
02126 exit(1);
02127 }
02128 else if (eit->count(TRANSPORT) == 0)
02129 {
02130 fprintf(stderr, "No transport protocol was defined for the protocol!\n");
02131 exit(1);
02132 }
02133
02135 itr = eit->find(ABBREV);
02136 FILE *plugin;
02137 char fileName[256];
02138 char *abbrev = ++((*itr).second.string);
02139 unsigned i;
02140
02144 abbrev[strlen(abbrev)-1] = '\0';
02145 for (i = 0; abbrev[i]; i++)
02146 abbrev[i] = tolower(abbrev[i]);
02147
02148
02149 sprintf(fileName, "./plugin/packet-%s.c", (*itr).second.string);
02150 if ((plugin = fopen(fileName, "w")) == NULL)
02151 {
02152 fprintf(stderr, "Unable to create %s!\n", fileName);
02153 exit(1);
02154 }
02155
02157 writeHeader(plugin, fileName, eit);
02158
02160
02161 int j;
02162 FieldInfo fi;
02163 fi.identifier = "code";
02164 fi.bitByte = FieldType::BIT;
02165 fi.size = NULL;
02166
02167 j = 1;
02168 fprintf(plugin, "/** Message structures. Inicialize the protocol and registered fields */\n");
02169 for (map<string, vector<FieldInfo> >::iterator itr = fiMap->begin();
02170 itr != fiMap->end();
02171 itr++, j++)
02172 {
02173 fi.init = new IntegerLiteral(NULL, j);
02174 ((*itr).second).push_back(fi);
02175
02176 fprintf(plugin, "typedef struct {\n");
02177 for (i = 0; i < (*itr).second.size(); i++)
02178 fprintf(plugin, "\tint %s_%s;\n", abbrev, ((*itr).second)[i].identifier);
02179 fprintf(plugin, "} hf_%s_fields;\n", (*itr).first.c_str());
02180 fprintf(plugin, "static hf_%s_fields hf_%s = { ", (*itr).first.c_str(), (*itr).first.c_str());
02181 for (i = 0; i < (*itr).second.size(); i++)
02182 {
02183 if (!i) fprintf(plugin, "-1");
02184 else fprintf(plugin, ", -1");
02185 }
02186 fprintf(plugin, " };\n\n");
02187 }
02188 fprintf(plugin, "static int proto_%s = -1;\n\n", abbrev);
02189 fprintf(plugin, "/* Initialize the subtree pointers */\n");
02190 fprintf(plugin, "static gint ett_%s = -1;\n\n", abbrev);
02191
02193 writeDissector(plugin, fiMap, eit);
02194
02196 fprintf(plugin, "void proto_register_%s(void)\n{\n", abbrev);
02197 fprintf(plugin, "/** Setup list of header fields */\n");
02198 fprintf(plugin, "\t static hf_register_info hf[] = {\n");
02199
02201 for (map<string, vector<FieldInfo> >::iterator itr = fiMap->begin();
02202 itr != fiMap->end();
02203 itr++)
02204 {
02205 if (itr != fiMap->begin())
02206 fprintf(plugin, ",\n");
02207
02208 for (i = 0; i < (*itr).second.size(); i++)
02209 {
02210 if (i)
02211 fprintf(plugin, ",\n");
02212 fprintf(plugin, "\t\t{ &(hf_%s.%s_%s),\n", (*itr).first.c_str(), abbrev,
02213 ((*itr).second)[i].identifier);
02214 fprintf(plugin, "\t\t\t{ \"%s\", \"%s.%s_%s\",\n", ((*itr).second)[i].identifier,
02215 abbrev,
02216 (*itr).first.c_str(),
02217 ((*itr).second)[i].identifier);
02218
02219 if ((*itr).second[i].bitByte == FieldType::BIT)
02220 fprintf(plugin, "\t\t\tFT_INT32, BASE_DEC, NULL, 0x0,\n\t\t\t\"%s\" }\n", ((*itr).second)[i].identifier);
02221 else
02222 fprintf(plugin, "\t\t\tFT_STRING, BASE_NONE, NULL, 0x0,\n\t\t\t\"%s\" }\n", ((*itr).second)[i].identifier);
02223 fprintf(plugin, "\t\t}");
02224 }
02225 }
02226 fprintf(plugin, "\n\t};\n\n");
02227
02228 fprintf(plugin, "/** Setup protocol subtree array */\n");
02229 fprintf(plugin, "\tstatic gint *ett[] = { &ett_%s };\n\n", abbrev);
02230
02231 fprintf(plugin, "/** Register the protocol name and description */\n");
02232 char *ABBREV = strdup(abbrev);
02233 for (i = 0; ABBREV[i]; i++)
02234 ABBREV[i] = toupper(ABBREV[i]);
02235
02236 char *name = (*(eit->find(NAME))).second.string;
02237 fprintf(plugin, "\tproto_%s = proto_register_protocol(\"%s\",\n"
02238 "\t \"%s\",\n"
02239 "\t \"%s\");\n\n",
02240 abbrev, name, ABBREV, abbrev);
02241
02242 fprintf(plugin, "/** Required function calls to register the header fields and subtrees used */\n");
02243 fprintf(plugin, "\tproto_register_field_array(proto_%s, hf, array_length(hf));\n", abbrev);
02244 fprintf(plugin, "\tproto_register_subtree_array(ett, array_length(ett));\n}");
02245
02247 writeRest(plugin, (*(eit->find(TRANSPORT))).second.string, (*(eit->find(PORT))).second.string, abbrev);
02248 fclose(plugin);
02249
02250 FILE *makefile = fopen("./plugin/Makefile.am", "w");
02251 if (makefile)
02252 {
02253 fprintf(makefile, "INCLUDES = -I$(top_src_dir)\n\n");
02254
02255 fprintf(makefile, "plugindir = @plugindir@\n\n");
02256
02257 fprintf(makefile, "plugin_LTLIBRARIES = %s.la\n", abbrev);
02258 fprintf(makefile, "%s_la_SOURCES = packet-%s.c\n", abbrev, abbrev);
02259 fprintf(makefile, "%s_la_LDFLAGS = -module -avoid-version\n\n", abbrev);
02260
02261 fprintf(makefile, "LIB = \n\n");
02262
02263 fprintf(makefile, "%s_la_DEPENDENCIES = packet-%s-static.o\n\n", abbrev, abbrev);
02264
02265 fprintf(makefile, "packet-%s-static.o: packet-%s.c\n", abbrev, abbrev);
02266 fprintf(makefile, "\t$(LTCOMPILE) -c -o packet-%s-static.o -D__ETHEREAL_STATIC__ $(srcdir)/packet-%s.c\n",
02267 abbrev, abbrev);
02268
02269 fprintf(makefile, "CLEANFILES = %s \n", abbrev);
02270 fprintf(makefile, "EXTRA_DIST = Makefile.nmake\n");
02271 }
02272 else fprintf(stderr, "Unable to create Makfile.am!\n");
02273 fclose(makefile);
02274
02275 makefile = fopen("./plugin/Makefile.nmake", "w");
02276 if (makefile)
02277 {
02278 fprintf(makefile, "include ..\\..\\config.nmake\n\n");
02279
02280 fprintf(makefile, "CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap \\\n");
02281 fprintf(makefile, "\t/I$(GLIB_DIR) /I$(GTK_DIR) /I$(GLIB_DIR)/gmodule \\\n");
02282 fprintf(makefile, "/I$(PCAP_DIR)\\include $(LOCAL_CFLAGS)\n\n");
02283
02284 fprintf(makefile, "OBJECTS=packet-%s.obj\n\n", abbrev);
02285 fprintf(makefile, "%s.dll %s.exp %s.lib : packet-%s.obj ..\\plugin_api.obj\n",
02286 abbrev, abbrev, abbrev, abbrev);
02287 fprintf(makefile, "\tlink -dll /out:%s.dll packet-%s.obj ..\\plugin_api.obj \\\n",
02288 abbrev, abbrev);
02289 fprintf(makefile, "$(GLIB_DIR)\\glib-$(GLIB_VERSION).lib\n\n");
02290 fprintf(makefile, "clean:\n\trm -f $(OBJECTS) %s.dll %s.exp %s.lib\n",
02291 abbrev, abbrev, abbrev);
02292 }
02293 else fprintf(stderr, "Unable to create Makefile.nmake!\n");
02294 fclose(makefile);
02295 }
02296
02297 static void writeHeader(FILE *plugin, char *fileName,
02298 multimap<EtherType, EtherInfoType> *eit)
02299 {
02300 int total;
02301 char *author, *email;
02302 char *name = ++((*(eit->find(NAME))).second.string);
02303 multimap<EtherType, EtherInfoType>::iterator itr;
02304
02305 name[strlen(name)-1] = '\0';
02306 fprintf(plugin, "/* %s\n", &fileName[2]);
02307 fprintf(plugin, " * Routines for %s dissection\n", name);
02308
02309 fprintf(plugin, " * Copyright 2003");
02310 for (total = eit->count(AUTHOR), itr = eit->find(AUTHOR);
02311 total > 0;
02312 itr++, total--)
02313 {
02314 author = ++((*itr).second.string);
02315
02316 author[strlen(author) - 1] = '\0';
02317 fprintf(plugin, ", %s", author);
02318 }
02319
02320 fprintf(plugin, " <");
02321 for (total = eit->count(EMAIL), itr = eit->find(EMAIL);
02322 total > 0;
02323 itr++, total--)
02324 {
02325 email = ++((*itr).second.string);
02326
02327 email[strlen(email) - 1] = '\0';
02328 fprintf(plugin, "%s, ", email);
02329 }
02330 fprintf(plugin, ">\n");
02331
02332 char *header = " * \n\
02333 * Ethereal - Network traffic analyzer\n\
02334 * By Gerald Combs <gerald@ethereal.com>\n\
02335 * Copyright 1998 Gerald Combs\n\
02336 * \n\
02337 * Generated from ProtoMake by Igor Cananéa, Fábio Guerra, Rodrigo Araújo &\n\
02338 * Thiago Souto Maior, Copyright 2003.\n\
02339 *\n\
02340 * This program is free software; you can redistribute it and/or\n\
02341 * modify it under the terms of the GNU General Public License\n\
02342 * as published by the Free Software Foundation; either version 2\n\
02343 * of the License, or (at your option) any later version.\n\
02344 *\n\
02345 * This program is distributed in the hope that it will be useful,\n\
02346 * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
02347 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
02348 * GNU General Public License for more details.\n\
02349 *\n\
02350 * You should have received a copy of the GNU General Public License\n\
02351 * along with this program; if not, write to the Free Software\n\
02352 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\
02353 */\n\
02354 \n\
02355 #ifdef HAVE_CONFIG_H\n\
02356 # include \"config.h\"\n\
02357 #endif\n\
02358 \n\
02359 #include <stdio.h>\n\
02360 #include <stdlib.h>\n\
02361 #include <string.h>\n\
02362 \n\
02363 /* Includes glib.h! */\n\
02364 #include <gmodule.h>\n\
02365 \n\
02366 #ifdef NEED_SNPRINTF_H\n\
02367 # include \"snprintf.h\"\n\
02368 #endif\n\
02369 \n\
02370 #include <epan/packet.h>\n\
02371 #include \"plugins/plugin_api.h\"\n\
02372 #include \"plugins/plugin_api_defs.h\"\n\
02373 \n\
02374 #ifndef __ETHEREAL_STATIC__\n\
02375 G_MODULE_EXPORT const gchar version[] = \"1.0\";\n\
02376 #endif\n\n";
02377
02378 fprintf(plugin, "%s", header);
02379 }
02380
02381
02382 static void writeDissector(FILE *plugin, map<string, vector<FieldInfo> > *fiMap,
02383 multimap<EtherType, EtherInfoType> *eit)
02384 {
02385 char *abbrev = (*(eit->find(ABBREV))).second.string;
02386 char *ABBREV = strdup(abbrev);
02387 unsigned i;
02388
02389 for (i = 0; ABBREV[i]; i++)
02390 ABBREV[i] = toupper(ABBREV[i]);
02391
02392 fprintf(plugin, "/** Dissector main code! */\n");
02393 fprintf(plugin, "void dissect_%s(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)\n{\n", abbrev);
02394
02395 fprintf(plugin, "/** Set up structures needed to add the protocol subtree and manage it */\n");
02396 fprintf(plugin, "\tproto_item *tree_item;\n\tproto_tree *%s_tree;\n\tguint16 code;\n", abbrev);
02397
02398 for (map<string, vector<FieldInfo> >::iterator itr = fiMap->begin();
02399 itr != fiMap->end();
02400 itr++)
02401 {
02402 fprintf(plugin, "\tstatic struct {\n");
02403 for (i = 0; i < (*itr).second.size(); i++)
02404 {
02405 if (((*itr).second)[i].bitByte == FieldType::BIT)
02406 fprintf(plugin, "\t\tguint32 ");
02407 else
02408 fprintf(plugin, "\t\tguint8 *");
02409 fprintf(plugin, "%s_%s;\n", abbrev, ((*itr).second)[i].identifier);
02410 }
02411 fprintf(plugin, "\t} msg_%s;\n\n", (*itr).first.c_str());
02412 }
02413
02414 fprintf(plugin, "/** Make entries in Protocol column and Info column on summary display */\n");
02415 fprintf(plugin, "\tif (check_col(pinfo->cinfo, COL_PROTOCOL))\n");
02416 fprintf(plugin, "\t\tcol_set_str(pinfo->cinfo, COL_PROTOCOL, \"%s\");\n\n", ABBREV);
02417
02418 fprintf(plugin, "/** Verify the message sent and dissect it properly */\n");
02419 fprintf(plugin, "\tif (tree) {\n");
02420 fprintf(plugin, "\t\tcode = tvb_get_ntohs(tvb, 0);\n\n");
02421
02422 fprintf(plugin, "\t\ttree_item = proto_tree_add_item(tree, proto_%s, tvb, 0, -1, FALSE);\n", abbrev);
02423 fprintf(plugin, "\t\t%s_tree = proto_item_add_subtree(tree_item, ett_%s);\n\n", abbrev, abbrev);
02424
02425 fprintf(plugin, "\t\tif (");
02426
02427 for (map<string, vector<FieldInfo> >::iterator itr = fiMap->begin();
02428 itr != fiMap->end();
02429 itr++)
02430 {
02431 if (itr != fiMap->begin())
02432 fprintf(plugin, "\t\telse if (");
02433 vector <FieldInfo> temp = ((*itr).second);
02434 IntegerLiteral *msgCode = dynamic_cast<IntegerLiteral*> (temp[temp.size() - 1].init);
02435 fprintf(plugin, "code == %d)\n\t\t{\n", msgCode->getValue());
02436 fprintf(plugin, "\t\t\tint offset = 2; //sizeof(code) == 2 since code is a guint16 :)\n\n");
02437
02439 for (i = 0; i < (*itr).second.size() - 1; i++)
02440 {
02441 FieldInfo fi = (*itr).second[i];
02442
02443 if (fi.bitByte == FieldType::BIT)
02444 {
02445 int value = (dynamic_cast<IntegerLiteral*> (fi.size))->getValue();
02446
02447 if (value <= 8)
02448 {
02449 fprintf(plugin, "\t\t\tmsg_%s.%s_%s = tvb_get_guint8(tvb, offset);\n",
02450 (*itr).first.c_str(), abbrev, fi.identifier);
02451 fprintf(plugin, "\t\t\tproto_tree_add_item(%s_tree, hf_%s.%s_%s, tvb, offset, 1, FALSE);\n",
02452 abbrev, (*itr).first.c_str(), abbrev, fi.identifier);
02453 fprintf(plugin, "\t\t\toffset++;\n\n");
02454 }
02455 else if (value <= 16)
02456 {
02457 fprintf(plugin, "\t\t\tmsg_%s.%s_%s = tvb_get_ntohs(tvb, offset);\n",
02458 (*itr).first.c_str(), abbrev, fi.identifier);
02459 fprintf(plugin, "\t\t\tproto_tree_add_item(%s_tree, hf_%s.%s_%s, tvb, offset, 2, FALSE);\n",
02460 abbrev, (*itr).first.c_str(), abbrev, fi.identifier);
02461 fprintf(plugin, "\t\t\toffset += 2;\n\n");
02462 }
02463 else if (value <= 32 || value > 16)
02464 {
02465 fprintf(plugin, "\t\t\tmsg_%s.%s_%s = tvb_get_ntohl(tvb, offset);\n",
02466 (*itr).first.c_str(), abbrev, fi.identifier);
02467 fprintf(plugin, "\t\t\tproto_tree_add_item(%s_tree, hf_%s.%s_%s, tvb, offset, 4, FALSE);\n",
02468 abbrev, (*itr).first.c_str(), abbrev, fi.identifier);
02469 fprintf(plugin, "\t\t\toffset += 4;\n\n");
02470 }
02471 }
02472 else if (fi.bitByte == FieldType::BYTE &&
02473 typeid(*(fi.size)) == typeid(IntegerLiteral))
02474 {
02475 int value = (dynamic_cast<IntegerLiteral*> (fi.size))->getValue();
02476
02477 fprintf(plugin, "\t\t\tmsg_%s.%s_%s = tvb_memdup(tvb, offset, %d);\n",
02478 (*itr).first.c_str(), abbrev, fi.identifier, value);
02479 fprintf(plugin, "\t\t\tproto_tree_add_string(%s_tree, hf_%s.%s_%s, tvb, offset, %d, msg_%s.%s_%s);\n",
02480 abbrev, (*itr).first.c_str(), abbrev, fi.identifier, value, (*itr).first.c_str(), abbrev, fi.identifier);
02481 fprintf(plugin, "\t\t\toffset += %d;\n\n", value);
02482 }
02483 else if (fi.bitByte == FieldType::BYTE &&
02484 typeid(*(fi.size)) == typeid(Identifier))
02485 {
02486 const char *name = (dynamic_cast<Identifier*>(fi.size))->getName().c_str();
02487
02488 fprintf(plugin, "\t\t\tmsg_%s.%s_%s = tvb_memdup(tvb, offset, msg_%s.%s_%s);\n",
02489 (*itr).first.c_str(), abbrev, fi.identifier, (*itr).first.c_str(),
02490 abbrev, name);
02491 fprintf(plugin, "\t\t\tproto_tree_add_string(%s_tree, hf_%s.%s_%s, tvb, offset, msg_%s.%s_%s, msg_%s.%s_%s);\n",
02492 abbrev, (*itr).first.c_str(), abbrev, fi.identifier, (*itr).first.c_str(), abbrev, name,
02493 (*itr).first.c_str(), abbrev, fi.identifier);
02494 fprintf(plugin, "\t\t\toffset += msg_%s.%s_%s;\n\n", (*itr).first.c_str(), abbrev, name);
02495 }
02496 }
02497
02498 fprintf(plugin, "\t\t}\n");
02499 }
02500 fprintf(plugin, "\t}\n");
02501 fprintf(plugin, "}\n\n");
02502 }
02503
02504
02505 static void writeRest(FILE *plugin, char *trans, char *port, char *abbrev)
02506 {
02507 char *rest = "\n\n/* If this dissector uses sub-dissector registration add a registration routine.\n\
02508 This format is required because a script is used to find these routines and\n\
02509 create the code that calls these routines.\n\
02510 */\n";
02511
02512 fprintf(plugin, "%s", rest);
02513 fprintf(plugin, "void proto_reg_handoff_%s(void)\n{\n", abbrev);
02514 fprintf(plugin, "\tdissector_handle_t %s_handle;\n\n", abbrev);
02515
02516 fprintf(plugin, "\t%s_handle = create_dissector_handle(dissect_%s,\n\t\tproto_%s);\n", abbrev, abbrev, abbrev);
02517 fprintf(plugin, " dissector_add(\"%s.port\", %s, %s_handle);\n", trans, port, abbrev);
02518
02519 rest = "}\n\
02520 \n\
02521 #ifndef __ETHEREAL_STATIC__\n\
02522 G_MODULE_EXPORT void plugin_init(plugin_address_table_t *pat)\n\
02523 {\n\
02524 /* initialise the table of pointers needed in Win32 DLLs */\n\
02525 plugin_address_table_init(pat);\n\
02526 \n\
02527 /* register the new protocol, protocol fields, and subtrees */\n";
02528 fprintf(plugin, "%s", rest);
02529 fprintf(plugin, "\tif (proto_%s == -1) /* execute protocol initialization only once */\n", abbrev);
02530 fprintf(plugin, "\t\tproto_register_%s();\n}\n", abbrev);
02531 rest = "#endif\n\
02532 \n\
02533 #ifndef __ETHEREAL_STATIC__\n\
02534 G_MODULE_EXPORT void plugin_reg_handoff(void)\n\
02535 {\n\
02536 proto_reg_handoff_";
02537 fprintf(plugin, "%s%s();\n}\n#endif\n", rest, abbrev);
02538 }