00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #define YYBISON 1
00047
00048
00049 #define YYBISON_VERSION "2.4.1"
00050
00051
00052 #define YYSKELETON_NAME "yacc.c"
00053
00054
00055 #define YYPURE 0
00056
00057
00058 #define YYPUSH 0
00059
00060
00061 #define YYPULL 1
00062
00063
00064 #define YYLSP_NEEDED 0
00065
00066
00067 #define yyparse aoparse
00068 #define yylex aolex
00069 #define yyerror aoerror
00070 #define yylval aolval
00071 #define yychar aochar
00072 #define yydebug aodebug
00073 #define yynerrs aonerrs
00074
00075
00076
00077
00078
00079 #line 1 "ao-syntax.y"
00080
00081 #include <assert.h>
00082 #include <stdlib.h>
00083 #include <stdio.h>
00084 #include <map>
00085 #include <vector>
00086 #include "ao-lexer.h"
00087 #include "sao-printer.h"
00088 #include "ao-grammar.h"
00089 void aoerror(const char* text);
00090 char* cat(const char* a, const char* b)
00091 {
00092 if (a==NULL && b==NULL) return strdup("");
00093 if (a==NULL) return strdup(b);
00094 if (b==NULL) return strdup(a);
00095 char* c = (char*)malloc(strlen(a)+strlen(b)+1);
00096 strcpy(c,a);
00097 strcat(c,b);
00098 return c;
00099 }
00100
00101 extern bool pascal;
00102
00103 char* args2str(vector<s_arg> * args, string sepi = ", ", string prefix= "")
00104 {
00105 if (!pascal)
00106 {
00107 char* sep=strdup(sepi.c_str());
00108 char* accu=strdup("");
00109 for(unsigned i = 0 ; i < args->size() ; i++)
00110 {
00111 accu=cat(accu,args[0][i].type);
00112 accu=cat(accu," ");
00113 accu=cat(accu,args[0][i].name);
00114 if (i<args->size()-1)
00115 accu=cat(accu,sep);
00116 }
00117 return accu;
00118 }
00119 else
00120 {
00121 char* sep=strdup(sepi.c_str());
00122 char* accu=strdup("");
00123 char* prefix_=strdup(prefix.c_str());
00124 for(unsigned i = 0 ; i < args->size() ; i++)
00125 {
00126 accu=cat(accu,prefix_);
00127 accu=cat(accu,args[0][i].name);
00128 accu=cat(accu,": ");
00129 accu=cat(accu,args[0][i].type);
00130 if (i<args->size()-1)
00131 accu=cat(accu,sep);
00132 }
00133 return accu;
00134 }
00135 }
00136
00137 char* argnames2str(vector<s_arg> * args,string prefix="")
00138 {
00139 char* pref=strdup(prefix.c_str());
00140 char* accu=strdup("");
00141 for(unsigned i = 0 ; i < args->size() ; i++)
00142 {
00143 accu=cat(accu,pref);
00144 accu=cat(accu,args[0][i].name);
00145 if (i<args->size()-1)
00146 accu=cat(accu,", ");
00147 }
00148 return accu;
00149 }
00150
00151 char* copyargs(vector<s_arg> * args)
00152 {
00153 if (!pascal)
00154 {
00155 char* accu=strdup("");
00156 for(unsigned i = 0 ; i < args->size() ; i++)
00157 {
00158 char temp[1000];
00159 sprintf(temp,"%s(%s)",args[0][i].name,args[0][i].name);
00160 accu=cat(accu,temp);
00161 if (i<args->size()-1)
00162 accu=cat(accu,", ");
00163 }
00164 return accu;
00165 }
00166 else
00167 {
00168 char* accu=strdup("");
00169 for(unsigned i = 0 ; i < args->size() ; i++)
00170 {
00171 char temp[1000];
00172 sprintf(temp," %s:=bloody_local_var_%s;\n",args[0][i].name,args[0][i].name);
00173 accu=cat(accu,temp);
00174
00175
00176 }
00177 return accu;
00178 }
00179 }
00180
00181 extern outputbuf object;
00182 extern outputbuf object2;
00183 extern outputbuf meta;
00184 extern outputbuf msgs;
00185 extern outputbuf msgs1;
00186 extern outputbuf impl;
00187 extern outputbuf useslist;
00188 extern outputbuf globhead;
00189 extern char * current_ao;
00190 extern map<string,string> field2init;
00191
00192 #define YYSTTYPE char*
00193
00194
00195
00196 #line 197 "ao-syntax.cpp"
00197
00198
00199 #ifndef YYDEBUG
00200 # define YYDEBUG 0
00201 #endif
00202
00203
00204 #ifdef YYERROR_VERBOSE
00205 # undef YYERROR_VERBOSE
00206 # define YYERROR_VERBOSE 1
00207 #else
00208 # define YYERROR_VERBOSE 0
00209 #endif
00210
00211
00212 #ifndef YYTOKEN_TABLE
00213 # define YYTOKEN_TABLE 0
00214 #endif
00215
00216
00217
00218 #ifndef YYTOKENTYPE
00219 # define YYTOKENTYPE
00220
00221
00222 enum yytokentype {
00223 META = 258,
00224 NAME = 259,
00225 LPAREN = 260,
00226 RPAREN = 261,
00227 MESSAGE = 262,
00228 SEMICOLON = 263,
00229 NUMBER = 264,
00230 INIT = 265,
00231 ACTIVE = 266,
00232 COMMA = 267,
00233 LBRACE = 268,
00234 RBRACE = 269,
00235 STAR = 270,
00236 PRECOMPILER = 271,
00237 VOLATILE = 272,
00238 CLASS = 273,
00239 USES = 274,
00240 TEMPLATE_OPEN = 275,
00241 TEMPLATE_CLOSE = 276
00242 };
00243 #endif
00244
00245
00246
00247 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00248 typedef union YYSTYPE
00249 {
00250
00251
00252 #line 122 "ao-syntax.y"
00253
00254 char * token;
00255 s_arg arg;
00256 vector<s_arg> * args;
00257
00258
00259
00260
00261 #line 262 "ao-syntax.cpp"
00262 } YYSTYPE;
00263 # define YYSTYPE_IS_TRIVIAL 1
00264 # define yystype YYSTYPE
00265 # define YYSTYPE_IS_DECLARED 1
00266 #endif
00267
00268
00269
00270
00271
00272
00273 #line 274 "ao-syntax.cpp"
00274
00275 #ifdef short
00276 # undef short
00277 #endif
00278
00279 #ifdef YYTYPE_UINT8
00280 typedef YYTYPE_UINT8 yytype_uint8;
00281 #else
00282 typedef unsigned char yytype_uint8;
00283 #endif
00284
00285 #ifdef YYTYPE_INT8
00286 typedef YYTYPE_INT8 yytype_int8;
00287 #elif (defined __STDC__ || defined __C99__FUNC__ \
00288 || defined __cplusplus || defined _MSC_VER)
00289 typedef signed char yytype_int8;
00290 #else
00291 typedef short int yytype_int8;
00292 #endif
00293
00294 #ifdef YYTYPE_UINT16
00295 typedef YYTYPE_UINT16 yytype_uint16;
00296 #else
00297 typedef unsigned short int yytype_uint16;
00298 #endif
00299
00300 #ifdef YYTYPE_INT16
00301 typedef YYTYPE_INT16 yytype_int16;
00302 #else
00303 typedef short int yytype_int16;
00304 #endif
00305
00306 #ifndef YYSIZE_T
00307 # ifdef __SIZE_TYPE__
00308 # define YYSIZE_T __SIZE_TYPE__
00309 # elif defined size_t
00310 # define YYSIZE_T size_t
00311 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00312 || defined __cplusplus || defined _MSC_VER)
00313 # include <stddef.h>
00314 # define YYSIZE_T size_t
00315 # else
00316 # define YYSIZE_T unsigned int
00317 # endif
00318 #endif
00319
00320 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00321
00322 #ifndef YY_
00323 # if YYENABLE_NLS
00324 # if ENABLE_NLS
00325 # include <libintl.h>
00326 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00327 # endif
00328 # endif
00329 # ifndef YY_
00330 # define YY_(msgid) msgid
00331 # endif
00332 #endif
00333
00334
00335 #if ! defined lint || defined __GNUC__
00336 # define YYUSE(e) ((void) (e))
00337 #else
00338 # define YYUSE(e)
00339 #endif
00340
00341
00342 #ifndef lint
00343 # define YYID(n) (n)
00344 #else
00345 #if (defined __STDC__ || defined __C99__FUNC__ \
00346 || defined __cplusplus || defined _MSC_VER)
00347 static int
00348 YYID (int yyi)
00349 #else
00350 static int
00351 YYID (yyi)
00352 int yyi;
00353 #endif
00354 {
00355 return yyi;
00356 }
00357 #endif
00358
00359 #if ! defined yyoverflow || YYERROR_VERBOSE
00360
00361
00362
00363 # ifdef YYSTACK_USE_ALLOCA
00364 # if YYSTACK_USE_ALLOCA
00365 # ifdef __GNUC__
00366 # define YYSTACK_ALLOC __builtin_alloca
00367 # elif defined __BUILTIN_VA_ARG_INCR
00368 # include <alloca.h>
00369 # elif defined _AIX
00370 # define YYSTACK_ALLOC __alloca
00371 # elif defined _MSC_VER
00372 # include <malloc.h>
00373 # define alloca _alloca
00374 # else
00375 # define YYSTACK_ALLOC alloca
00376 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00377 || defined __cplusplus || defined _MSC_VER)
00378 # include <stdlib.h>
00379 # ifndef _STDLIB_H
00380 # define _STDLIB_H 1
00381 # endif
00382 # endif
00383 # endif
00384 # endif
00385 # endif
00386
00387 # ifdef YYSTACK_ALLOC
00388
00389 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00390 # ifndef YYSTACK_ALLOC_MAXIMUM
00391
00392
00393
00394
00395 # define YYSTACK_ALLOC_MAXIMUM 4032
00396 # endif
00397 # else
00398 # define YYSTACK_ALLOC YYMALLOC
00399 # define YYSTACK_FREE YYFREE
00400 # ifndef YYSTACK_ALLOC_MAXIMUM
00401 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00402 # endif
00403 # if (defined __cplusplus && ! defined _STDLIB_H \
00404 && ! ((defined YYMALLOC || defined malloc) \
00405 && (defined YYFREE || defined free)))
00406 # include <stdlib.h>
00407 # ifndef _STDLIB_H
00408 # define _STDLIB_H 1
00409 # endif
00410 # endif
00411 # ifndef YYMALLOC
00412 # define YYMALLOC malloc
00413 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00414 || defined __cplusplus || defined _MSC_VER)
00415 void *malloc (YYSIZE_T);
00416 # endif
00417 # endif
00418 # ifndef YYFREE
00419 # define YYFREE free
00420 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00421 || defined __cplusplus || defined _MSC_VER)
00422 void free (void *);
00423 # endif
00424 # endif
00425 # endif
00426 #endif
00427
00428
00429 #if (! defined yyoverflow \
00430 && (! defined __cplusplus \
00431 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00432
00433
00434 union yyalloc
00435 {
00436 yytype_int16 yyss_alloc;
00437 YYSTYPE yyvs_alloc;
00438 };
00439
00440
00441 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00442
00443
00444
00445 # define YYSTACK_BYTES(N) \
00446 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00447 + YYSTACK_GAP_MAXIMUM)
00448
00449
00450
00451 # ifndef YYCOPY
00452 # if defined __GNUC__ && 1 < __GNUC__
00453 # define YYCOPY(To, From, Count) \
00454 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00455 # else
00456 # define YYCOPY(To, From, Count) \
00457 do \
00458 { \
00459 YYSIZE_T yyi; \
00460 for (yyi = 0; yyi < (Count); yyi++) \
00461 (To)[yyi] = (From)[yyi]; \
00462 } \
00463 while (YYID (0))
00464 # endif
00465 # endif
00466
00467
00468
00469
00470
00471
00472 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
00473 do \
00474 { \
00475 YYSIZE_T yynewbytes; \
00476 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
00477 Stack = &yyptr->Stack_alloc; \
00478 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00479 yyptr += yynewbytes / sizeof (*yyptr); \
00480 } \
00481 while (YYID (0))
00482
00483 #endif
00484
00485
00486 #define YYFINAL 2
00487
00488 #define YYLAST 61
00489
00490
00491 #define YYNTOKENS 22
00492
00493 #define YYNNTS 12
00494
00495 #define YYNRULES 29
00496
00497 #define YYNSTATES 63
00498
00499
00500 #define YYUNDEFTOK 2
00501 #define YYMAXUTOK 276
00502
00503 #define YYTRANSLATE(YYX) \
00504 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00505
00506
00507 static const yytype_uint8 yytranslate[] =
00508 {
00509 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00534 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00535 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
00536 15, 16, 17, 18, 19, 20, 21
00537 };
00538
00539 #if YYDEBUG
00540
00541
00542 static const yytype_uint8 yyprhs[] =
00543 {
00544 0, 0, 3, 6, 7, 9, 13, 17, 18, 26,
00545 29, 30, 34, 40, 45, 52, 57, 63, 68, 71,
00546 73, 78, 85, 87, 91, 94, 98, 100, 103, 105
00547 };
00548
00549
00550 static const yytype_int8 yyrhs[] =
00551 {
00552 23, 0, -1, 23, 24, -1, -1, 16, -1, 19,
00553 4, 8, -1, 18, 4, 8, -1, -1, 11, 4,
00554 13, 25, 26, 14, 8, -1, 26, 27, -1, -1,
00555 28, 4, 8, -1, 28, 4, 10, 33, 8, -1,
00556 29, 28, 4, 8, -1, 29, 28, 4, 10, 33,
00557 8, -1, 28, 4, 30, 8, -1, 3, 28, 4,
00558 30, 8, -1, 7, 4, 30, 8, -1, 28, 15,
00559 -1, 4, -1, 4, 20, 28, 21, -1, 4, 20,
00560 28, 12, 28, 21, -1, 17, -1, 5, 31, 6,
00561 -1, 5, 6, -1, 31, 12, 32, -1, 32, -1,
00562 28, 4, -1, 9, -1, 4, -1
00563 };
00564
00565
00566 static const yytype_uint16 yyrline[] =
00567 {
00568 0, 134, 134, 135, 138, 139, 140, 142, 141, 322,
00569 323, 326, 333, 341, 343, 345, 346, 352, 435, 436,
00570 437, 438, 441, 444, 445, 448, 449, 452, 455, 456
00571 };
00572 #endif
00573
00574 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00575
00576
00577 static const char *const yytname[] =
00578 {
00579 "$end", "error", "$undefined", "META", "NAME", "LPAREN", "RPAREN",
00580 "MESSAGE", "SEMICOLON", "NUMBER", "INIT", "ACTIVE", "COMMA", "LBRACE",
00581 "RBRACE", "STAR", "PRECOMPILER", "VOLATILE", "CLASS", "USES",
00582 "TEMPLATE_OPEN", "TEMPLATE_CLOSE", "$accept", "aoheaders", "aoheader",
00583 "$@1", "contents", "content", "type", "varflags", "args", "args_lst",
00584 "arg", "init_expression", 0
00585 };
00586 #endif
00587
00588 # ifdef YYPRINT
00589
00590
00591 static const yytype_uint16 yytoknum[] =
00592 {
00593 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
00594 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
00595 275, 276
00596 };
00597 # endif
00598
00599
00600 static const yytype_uint8 yyr1[] =
00601 {
00602 0, 22, 23, 23, 24, 24, 24, 25, 24, 26,
00603 26, 27, 27, 27, 27, 27, 27, 27, 28, 28,
00604 28, 28, 29, 30, 30, 31, 31, 32, 33, 33
00605 };
00606
00607
00608 static const yytype_uint8 yyr2[] =
00609 {
00610 0, 2, 2, 0, 1, 3, 3, 0, 7, 2,
00611 0, 3, 5, 4, 6, 4, 5, 4, 2, 1,
00612 4, 6, 1, 3, 2, 3, 1, 2, 1, 1
00613 };
00614
00615
00616
00617
00618 static const yytype_uint8 yydefact[] =
00619 {
00620 3, 0, 1, 0, 4, 0, 0, 2, 0, 0,
00621 0, 7, 6, 5, 10, 0, 0, 19, 0, 0,
00622 22, 9, 0, 0, 0, 0, 0, 8, 0, 18,
00623 0, 0, 0, 0, 0, 11, 0, 0, 0, 0,
00624 0, 20, 24, 0, 0, 26, 17, 29, 28, 0,
00625 15, 13, 0, 16, 0, 27, 23, 0, 12, 0,
00626 21, 25, 14
00627 };
00628
00629
00630 static const yytype_int8 yydefgoto[] =
00631 {
00632 -1, 1, 7, 14, 15, 21, 43, 23, 34, 44,
00633 45, 49
00634 };
00635
00636
00637
00638 #define YYPACT_NINF -23
00639 static const yytype_int8 yypact[] =
00640 {
00641 -23, 2, -23, 15, -23, 26, 27, -23, 29, 36,
00642 38, -23, -23, -23, -23, 0, 43, 30, 44, 41,
00643 -23, -23, 1, 43, 7, 43, 46, -23, 31, -23,
00644 8, 46, 12, 34, 45, -23, 28, 47, 35, 48,
00645 43, -23, -23, 11, 22, -23, -23, -23, -23, 49,
00646 -23, -23, 28, -23, 14, -23, -23, 43, -23, 50,
00647 -23, -23, -23
00648 };
00649
00650
00651 static const yytype_int8 yypgoto[] =
00652 {
00653 -23, -23, -23, -23, -23, -23, -15, -23, -22, -23,
00654 -5, 9
00655 };
00656
00657
00658
00659
00660
00661 #define YYTABLE_NINF -1
00662 static const yytype_uint8 yytable[] =
00663 {
00664 22, 24, 2, 16, 17, 28, 37, 18, 30, 39,
00665 32, 31, 38, 3, 19, 55, 29, 20, 4, 8,
00666 5, 6, 29, 29, 40, 54, 29, 29, 56, 29,
00667 9, 10, 47, 41, 57, 60, 33, 48, 17, 35,
00668 42, 36, 11, 51, 12, 52, 13, 17, 26, 27,
00669 25, 33, 61, 46, 0, 50, 53, 58, 62, 0,
00670 0, 59
00671 };
00672
00673 static const yytype_int8 yycheck[] =
00674 {
00675 15, 16, 0, 3, 4, 4, 28, 7, 23, 31,
00676 25, 4, 4, 11, 14, 4, 15, 17, 16, 4,
00677 18, 19, 15, 15, 12, 40, 15, 15, 6, 15,
00678 4, 4, 4, 21, 12, 21, 5, 9, 4, 8,
00679 6, 10, 13, 8, 8, 10, 8, 4, 4, 8,
00680 20, 5, 57, 8, -1, 8, 8, 8, 8, -1,
00681 -1, 52
00682 };
00683
00684
00685
00686 static const yytype_uint8 yystos[] =
00687 {
00688 0, 23, 0, 11, 16, 18, 19, 24, 4, 4,
00689 4, 13, 8, 8, 25, 26, 3, 4, 7, 14,
00690 17, 27, 28, 29, 28, 20, 4, 8, 4, 15,
00691 28, 4, 28, 5, 30, 8, 10, 30, 4, 30,
00692 12, 21, 6, 28, 31, 32, 8, 4, 9, 33,
00693 8, 8, 10, 8, 28, 4, 6, 12, 8, 33,
00694 21, 32, 8
00695 };
00696
00697 #define yyerrok (yyerrstatus = 0)
00698 #define yyclearin (yychar = YYEMPTY)
00699 #define YYEMPTY (-2)
00700 #define YYEOF 0
00701
00702 #define YYACCEPT goto yyacceptlab
00703 #define YYABORT goto yyabortlab
00704 #define YYERROR goto yyerrorlab
00705
00706
00707
00708
00709
00710
00711 #define YYFAIL goto yyerrlab
00712
00713 #define YYRECOVERING() (!!yyerrstatus)
00714
00715 #define YYBACKUP(Token, Value) \
00716 do \
00717 if (yychar == YYEMPTY && yylen == 1) \
00718 { \
00719 yychar = (Token); \
00720 yylval = (Value); \
00721 yytoken = YYTRANSLATE (yychar); \
00722 YYPOPSTACK (1); \
00723 goto yybackup; \
00724 } \
00725 else \
00726 { \
00727 yyerror (YY_("syntax error: cannot back up")); \
00728 YYERROR; \
00729 } \
00730 while (YYID (0))
00731
00732
00733 #define YYTERROR 1
00734 #define YYERRCODE 256
00735
00736
00737
00738
00739
00740
00741 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00742 #ifndef YYLLOC_DEFAULT
00743 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00744 do \
00745 if (YYID (N)) \
00746 { \
00747 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
00748 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
00749 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
00750 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
00751 } \
00752 else \
00753 { \
00754 (Current).first_line = (Current).last_line = \
00755 YYRHSLOC (Rhs, 0).last_line; \
00756 (Current).first_column = (Current).last_column = \
00757 YYRHSLOC (Rhs, 0).last_column; \
00758 } \
00759 while (YYID (0))
00760 #endif
00761
00762
00763
00764
00765
00766
00767 #ifndef YY_LOCATION_PRINT
00768 # if YYLTYPE_IS_TRIVIAL
00769 # define YY_LOCATION_PRINT(File, Loc) \
00770 fprintf (File, "%d.%d-%d.%d", \
00771 (Loc).first_line, (Loc).first_column, \
00772 (Loc).last_line, (Loc).last_column)
00773 # else
00774 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00775 # endif
00776 #endif
00777
00778
00779
00780
00781 #ifdef YYLEX_PARAM
00782 # define YYLEX yylex (YYLEX_PARAM)
00783 #else
00784 # define YYLEX yylex ()
00785 #endif
00786
00787
00788 #if YYDEBUG
00789
00790 # ifndef YYFPRINTF
00791 # include <stdio.h>
00792 # define YYFPRINTF fprintf
00793 # endif
00794
00795 # define YYDPRINTF(Args) \
00796 do { \
00797 if (yydebug) \
00798 YYFPRINTF Args; \
00799 } while (YYID (0))
00800
00801 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00802 do { \
00803 if (yydebug) \
00804 { \
00805 YYFPRINTF (stderr, "%s ", Title); \
00806 yy_symbol_print (stderr, \
00807 Type, Value); \
00808 YYFPRINTF (stderr, "\n"); \
00809 } \
00810 } while (YYID (0))
00811
00812
00813
00814
00815
00816
00817
00818 #if (defined __STDC__ || defined __C99__FUNC__ \
00819 || defined __cplusplus || defined _MSC_VER)
00820 static void
00821 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00822 #else
00823 static void
00824 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
00825 FILE *yyoutput;
00826 int yytype;
00827 YYSTYPE const * const yyvaluep;
00828 #endif
00829 {
00830 if (!yyvaluep)
00831 return;
00832 # ifdef YYPRINT
00833 if (yytype < YYNTOKENS)
00834 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00835 # else
00836 YYUSE (yyoutput);
00837 # endif
00838 switch (yytype)
00839 {
00840 default:
00841 break;
00842 }
00843 }
00844
00845
00846
00847
00848
00849
00850 #if (defined __STDC__ || defined __C99__FUNC__ \
00851 || defined __cplusplus || defined _MSC_VER)
00852 static void
00853 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00854 #else
00855 static void
00856 yy_symbol_print (yyoutput, yytype, yyvaluep)
00857 FILE *yyoutput;
00858 int yytype;
00859 YYSTYPE const * const yyvaluep;
00860 #endif
00861 {
00862 if (yytype < YYNTOKENS)
00863 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00864 else
00865 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00866
00867 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
00868 YYFPRINTF (yyoutput, ")");
00869 }
00870
00871
00872
00873
00874
00875
00876 #if (defined __STDC__ || defined __C99__FUNC__ \
00877 || defined __cplusplus || defined _MSC_VER)
00878 static void
00879 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
00880 #else
00881 static void
00882 yy_stack_print (yybottom, yytop)
00883 yytype_int16 *yybottom;
00884 yytype_int16 *yytop;
00885 #endif
00886 {
00887 YYFPRINTF (stderr, "Stack now");
00888 for (; yybottom <= yytop; yybottom++)
00889 {
00890 int yybot = *yybottom;
00891 YYFPRINTF (stderr, " %d", yybot);
00892 }
00893 YYFPRINTF (stderr, "\n");
00894 }
00895
00896 # define YY_STACK_PRINT(Bottom, Top) \
00897 do { \
00898 if (yydebug) \
00899 yy_stack_print ((Bottom), (Top)); \
00900 } while (YYID (0))
00901
00902
00903
00904
00905
00906
00907 #if (defined __STDC__ || defined __C99__FUNC__ \
00908 || defined __cplusplus || defined _MSC_VER)
00909 static void
00910 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
00911 #else
00912 static void
00913 yy_reduce_print (yyvsp, yyrule)
00914 YYSTYPE *yyvsp;
00915 int yyrule;
00916 #endif
00917 {
00918 int yynrhs = yyr2[yyrule];
00919 int yyi;
00920 unsigned long int yylno = yyrline[yyrule];
00921 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00922 yyrule - 1, yylno);
00923
00924 for (yyi = 0; yyi < yynrhs; yyi++)
00925 {
00926 YYFPRINTF (stderr, " $%d = ", yyi + 1);
00927 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00928 &(yyvsp[(yyi + 1) - (yynrhs)])
00929 );
00930 YYFPRINTF (stderr, "\n");
00931 }
00932 }
00933
00934 # define YY_REDUCE_PRINT(Rule) \
00935 do { \
00936 if (yydebug) \
00937 yy_reduce_print (yyvsp, Rule); \
00938 } while (YYID (0))
00939
00940
00941
00942 int yydebug;
00943 #else
00944 # define YYDPRINTF(Args)
00945 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00946 # define YY_STACK_PRINT(Bottom, Top)
00947 # define YY_REDUCE_PRINT(Rule)
00948 #endif
00949
00950
00951
00952 #ifndef YYINITDEPTH
00953 # define YYINITDEPTH 200
00954 #endif
00955
00956
00957
00958
00959
00960
00961
00962
00963 #ifndef YYMAXDEPTH
00964 # define YYMAXDEPTH 10000
00965 #endif
00966
00967
00968
00969 #if YYERROR_VERBOSE
00970
00971 # ifndef yystrlen
00972 # if defined __GLIBC__ && defined _STRING_H
00973 # define yystrlen strlen
00974 # else
00975
00976 #if (defined __STDC__ || defined __C99__FUNC__ \
00977 || defined __cplusplus || defined _MSC_VER)
00978 static YYSIZE_T
00979 yystrlen (const char *yystr)
00980 #else
00981 static YYSIZE_T
00982 yystrlen (yystr)
00983 const char *yystr;
00984 #endif
00985 {
00986 YYSIZE_T yylen;
00987 for (yylen = 0; yystr[yylen]; yylen++)
00988 continue;
00989 return yylen;
00990 }
00991 # endif
00992 # endif
00993
00994 # ifndef yystpcpy
00995 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
00996 # define yystpcpy stpcpy
00997 # else
00998
00999
01000 #if (defined __STDC__ || defined __C99__FUNC__ \
01001 || defined __cplusplus || defined _MSC_VER)
01002 static char *
01003 yystpcpy (char *yydest, const char *yysrc)
01004 #else
01005 static char *
01006 yystpcpy (yydest, yysrc)
01007 char *yydest;
01008 const char *yysrc;
01009 #endif
01010 {
01011 char *yyd = yydest;
01012 const char *yys = yysrc;
01013
01014 while ((*yyd++ = *yys++) != '\0')
01015 continue;
01016
01017 return yyd - 1;
01018 }
01019 # endif
01020 # endif
01021
01022 # ifndef yytnamerr
01023
01024
01025
01026
01027
01028
01029
01030 static YYSIZE_T
01031 yytnamerr (char *yyres, const char *yystr)
01032 {
01033 if (*yystr == '"')
01034 {
01035 YYSIZE_T yyn = 0;
01036 char const *yyp = yystr;
01037
01038 for (;;)
01039 switch (*++yyp)
01040 {
01041 case '\'':
01042 case ',':
01043 goto do_not_strip_quotes;
01044
01045 case '\\':
01046 if (*++yyp != '\\')
01047 goto do_not_strip_quotes;
01048
01049 default:
01050 if (yyres)
01051 yyres[yyn] = *yyp;
01052 yyn++;
01053 break;
01054
01055 case '"':
01056 if (yyres)
01057 yyres[yyn] = '\0';
01058 return yyn;
01059 }
01060 do_not_strip_quotes: ;
01061 }
01062
01063 if (! yyres)
01064 return yystrlen (yystr);
01065
01066 return yystpcpy (yyres, yystr) - yyres;
01067 }
01068 # endif
01069
01070
01071
01072
01073
01074
01075
01076
01077 static YYSIZE_T
01078 yysyntax_error (char *yyresult, int yystate, int yychar)
01079 {
01080 int yyn = yypact[yystate];
01081
01082 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01083 return 0;
01084 else
01085 {
01086 int yytype = YYTRANSLATE (yychar);
01087 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01088 YYSIZE_T yysize = yysize0;
01089 YYSIZE_T yysize1;
01090 int yysize_overflow = 0;
01091 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01092 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01093 int yyx;
01094
01095 # if 0
01096
01097
01098 YY_("syntax error, unexpected %s");
01099 YY_("syntax error, unexpected %s, expecting %s");
01100 YY_("syntax error, unexpected %s, expecting %s or %s");
01101 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01102 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01103 # endif
01104 char *yyfmt;
01105 char const *yyf;
01106 static char const yyunexpected[] = "syntax error, unexpected %s";
01107 static char const yyexpecting[] = ", expecting %s";
01108 static char const yyor[] = " or %s";
01109 char yyformat[sizeof yyunexpected
01110 + sizeof yyexpecting - 1
01111 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01112 * (sizeof yyor - 1))];
01113 char const *yyprefix = yyexpecting;
01114
01115
01116
01117 int yyxbegin = yyn < 0 ? -yyn : 0;
01118
01119
01120 int yychecklim = YYLAST - yyn + 1;
01121 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01122 int yycount = 1;
01123
01124 yyarg[0] = yytname[yytype];
01125 yyfmt = yystpcpy (yyformat, yyunexpected);
01126
01127 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01128 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01129 {
01130 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01131 {
01132 yycount = 1;
01133 yysize = yysize0;
01134 yyformat[sizeof yyunexpected - 1] = '\0';
01135 break;
01136 }
01137 yyarg[yycount++] = yytname[yyx];
01138 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01139 yysize_overflow |= (yysize1 < yysize);
01140 yysize = yysize1;
01141 yyfmt = yystpcpy (yyfmt, yyprefix);
01142 yyprefix = yyor;
01143 }
01144
01145 yyf = YY_(yyformat);
01146 yysize1 = yysize + yystrlen (yyf);
01147 yysize_overflow |= (yysize1 < yysize);
01148 yysize = yysize1;
01149
01150 if (yysize_overflow)
01151 return YYSIZE_MAXIMUM;
01152
01153 if (yyresult)
01154 {
01155
01156
01157
01158 char *yyp = yyresult;
01159 int yyi = 0;
01160 while ((*yyp = *yyf) != '\0')
01161 {
01162 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01163 {
01164 yyp += yytnamerr (yyp, yyarg[yyi++]);
01165 yyf += 2;
01166 }
01167 else
01168 {
01169 yyp++;
01170 yyf++;
01171 }
01172 }
01173 }
01174 return yysize;
01175 }
01176 }
01177 #endif
01178
01179
01180
01181
01182
01183
01184
01185 #if (defined __STDC__ || defined __C99__FUNC__ \
01186 || defined __cplusplus || defined _MSC_VER)
01187 static void
01188 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01189 #else
01190 static void
01191 yydestruct (yymsg, yytype, yyvaluep)
01192 const char *yymsg;
01193 int yytype;
01194 YYSTYPE *yyvaluep;
01195 #endif
01196 {
01197 YYUSE (yyvaluep);
01198
01199 if (!yymsg)
01200 yymsg = "Deleting";
01201 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01202
01203 switch (yytype)
01204 {
01205
01206 default:
01207 break;
01208 }
01209 }
01210
01211
01212 #ifdef YYPARSE_PARAM
01213 #if defined __STDC__ || defined __cplusplus
01214 int yyparse (void *YYPARSE_PARAM);
01215 #else
01216 int yyparse ();
01217 #endif
01218 #else
01219 #if defined __STDC__ || defined __cplusplus
01220 int yyparse (void);
01221 #else
01222 int yyparse ();
01223 #endif
01224 #endif
01225
01226
01227
01228 int yychar;
01229
01230
01231 YYSTYPE yylval;
01232
01233
01234 int yynerrs;
01235
01236
01237
01238
01239
01240
01241
01242 #ifdef YYPARSE_PARAM
01243 #if (defined __STDC__ || defined __C99__FUNC__ \
01244 || defined __cplusplus || defined _MSC_VER)
01245 int
01246 yyparse (void *YYPARSE_PARAM)
01247 #else
01248 int
01249 yyparse (YYPARSE_PARAM)
01250 void *YYPARSE_PARAM;
01251 #endif
01252 #else
01253 #if (defined __STDC__ || defined __C99__FUNC__ \
01254 || defined __cplusplus || defined _MSC_VER)
01255 int
01256 yyparse (void)
01257 #else
01258 int
01259 yyparse ()
01260
01261 #endif
01262 #endif
01263 {
01264
01265
01266 int yystate;
01267
01268 int yyerrstatus;
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278 yytype_int16 yyssa[YYINITDEPTH];
01279 yytype_int16 *yyss;
01280 yytype_int16 *yyssp;
01281
01282
01283 YYSTYPE yyvsa[YYINITDEPTH];
01284 YYSTYPE *yyvs;
01285 YYSTYPE *yyvsp;
01286
01287 YYSIZE_T yystacksize;
01288
01289 int yyn;
01290 int yyresult;
01291
01292 int yytoken;
01293
01294
01295 YYSTYPE yyval;
01296
01297 #if YYERROR_VERBOSE
01298
01299 char yymsgbuf[128];
01300 char *yymsg = yymsgbuf;
01301 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01302 #endif
01303
01304 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
01305
01306
01307
01308 int yylen = 0;
01309
01310 yytoken = 0;
01311 yyss = yyssa;
01312 yyvs = yyvsa;
01313 yystacksize = YYINITDEPTH;
01314
01315 YYDPRINTF ((stderr, "Starting parse\n"));
01316
01317 yystate = 0;
01318 yyerrstatus = 0;
01319 yynerrs = 0;
01320 yychar = YYEMPTY;
01321
01322
01323
01324
01325
01326 yyssp = yyss;
01327 yyvsp = yyvs;
01328
01329 goto yysetstate;
01330
01331
01332
01333
01334 yynewstate:
01335
01336
01337 yyssp++;
01338
01339 yysetstate:
01340 *yyssp = yystate;
01341
01342 if (yyss + yystacksize - 1 <= yyssp)
01343 {
01344
01345 YYSIZE_T yysize = yyssp - yyss + 1;
01346
01347 #ifdef yyoverflow
01348 {
01349
01350
01351
01352 YYSTYPE *yyvs1 = yyvs;
01353 yytype_int16 *yyss1 = yyss;
01354
01355
01356
01357
01358
01359 yyoverflow (YY_("memory exhausted"),
01360 &yyss1, yysize * sizeof (*yyssp),
01361 &yyvs1, yysize * sizeof (*yyvsp),
01362 &yystacksize);
01363
01364 yyss = yyss1;
01365 yyvs = yyvs1;
01366 }
01367 #else
01368 # ifndef YYSTACK_RELOCATE
01369 goto yyexhaustedlab;
01370 # else
01371
01372 if (YYMAXDEPTH <= yystacksize)
01373 goto yyexhaustedlab;
01374 yystacksize *= 2;
01375 if (YYMAXDEPTH < yystacksize)
01376 yystacksize = YYMAXDEPTH;
01377
01378 {
01379 yytype_int16 *yyss1 = yyss;
01380 union yyalloc *yyptr =
01381 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01382 if (! yyptr)
01383 goto yyexhaustedlab;
01384 YYSTACK_RELOCATE (yyss_alloc, yyss);
01385 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
01386 # undef YYSTACK_RELOCATE
01387 if (yyss1 != yyssa)
01388 YYSTACK_FREE (yyss1);
01389 }
01390 # endif
01391 #endif
01392
01393 yyssp = yyss + yysize - 1;
01394 yyvsp = yyvs + yysize - 1;
01395
01396 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01397 (unsigned long int) yystacksize));
01398
01399 if (yyss + yystacksize - 1 <= yyssp)
01400 YYABORT;
01401 }
01402
01403 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01404
01405 if (yystate == YYFINAL)
01406 YYACCEPT;
01407
01408 goto yybackup;
01409
01410
01411
01412
01413 yybackup:
01414
01415
01416
01417
01418
01419 yyn = yypact[yystate];
01420 if (yyn == YYPACT_NINF)
01421 goto yydefault;
01422
01423
01424
01425
01426 if (yychar == YYEMPTY)
01427 {
01428 YYDPRINTF ((stderr, "Reading a token: "));
01429 yychar = YYLEX;
01430 }
01431
01432 if (yychar <= YYEOF)
01433 {
01434 yychar = yytoken = YYEOF;
01435 YYDPRINTF ((stderr, "Now at end of input.\n"));
01436 }
01437 else
01438 {
01439 yytoken = YYTRANSLATE (yychar);
01440 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01441 }
01442
01443
01444
01445 yyn += yytoken;
01446 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01447 goto yydefault;
01448 yyn = yytable[yyn];
01449 if (yyn <= 0)
01450 {
01451 if (yyn == 0 || yyn == YYTABLE_NINF)
01452 goto yyerrlab;
01453 yyn = -yyn;
01454 goto yyreduce;
01455 }
01456
01457
01458
01459 if (yyerrstatus)
01460 yyerrstatus--;
01461
01462
01463 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01464
01465
01466 yychar = YYEMPTY;
01467
01468 yystate = yyn;
01469 *++yyvsp = yylval;
01470
01471 goto yynewstate;
01472
01473
01474
01475
01476
01477 yydefault:
01478 yyn = yydefact[yystate];
01479 if (yyn == 0)
01480 goto yyerrlab;
01481 goto yyreduce;
01482
01483
01484
01485
01486
01487 yyreduce:
01488
01489 yylen = yyr2[yyn];
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499 yyval = yyvsp[1-yylen];
01500
01501
01502 YY_REDUCE_PRINT (yyn);
01503 switch (yyn)
01504 {
01505 case 4:
01506
01507
01508 #line 138 "ao-syntax.y"
01509 { print(globhead,"%s\n",(yyvsp[(1) - (1)].token)); ;}
01510 break;
01511
01512 case 5:
01513
01514
01515 #line 139 "ao-syntax.y"
01516 {assert(pascal); print(useslist,", %s",(yyvsp[(2) - (3)].token));;}
01517 break;
01518
01519 case 6:
01520
01521
01522 #line 140 "ao-syntax.y"
01523 { print(globhead,"class %s;\n",(yyvsp[(2) - (3)].token)); ;}
01524 break;
01525
01526 case 7:
01527
01528
01529 #line 142 "ao-syntax.y"
01530 {
01531 field2init.clear();
01532 if (!pascal)
01533 {
01534 print(object,"class Active%s: public ActiveObject< Active%s_msg_* >\n{\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01535 print(object," friend class %s;\n",(yyvsp[(2) - (3)].token));
01536 print(object," %s * self;\n",(yyvsp[(2) - (3)].token));
01537 print(object,
01538 " virtual elementResult handle( Active%s_msg_* cmd)\n"
01539 " {\n"
01540 " if (cmd) return cmd->run(this);\n"
01541 " else return Done;\n"
01542 " };\n",(yyvsp[(2) - (3)].token));
01543 print(globhead, "class %s;\n",(yyvsp[(2) - (3)].token));
01544 print(globhead, "class Active%s;\n",(yyvsp[(2) - (3)].token));
01545 print(globhead, "#ifdef TRACE_MESSAGES\n"
01546 "#define ENTER_MSG cerr << \"Start \" << declaration() << \"\\n\";\n"
01547 "#define LEAVE_MSG cerr << \"Stop \" << declaration() << \"\\n\";\n"
01548 "#endif\n");
01549 print(globhead, "#ifndef ENTER_MSG\n"
01550 "#define ENTER_MSG ;\n"
01551 "#endif\n"
01552 "#ifndef LEAVE_MSG\n"
01553 "#define LEAVE_MSG ;\n"
01554 "#endif\n");
01555 }
01556 else
01557 {
01558
01559 print(globhead,"Type TActive%s=Class;\n",(yyvsp[(2) - (3)].token));
01560 print(globhead,"Type PActive%s=^TActive%s;\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01561 print(globhead,"Type T%s=Class;\n",(yyvsp[(2) - (3)].token));
01562 print(globhead,"Type TActive%s_msg_=Class;\n",(yyvsp[(2) - (3)].token));
01563 print(globhead,"Type P%s=^T%s;\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01564 print(globhead,"Type TActiveObject_TActive%s_msg_=specialize TActiveObject<TActive%s_msg_>;\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01565
01566
01567 print(object,"Type TActive%s=Class(TActiveObject_TActive%s_msg_)\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01568 print(object," public meta: T%s;\n",(yyvsp[(2) - (3)].token));
01569 print(object," public function handle(cmd: TActive%s_msg_): elementResult; override;\n",(yyvsp[(2) - (3)].token));
01570 print(impl,"function TActive%s.handle(cmd: TActive%s_msg_): elementResult;\n begin\n",(yyvsp[(2) - (3)].token));
01571 print(impl," if (assigned(cmd)) then Result:=cmd.run(self)\n"
01572 " else Result:=Done;\n"
01573 " end;\n\n");
01574 }
01575 if (!pascal)
01576 {
01577 print(msgs1,
01578 "/**\n"
01579 " * Represents the basic message that is used to queue or deliver a call to \n"
01580 " * the true Active%s. Active%s_msg_ has a run method which is invoked\n"
01581 " * by ActiveObject whenever it wants to handle the message. For each \n"
01582 " * declared method in the active object description, a specific subclass\n"
01583 " * of Active%s_msg_ has been generated. See inheritance diagram.\n"
01584 " * The message classes are automatically instantiated by the active object\n"
01585 " * stub %s\n"
01586 " */\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01587
01588 print(msgs1, "class Active%s_msg_\n",(yyvsp[(2) - (3)].token));
01589 print(msgs1, "{\n"
01590 " public:\n"
01591 " /**\n"
01592 " * Called by ActiveObject to handle this queued message.\n"
01593 " * %%arg caller is the Active%s itself.\n"
01594 " */\n"
01595 " virtual elementResult run(Active%s * /* caller */)\n"
01596 " {\n"
01597 " assert(0);\n"
01598 " }\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01599 print(msgs1,
01600 " /**\n"
01601 " * Returns the name of this message. Since this is the message baseclass\n"
01602 " * it has no identity and will return 'Unknown Message' \n"
01603 " */\n"
01604 " virtual string declaration()\n"
01605 " {\n"
01606 " return \"Unknown message\";\n"
01607 " }\n"
01608 "};\n\n");
01609 print(meta,
01610 "/**\n"
01611 " * Represents the stub that will transform each incoming call (method)\n"
01612 " * to an object subclassed from type Active%s_msg_\n"
01613 " * The stub itself has an instance of the true active object.\n"
01614 " */\n",(yyvsp[(2) - (3)].token));
01615 print(meta, "class %s\n{\n",(yyvsp[(2) - (3)].token));
01616 print(meta, " private:\n"
01617 " /**\n"
01618 " * The object that is covered for by this stub. The fact that the\n"
01619 " * stub allocates the object ensures that only one of it exists and that any\n"
01620 " * interaction must go through the stub. As such it is kept private.\n"
01621 " */\n"
01622 " Active%s object;\n",(yyvsp[(2) - (3)].token));
01623 print(meta," public:\n"
01624 " /**\n"
01625 " * The constructor of the stub will also directly initalize the main\n"
01626 " * object. Because object construction and delayed calls interfere\n"
01627 " * somewhat we prohibit the actual implementation (and especially use)\n"
01628 " * of a specialized Active Object constructor. Instead, simply the name\n"
01629 " * is passed to the object. If you need to initialize the stub, you\n"
01630 " * should consider adding an init message to the active object and\n"
01631 " * calling (well sending a message to) it directly when the stub is\n"
01632 " * generated.\n"
01633 " */\n");
01634 print(meta, " %s(string name=\"%s\"): object(this, name) {};\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01635 current_ao = strdup((yyvsp[(2) - (3)].token));
01636 }
01637 else
01638 {
01639
01640 print(msgs1,
01641 "(*\n"
01642 " * Represents the basic message that is used to queue or deliver a call to \n"
01643 " * the true Active%s. Active%s_msg_ has a run method which is invoked\n"
01644 " * by ActiveObject whenever it wants to handle the message. For each \n"
01645 " * declared method in the active object description, a specific subclass\n"
01646 " * of Active%s_msg_ has been generated. See inheritance diagram.\n"
01647 " * The message classes are automatically instantiated by the active object\n"
01648 " * stub %s\n"
01649 " *)\n",(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01650
01651 print(msgs1,"Type TActive%s_msg_=class\n",(yyvsp[(2) - (3)].token));
01652 print(msgs1," public function run(caller: TActive%s): elementResult; virtual; abstract;\n",(yyvsp[(2) - (3)].token));
01653 print(msgs1," end;\n\n");
01654 print(meta,"Type T%s=class\n",(yyvsp[(2) - (3)].token));
01655 print(meta, " private\n"
01656 " _object: TActive%s;\n",(yyvsp[(2) - (3)].token));
01657 print(meta," public\n");
01658 print(meta, " Constructor Create(bloody_local_var_name: string=\'%s\');\n",(yyvsp[(2) - (3)].token));
01659
01660 print(impl,"Constructor T%s.Create(bloody_local_var_name: string);\nbegin\n _object:=TActive%s.Create(self,bloody_local_var_name);\nend;\n\n",
01661 (yyvsp[(2) - (3)].token),(yyvsp[(2) - (3)].token));
01662 current_ao = strdup((yyvsp[(2) - (3)].token));
01663 }
01664 ;}
01665 break;
01666
01667 case 8:
01668
01669
01670 #line 278 "ao-syntax.y"
01671 {
01672 if (!pascal)
01673 {
01674 print(object,
01675 " protected:\n Active%s(%s* s, string name):\n"
01676 " ActiveObject< Active%s_msg_ * >(name), self(s)\n",(yyvsp[(2) - (7)].token),(yyvsp[(2) - (7)].token),(yyvsp[(2) - (7)].token));
01677 print(object, " {\n");
01678 }
01679 else
01680 {
01681 print(object," public constructor Create(s: T%s; bloody_local_name: string);\n",(yyvsp[(2) - (7)].token));
01682 print(impl,"constructor TActive%s.Create(s: T%s; bloody_local_name: string);\n"
01683 " begin\n"
01684 " inherited Create(bloody_local_name);\n"
01685 " meta:=s;\n",(yyvsp[(2) - (7)].token),(yyvsp[(2) - (7)].token));
01686 }
01687 map<string,string>::iterator it=field2init.begin();
01688 while(it!=field2init.end())
01689 {
01690 if (it->second!="")
01691 {
01692 if (pascal)
01693 print(impl," %s := %s;\n",it->first.c_str(), it->second.c_str());
01694 else
01695 print(object," %s = %s;\n",it->first.c_str(), it->second.c_str());
01696 }
01697 it++;
01698 }
01699 field2init.clear();
01700 if (!pascal)
01701 {
01702 print(object, " };\n");
01703 print(object,"};\n\n");
01704 print(meta,"};\n\n");
01705 }
01706 else
01707 {
01708 print(object," end;\n\n");
01709 print(impl," end;\n\n");
01710 print(meta,"end;\n\n");
01711 }
01712 ;}
01713 break;
01714
01715 case 10:
01716
01717
01718 #line 323 "ao-syntax.y"
01719 {;}
01720 break;
01721
01722 case 11:
01723
01724
01725 #line 327 "ao-syntax.y"
01726 {if (!pascal)
01727 print(object," %s %s;\n",(yyvsp[(1) - (3)].token),(yyvsp[(2) - (3)].token));
01728 else
01729 print(object," public %s: %s;\n",(yyvsp[(2) - (3)].token),(yyvsp[(1) - (3)].token));
01730 field2init[(yyvsp[(2) - (3)].token)]="";
01731 ;}
01732 break;
01733
01734 case 12:
01735
01736
01737 #line 334 "ao-syntax.y"
01738 {
01739 if (!pascal)
01740 print(object," %s %s;\n",(yyvsp[(1) - (5)].token),(yyvsp[(2) - (5)].token));
01741 else
01742 print(object," public %s: %s;\n",(yyvsp[(2) - (5)].token),(yyvsp[(1) - (5)].token));
01743 field2init[(yyvsp[(2) - (5)].token)]=(yyvsp[(4) - (5)].token);
01744 ;}
01745 break;
01746
01747 case 13:
01748
01749
01750 #line 342 "ao-syntax.y"
01751 {print(object," %s %s %s;\n",(yyvsp[(1) - (4)].token),(yyvsp[(2) - (4)].token),(yyvsp[(3) - (4)].token)); field2init[(yyvsp[(3) - (4)].token)]=""; ;}
01752 break;
01753
01754 case 14:
01755
01756
01757 #line 344 "ao-syntax.y"
01758 {print(object," %s %s %s;\n",(yyvsp[(1) - (6)].token),(yyvsp[(2) - (6)].token),(yyvsp[(3) - (6)].token)); field2init[(yyvsp[(3) - (6)].token)]=(yyvsp[(5) - (6)].token); ;}
01759 break;
01760
01761 case 15:
01762
01763
01764 #line 345 "ao-syntax.y"
01765 {print(object," %s %s(%s);\n",(yyvsp[(1) - (4)].token),(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args)));;}
01766 break;
01767
01768 case 16:
01769
01770
01771 #line 347 "ao-syntax.y"
01772 {
01773 print(meta,
01774 " public:\n"
01775 " %s %s(%s);\n",(yyvsp[(2) - (5)].token),(yyvsp[(3) - (5)].token),args2str((yyvsp[(4) - (5)].args)));
01776 ;}
01777 break;
01778
01779 case 17:
01780
01781
01782 #line 353 "ao-syntax.y"
01783 {
01784
01785 if (!pascal)
01786 {
01787 print(object," public: elementResult %s(%s);\n",(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args)));
01788 print(object," protected: void queue_%s(%s);\n",(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args)));
01789 }
01790 else
01791 {
01792 print(object," public function %s(%s): elementResult;\n",(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),"; ",""));
01793 print(object," public procedure queue_%s(%s);\n",(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),"; ", "bloody_local_var_"));
01794 }
01795
01796
01797 if (!pascal)
01798 {
01799 print(msgs,"class Active%s_msg_%s: public Active%s_msg_\n",current_ao,(yyvsp[(2) - (4)].token),current_ao);
01800 print(msgs,"{\n %s;\n",args2str((yyvsp[(3) - (4)].args),";\n "));
01801 print(msgs," public:\n Active%s_msg_%s(%s)",current_ao,(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args)));
01802 if ((yyvsp[(3) - (4)].args)->size())
01803 print(msgs," : %s\n {\n };\n",copyargs((yyvsp[(3) - (4)].args)));
01804 else
01805 print(msgs,"\n {\n };\n");
01806 print(msgs, " virtual string declaration()\n"
01807 " {\n"
01808 " return \"%s::%s(%s)\";\n"
01809 " }\n",current_ao,(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args))
01810 );
01811 print(msgs," virtual elementResult run(Active%s * ao)\n",current_ao);
01812 print(msgs," {\n ENTER_MSG;\n");
01813 print(msgs," elementResult res = ao->%s(%s);\n",(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args)));
01814 print(msgs," LEAVE_MSG;\n",(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args)));
01815 print(msgs," return res;\n };\n",(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args)));
01816 print(msgs,"};\n\n");
01817 }
01818 else
01819 {
01820 print(globhead,"Type TActive%s_msg_%s=Class;\n",current_ao,(yyvsp[(2) - (4)].token));
01821 print(msgs,"Type TActive%s_msg_%s=Class(TActive%s_msg_)\n",current_ao,(yyvsp[(2) - (4)].token),current_ao);
01822 if ((yyvsp[(3) - (4)].args)->size())
01823 print(msgs," public %s;\n",args2str((yyvsp[(3) - (4)].args),";\n "));
01824 print(msgs," constructor Create(%s);\n",args2str((yyvsp[(3) - (4)].args),"; ","bloody_local_var_"));
01825 print(impl,"constructor TActive%s_msg_%s.Create(%s);\n begin\n",current_ao,(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),"; ","bloody_local_var_"));
01826
01827 if ((yyvsp[(3) - (4)].args)->size())
01828 print(impl,"%s end;\n\n",copyargs((yyvsp[(3) - (4)].args)));
01829 else
01830 print(impl," end;\n\n");
01831
01832 print(msgs," public function run(ao: TActive%s): elementResult; override;\n",current_ao);
01833 print(impl,"function TActive%s_msg_%s.run(ao: TActive%s): elementResult;\n begin\n",current_ao, (yyvsp[(2) - (4)].token), current_ao);
01834 print(impl," Result:=ao.%s(%s);\n end;\n\n",(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args)));
01835 print(msgs,"end;\n\n");
01836 }
01837
01838 if (!pascal)
01839 {
01840 print(object2,"inline void Active%s::queue_%s(%s)\n",current_ao,(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args)));
01841 print(object2," {\n");
01842 print(object2," push(new Active%s_msg_%s(%s));\n };\n",
01843 current_ao,(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args)));
01844 }
01845 else
01846 {
01847 print(impl,"procedure TActive%s.queue_%s(%s);\n begin\n",current_ao,(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),"; ","bloody_local_var_"));
01848 print(impl," push(TActive%s_msg_%s.Create(%s));\n end;\n\n",
01849 current_ao,(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args),"bloody_local_var_"));
01850 }
01851 if (!pascal)
01852 {
01853 print(meta, " public:\n void %s(%s)\n",(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),", "));
01854 print(meta, " {\n object.queue_%s(%s);\n };\n",(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args)));
01855 }
01856 else
01857 {
01858 print(meta, " public procedure %s(%s);\n",(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),"; ","bloody_local_var_"));
01859 print(impl, "procedure T%s.%s(%s);\n",current_ao,(yyvsp[(2) - (4)].token),args2str((yyvsp[(3) - (4)].args),"; ","bloody_local_var_"));
01860 print(impl, " begin\n _object.queue_%s(%s);\n end;\n\n",(yyvsp[(2) - (4)].token),argnames2str((yyvsp[(3) - (4)].args),"bloody_local_var_"));
01861 }
01862 ;}
01863 break;
01864
01865 case 18:
01866
01867
01868 #line 435 "ao-syntax.y"
01869 {(yyval.token)=cat((yyvsp[(1) - (2)].token),"*");;}
01870 break;
01871
01872 case 20:
01873
01874
01875 #line 437 "ao-syntax.y"
01876 {(yyval.token)=cat(cat((yyvsp[(1) - (4)].token)," < "),cat((yyvsp[(3) - (4)].token)," > ")); ;}
01877 break;
01878
01879 case 21:
01880
01881
01882 #line 438 "ao-syntax.y"
01883 {(yyval.token)= cat(cat(cat((yyvsp[(1) - (6)].token), "<"), cat((yyvsp[(3) - (6)].token),",")), cat((yyvsp[(5) - (6)].token),">"));;}
01884 break;
01885
01886 case 22:
01887
01888
01889 #line 441 "ao-syntax.y"
01890 {(yyval.token)=strdup("volatile");;}
01891 break;
01892
01893 case 23:
01894
01895
01896 #line 444 "ao-syntax.y"
01897 {(yyval.args)=(yyvsp[(2) - (3)].args);;}
01898 break;
01899
01900 case 24:
01901
01902
01903 #line 445 "ao-syntax.y"
01904 { (yyval.args)=new vector<s_arg>();;}
01905 break;
01906
01907 case 25:
01908
01909
01910 #line 448 "ao-syntax.y"
01911 {(yyval.args)=(yyvsp[(1) - (3)].args); (yyval.args)->push_back((yyvsp[(3) - (3)].arg));;}
01912 break;
01913
01914 case 26:
01915
01916
01917 #line 449 "ao-syntax.y"
01918 {(yyval.args)=new vector<s_arg>(); (yyval.args)->push_back((yyvsp[(1) - (1)].arg));;}
01919 break;
01920
01921 case 27:
01922
01923
01924 #line 452 "ao-syntax.y"
01925 {(yyval.arg).name = (yyvsp[(2) - (2)].token); (yyval.arg).type=(yyvsp[(1) - (2)].token);;}
01926 break;
01927
01928
01929
01930
01931 #line 1932 "ao-syntax.cpp"
01932 default: break;
01933 }
01934 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
01935
01936 YYPOPSTACK (yylen);
01937 yylen = 0;
01938 YY_STACK_PRINT (yyss, yyssp);
01939
01940 *++yyvsp = yyval;
01941
01942
01943
01944
01945
01946 yyn = yyr1[yyn];
01947
01948 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01949 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01950 yystate = yytable[yystate];
01951 else
01952 yystate = yydefgoto[yyn - YYNTOKENS];
01953
01954 goto yynewstate;
01955
01956
01957
01958
01959
01960 yyerrlab:
01961
01962 if (!yyerrstatus)
01963 {
01964 ++yynerrs;
01965 #if ! YYERROR_VERBOSE
01966 yyerror (YY_("syntax error"));
01967 #else
01968 {
01969 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
01970 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
01971 {
01972 YYSIZE_T yyalloc = 2 * yysize;
01973 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
01974 yyalloc = YYSTACK_ALLOC_MAXIMUM;
01975 if (yymsg != yymsgbuf)
01976 YYSTACK_FREE (yymsg);
01977 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
01978 if (yymsg)
01979 yymsg_alloc = yyalloc;
01980 else
01981 {
01982 yymsg = yymsgbuf;
01983 yymsg_alloc = sizeof yymsgbuf;
01984 }
01985 }
01986
01987 if (0 < yysize && yysize <= yymsg_alloc)
01988 {
01989 (void) yysyntax_error (yymsg, yystate, yychar);
01990 yyerror (yymsg);
01991 }
01992 else
01993 {
01994 yyerror (YY_("syntax error"));
01995 if (yysize != 0)
01996 goto yyexhaustedlab;
01997 }
01998 }
01999 #endif
02000 }
02001
02002
02003
02004 if (yyerrstatus == 3)
02005 {
02006
02007
02008
02009 if (yychar <= YYEOF)
02010 {
02011
02012 if (yychar == YYEOF)
02013 YYABORT;
02014 }
02015 else
02016 {
02017 yydestruct ("Error: discarding",
02018 yytoken, &yylval);
02019 yychar = YYEMPTY;
02020 }
02021 }
02022
02023
02024
02025 goto yyerrlab1;
02026
02027
02028
02029
02030
02031 yyerrorlab:
02032
02033
02034
02035
02036 if ( 0)
02037 goto yyerrorlab;
02038
02039
02040
02041 YYPOPSTACK (yylen);
02042 yylen = 0;
02043 YY_STACK_PRINT (yyss, yyssp);
02044 yystate = *yyssp;
02045 goto yyerrlab1;
02046
02047
02048
02049
02050
02051 yyerrlab1:
02052 yyerrstatus = 3;
02053
02054 for (;;)
02055 {
02056 yyn = yypact[yystate];
02057 if (yyn != YYPACT_NINF)
02058 {
02059 yyn += YYTERROR;
02060 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02061 {
02062 yyn = yytable[yyn];
02063 if (0 < yyn)
02064 break;
02065 }
02066 }
02067
02068
02069 if (yyssp == yyss)
02070 YYABORT;
02071
02072
02073 yydestruct ("Error: popping",
02074 yystos[yystate], yyvsp);
02075 YYPOPSTACK (1);
02076 yystate = *yyssp;
02077 YY_STACK_PRINT (yyss, yyssp);
02078 }
02079
02080 *++yyvsp = yylval;
02081
02082
02083
02084 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02085
02086 yystate = yyn;
02087 goto yynewstate;
02088
02089
02090
02091
02092
02093 yyacceptlab:
02094 yyresult = 0;
02095 goto yyreturn;
02096
02097
02098
02099
02100 yyabortlab:
02101 yyresult = 1;
02102 goto yyreturn;
02103
02104 #if !defined(yyoverflow) || YYERROR_VERBOSE
02105
02106
02107
02108 yyexhaustedlab:
02109 yyerror (YY_("memory exhausted"));
02110 yyresult = 2;
02111
02112 #endif
02113
02114 yyreturn:
02115 if (yychar != YYEMPTY)
02116 yydestruct ("Cleanup: discarding lookahead",
02117 yytoken, &yylval);
02118
02119
02120 YYPOPSTACK (yylen);
02121 YY_STACK_PRINT (yyss, yyssp);
02122 while (yyssp != yyss)
02123 {
02124 yydestruct ("Cleanup: popping",
02125 yystos[*yyssp], yyvsp);
02126 YYPOPSTACK (1);
02127 }
02128 #ifndef yyoverflow
02129 if (yyss != yyssa)
02130 YYSTACK_FREE (yyss);
02131 #endif
02132 #if YYERROR_VERBOSE
02133 if (yymsg != yymsgbuf)
02134 YYSTACK_FREE (yymsg);
02135 #endif
02136
02137 return YYID (yyresult);
02138 }
02139
02140
02141
02142
02143 #line 457 "ao-syntax.y"
02144
02145