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