Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / bin / tt_type_comp / frozen.mp_types_gram.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: frozen.mp_types_gram.C /main/4 1999/10/15 12:31:31 mgreess $ */
24
25 # line 16 "mp_types_gram.y"
26
27 #include <string.h>
28 #include <memory.h>
29 #include <stdlib.h>
30 #include "mp/mp_arg.h"
31 #include "mp_otype.h"
32 #include "mp_ptype.h"
33 #include "mp_signature.h"
34 #include "mp_types_table.h"
35
36 extern int yyleng;
37 extern char yytext[];
38
39
40 # line 33 "mp_types_gram.y"
41 typedef union
42 #ifdef __cplusplus
43         YYSTYPE
44 #endif
45         {
46         int             num;
47         char            *str;
48         } YYSTYPE;
49 # define PER_FILE 257
50 # define PER_SESSION 258
51 # define START 259
52 # define FILE_SCOPE 260
53 # define SESSION_SCOPE 261
54 # define FILE_IN_SESSION 262
55 # define REQUEST 263
56 # define NOTIFICATION 264
57 # define VOID_ARGS 265
58 # define QUEUE 266
59 # define OPNUM 267
60 # define IN 268
61 # define OUT 269
62 # define INOUT 270
63 # define OTYPE 271
64 # define INHERIT 272
65 # define FROM 273
66 # define PTYPE 274
67 # define OBSERVE 275
68 # define HANDLE 276
69 # define HANDLE_PUSH 277
70 # define HANDLE_ROTATE 278
71 # define COLON 279
72 # define SEMICOLON 280
73 # define LCURL 281
74 # define RCURL 282
75 # define INFER 283
76 # define LPAREN 284
77 # define RPAREN 285
78 # define COMMA 286
79 # define EQUAL 287
80 # define CONTEXT 288
81 # define TT_IDENTIFIER 289
82 # define TT_STRING 290
83 # define TT_NUMBER 291
84
85 #include <malloc.h>
86 #include <memory.h>
87
88 #if defined (__hpux)
89 /*
90  * On HP MAXINT is defined in both <values.h> and <sys/param.h>
91  */
92 #undef MAXINT
93 #endif
94 #include <values.h>
95
96 #ifdef __cplusplus
97
98 #ifndef yyerror
99         void yyerror(const char *);
100 #endif
101
102 #ifndef yylex
103 #ifdef __EXTERN_C__
104         extern "C" { int yylex(void); }
105 #else
106         int yylex(void);
107 #endif
108 #endif
109         int yyparse(void);
110
111 #endif
112 #define yyclearin yychar = -1
113 #define yyerrok yyerrflag = 0
114 extern int yychar;
115 extern int yyerrflag;
116 YYSTYPE yylval;
117 YYSTYPE yyval;
118 typedef int yytabelem;
119 #ifndef YYMAXDEPTH
120 #define YYMAXDEPTH 150
121 #endif
122 #if YYMAXDEPTH > 0
123 int yy_yys[YYMAXDEPTH], *yys = yy_yys;
124 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
125 #else   /* user does initial allocation */
126 int *yys;
127 YYSTYPE *yyv;
128 #endif
129 static int yymaxdepth = YYMAXDEPTH;
130 # define YYERRCODE 256
131
132 # line 427 "mp_types_gram.y"
133
134 yytabelem yyexca[] ={
135 -1, 1,
136         0, -1,
137         -2, 0,
138 -1, 87,
139         289, 60,
140         -2, 51,
141 -1, 88,
142         289, 60,
143         -2, 52,
144 -1, 89,
145         289, 60,
146         -2, 53,
147 -1, 90,
148         289, 60,
149         -2, 54,
150         };
151 # define YYNPROD 90
152 # define YYLAST 200
153 yytabelem yyact[]={
154
155     67,    66,   136,     8,   104,    76,     7,   107,    14,    53,
156    110,    12,    78,   134,   115,   116,    94,   124,    93,    69,
157     12,     5,    60,    61,    62,    63,    92,    91,   127,    54,
158     24,    25,    26,    27,    28,    10,   112,    18,    75,    32,
159     74,    73,    72,    71,    36,    35,    34,    33,    30,   104,
160     80,   130,   126,    84,    85,    86,    84,    85,    86,    98,
161     99,   100,    47,    48,    49,   122,   129,   103,   121,    77,
162    125,   106,    97,    68,    13,    52,    82,    11,     2,    87,
163      9,    31,    40,   105,   109,    83,    81,    79,   123,    96,
164     59,    58,    57,    56,    55,    45,    44,    37,    16,   132,
165    113,   101,    51,    23,    22,    39,    21,    20,    19,    38,
166     29,    17,    15,    50,     6,     4,     3,    41,    42,    43,
167     65,    64,    46,     1,     0,     0,     0,     0,     0,     0,
168      0,     0,     0,     0,     0,     0,    70,     0,     0,     0,
169      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
170      0,     0,    88,    89,    90,     0,     0,     0,     0,     0,
171      0,     0,    95,     0,     0,     0,     0,     0,     0,   102,
172      0,   108,     0,   111,     0,     0,     0,     0,     0,   114,
173      0,     0,     0,     0,     0,   117,   118,   120,   119,     0,
174      0,     0,     0,   128,     0,     0,     0,   133,   135,   131 };
175 yytabelem yypact[]={
176
177   -268,  -268,-10000000,-10000000,-10000000,-10000000,  -246,  -278,  -281,-10000000,
178 -10000000,-10000000,-10000000,-10000000,-10000000,  -245,  -247,  -231,  -241,-10000000,
179 -10000000,-10000000,-10000000,-10000000,  -232,  -233,  -234,  -235,-10000000,-10000000,
180   -281,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,  -195,  -281,-10000000,
181   -280,  -280,  -280,  -280,  -253,-10000000,  -290,-10000000,-10000000,-10000000,
182 -10000000,-10000000,  -265,-10000000,  -241,-10000000,-10000000,-10000000,-10000000,-10000000,
183   -236,  -237,  -238,  -239,  -242,  -285,-10000000,-10000000,  -276,  -215,
184 -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,  -256,  -258,  -267,
185 -10000000,  -270,-10000000,  -268,-10000000,-10000000,-10000000,  -201,  -201,  -201,
186   -201,  -269,  -282,-10000000,  -212,  -279,-10000000,  -280,-10000000,-10000000,
187 -10000000,  -244,-10000000,-10000000,  -281,  -271,-10000000,-10000000,-10000000,-10000000,
188 -10000000,  -265,-10000000,  -201,-10000000,-10000000,  -282,  -276,  -194,-10000000,
189   -266,  -214,-10000000,  -252,  -194,  -216,-10000000,-10000000,  -214,  -224,
190   -274,  -216,-10000000,-10000000,  -289,-10000000,-10000000 };
191 yytabelem yypgo[]={
192
193      0,   123,   122,   121,   120,    78,   116,   115,   114,   112,
194     81,    74,   111,   110,   109,   108,   107,   106,   104,   103,
195     82,   102,    75,    73,    69,   101,    77,   100,    72,    68,
196     70,    66,    99,    67,    98,    97,    96,    95,    94,    93,
197     92,    91,    90,    79,    89,    88,    87,    86,    76,    85,
198     84,    83,    71 };
199 yytabelem yyr1[]={
200
201      0,     1,     1,     5,     5,     6,    12,     8,    11,    13,
202     13,    14,    14,     9,     9,    15,    15,    15,    15,    16,
203     17,    18,    19,    20,    20,    21,    27,    25,    25,    32,
204     32,    33,    34,     7,    26,    35,    35,    37,    36,    36,
205     38,    38,    38,    38,     2,     2,     2,     4,     4,     3,
206      3,    39,    40,    41,    42,    10,    10,    43,    43,    44,
207     28,    28,    28,    28,    22,    23,    46,    46,    46,    47,
208     47,    48,    49,    49,    49,     5,    50,    24,    24,    51,
209     51,    52,    45,    45,    29,    29,    30,    30,    31,    31 };
210 yytabelem yyr2[]={
211
212      0,     2,     4,     2,     2,    11,     1,     9,     3,     0,
213      4,     3,     5,     0,     4,     2,     2,     2,     2,     7,
214      7,     7,     7,     0,     4,    13,     1,    14,     2,     0,
215      2,     5,     1,    17,     2,     0,     4,     7,     0,     4,
216      2,     2,     2,     2,     3,     3,     3,     3,     5,     2,
217      3,     7,     7,     7,     7,     0,     2,     0,     4,    13,
218      0,     3,     3,     3,     3,     6,     0,     2,     2,     6,
219      2,     7,     3,     3,     3,     3,     3,     0,     8,     6,
220      2,     3,     0,     8,     0,     3,     0,     3,     0,     7 };
221 yytabelem yychk[]={
222
223 -10000000,    -1,    -5,    -6,    -7,   289,    -8,   274,   271,    -5,
224    281,   -26,   289,   -11,   289,    -9,   -34,   -12,   282,   -15,
225    -16,   -17,   -18,   -19,   275,   276,   277,   278,   281,   -13,
226    279,   -10,   280,   279,   279,   279,   279,   -35,   -14,   -11,
227    -20,   -20,   -20,   -20,   -36,   -37,    -2,   257,   258,   259,
228    -11,   -21,   -22,   289,   282,   -38,   -39,   -40,   -41,   -42,
229    275,   276,   277,   278,    -3,    -4,   291,   290,   -23,   284,
230    -10,   279,   279,   279,   279,   280,   290,   -24,   288,   -46,
231    265,   -47,   -48,   -49,   268,   269,   270,   -43,   -43,   -43,
232    -43,   283,   284,   285,   286,    -5,   -44,   -28,   260,   261,
233    262,   -25,   -26,   -33,   273,   -51,   -52,   289,   -48,   -50,
234    289,   -22,   280,   -27,   -11,   285,   286,   -23,   -28,   -52,
235    -24,   -29,   259,   -45,   283,   -30,   266,   280,   -29,   -31,
236    267,   -30,   -32,   -33,   287,   -31,   291 };
237 yytabelem yydef[]={
238
239      0,    -2,     1,     3,     4,    75,     0,     0,     0,     2,
240     13,    32,    34,     6,     8,     0,     0,     9,    55,    14,
241     15,    16,    17,    18,     0,     0,     0,     0,    35,     7,
242      0,     5,    56,    23,    23,    23,    23,    38,    10,    11,
243     19,    20,    21,    22,     0,    36,     0,    44,    45,    46,
244     12,    24,     0,    64,    55,    39,    40,    41,    42,    43,
245      0,     0,     0,     0,     0,    49,    50,    47,    77,    66,
246     33,    57,    57,    57,    57,    37,    48,     0,     0,     0,
247     67,    68,    70,     0,    72,    73,    74,    -2,    -2,    -2,
248     -2,     0,     0,    65,     0,     0,    58,     0,    61,    62,
249     63,     0,    26,    28,     0,     0,    80,    81,    69,    71,
250     76,     0,    25,    60,    31,    78,     0,    77,    84,    79,
251     82,    86,    85,     0,    84,    88,    87,    59,    86,    29,
252      0,    88,    27,    30,     0,    83,    89 };
253 typedef struct
254 #ifdef __cplusplus
255         yytoktype
256 #endif
257 { char *t_name; int t_val; } yytoktype;
258 #ifndef YYDEBUG
259 #       define YYDEBUG  0       /* don't allow debugging */
260 #endif
261
262 #if YYDEBUG
263
264 yytoktype yytoks[] =
265 {
266         "PER_FILE",     257,
267         "PER_SESSION",  258,
268         "START",        259,
269         "FILE_SCOPE",   260,
270         "SESSION_SCOPE",        261,
271         "FILE_IN_SESSION",      262,
272         "REQUEST",      263,
273         "NOTIFICATION", 264,
274         "VOID_ARGS",    265,
275         "QUEUE",        266,
276         "OPNUM",        267,
277         "IN",   268,
278         "OUT",  269,
279         "INOUT",        270,
280         "OTYPE",        271,
281         "INHERIT",      272,
282         "FROM", 273,
283         "PTYPE",        274,
284         "OBSERVE",      275,
285         "HANDLE",       276,
286         "HANDLE_PUSH",  277,
287         "HANDLE_ROTATE",        278,
288         "COLON",        279,
289         "SEMICOLON",    280,
290         "LCURL",        281,
291         "RCURL",        282,
292         "INFER",        283,
293         "LPAREN",       284,
294         "RPAREN",       285,
295         "COMMA",        286,
296         "EQUAL",        287,
297         "CONTEXT",      288,
298         "TT_IDENTIFIER",        289,
299         "TT_STRING",    290,
300         "TT_NUMBER",    291,
301         "-unknown-",    -1      /* ends search */
302 };
303
304 char * yyreds[] =
305 {
306         "-no such reduction-",
307         "types : type",
308         "types : types type",
309         "type : otype",
310         "type : ptype",
311         "otype : header LCURL otype_body_list RCURL opt_del",
312         "header : OTYPE otid",
313         "header : OTYPE otid inheritance_opt",
314         "otid : TT_IDENTIFIER",
315         "inheritance_opt : /* empty */",
316         "inheritance_opt : COLON otid_list",
317         "otid_list : otid",
318         "otid_list : otid_list otid",
319         "otype_body_list : /* empty */",
320         "otype_body_list : otype_body_list otype_body",
321         "otype_body : otype_observe",
322         "otype_body : otype_handle",
323         "otype_body : otype_handle_push",
324         "otype_body : otype_handle_rotate",
325         "otype_observe : OBSERVE COLON osig_list",
326         "otype_handle : HANDLE COLON osig_list",
327         "otype_handle_push : HANDLE_PUSH COLON osig_list",
328         "otype_handle_rotate : HANDLE_ROTATE COLON osig_list",
329         "osig_list : /* empty */",
330         "osig_list : osig_list osig",
331         "osig : op args cntxt_opt INFER rhs SEMICOLON",
332         "rhs : ptid",
333         "rhs : ptid scope_opt start_opt queue_opt opnum_opt inherit_opt",
334         "rhs : inherit",
335         "inherit_opt : /* empty */",
336         "inherit_opt : inherit",
337         "inherit : FROM otid",
338         "ptype : PTYPE ptid",
339         "ptype : PTYPE ptid LCURL prop_list ptype_body_list RCURL opt_del",
340         "ptid : TT_IDENTIFIER",
341         "prop_list : /* empty */",
342         "prop_list : prop_list prop",
343         "prop : prop_id value SEMICOLON",
344         "ptype_body_list : /* empty */",
345         "ptype_body_list : ptype_body_list ptype_body",
346         "ptype_body : observe",
347         "ptype_body : handle",
348         "ptype_body : handle_push",
349         "ptype_body : handle_rotate",
350         "prop_id : PER_FILE",
351         "prop_id : PER_SESSION",
352         "prop_id : START",
353         "string_lit : TT_STRING",
354         "string_lit : string_lit TT_STRING",
355         "value : string_lit",
356         "value : TT_NUMBER",
357         "observe : OBSERVE COLON psig_list",
358         "handle : HANDLE COLON psig_list",
359         "handle_push : HANDLE_PUSH COLON psig_list",
360         "handle_rotate : HANDLE_ROTATE COLON psig_list",
361         "opt_del : /* empty */",
362         "opt_del : SEMICOLON",
363         "psig_list : /* empty */",
364         "psig_list : psig_list psig",
365         "psig : scope_opt op args cntxt_opt infer_opt SEMICOLON",
366         "scope_opt : /* empty */",
367         "scope_opt : FILE_SCOPE",
368         "scope_opt : SESSION_SCOPE",
369         "scope_opt : FILE_IN_SESSION",
370         "op : TT_IDENTIFIER",
371         "args : LPAREN args_aux RPAREN",
372         "args_aux : /* empty */",
373         "args_aux : VOID_ARGS",
374         "args_aux : argspecs",
375         "argspecs : argspecs COMMA argspec",
376         "argspecs : argspec",
377         "argspec : mode type name",
378         "mode : IN",
379         "mode : OUT",
380         "mode : INOUT",
381         "type : TT_IDENTIFIER",
382         "name : TT_IDENTIFIER",
383         "cntxt_opt : /* empty */",
384         "cntxt_opt : CONTEXT LPAREN cntxt_list RPAREN",
385         "cntxt_list : cntxt_list COMMA cntxt",
386         "cntxt_list : cntxt",
387         "cntxt : TT_IDENTIFIER",
388         "infer_opt : /* empty */",
389         "infer_opt : INFER start_opt queue_opt opnum_opt",
390         "start_opt : /* empty */",
391         "start_opt : START",
392         "queue_opt : /* empty */",
393         "queue_opt : QUEUE",
394         "opnum_opt : /* empty */",
395         "opnum_opt : OPNUM EQUAL TT_NUMBER",
396 };
397 #endif /* YYDEBUG */
398 /*
399  * Copyright (c) 1993 by Sun Microsystems, Inc.
400  */
401
402 /*
403 ** Skeleton parser driver for yacc output
404 */
405
406 /*
407 ** yacc user known macros and defines
408 */
409 #define YYERROR         goto yyerrlab
410 #define YYACCEPT        return(0)
411 #define YYABORT         return(1)
412 #define YYBACKUP( newtoken, newvalue )\
413 {\
414         if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
415         {\
416                 yyerror( "syntax error - cannot backup" );\
417                 goto yyerrlab;\
418         }\
419         yychar = newtoken;\
420         yystate = *yyps;\
421         yylval = newvalue;\
422         goto yynewstate;\
423 }
424 #define YYRECOVERING()  (!!yyerrflag)
425 #define YYNEW(type)     malloc(sizeof(type) * yynewmax)
426 #define YYCOPY(to, from, type) \
427         (type *) memcpy(to, (char *) from, yynewmax * sizeof(type))
428 #define YYENLARGE( from, type) \
429         (type *) realloc((char *) from, yynewmax * sizeof(type))
430 #ifndef YYDEBUG
431 #       define YYDEBUG  1       /* make debugging available */
432 #endif
433
434 /*
435 ** user known globals
436 */
437 int yydebug;                    /* set to 1 to get debugging */
438
439 /*
440 ** driver internal defines
441 */
442 #define YYFLAG          (-10000000)
443
444 /*
445 ** global variables used by the parser
446 */
447 YYSTYPE *yypv;                  /* top of value stack */
448 int *yyps;                      /* top of state stack */
449
450 int yystate;                    /* current state */
451 int yytmp;                      /* extra var (lasts between blocks) */
452
453 int yynerrs;                    /* number of errors */
454 int yyerrflag;                  /* error recovery flag */
455 int yychar;                     /* current input token number */
456
457
458
459 #ifdef YYNMBCHARS
460 #define YYLEX()         yycvtok(yylex())
461 /*
462 ** yycvtok - return a token if i is a wchar_t value that exceeds 255.
463 **      If i<255, i itself is the token.  If i>255 but the neither 
464 **      of the 30th or 31st bit is on, i is already a token.
465 */
466 #if defined(__STDC__) || defined(__cplusplus)
467 int yycvtok(int i)
468 #else
469 int yycvtok(i) int i;
470 #endif
471 {
472         int first = 0;
473         int last = YYNMBCHARS - 1;
474         int mid;
475         wchar_t j;
476
477         if(i&0x60000000){/*Must convert to a token. */
478                 if( yymbchars[last].character < i ){
479                         return i;/*Giving up*/
480                 }
481                 while ((last>=first)&&(first>=0)) {/*Binary search loop*/
482                         mid = (first+last)/2;
483                         j = yymbchars[mid].character;
484                         if( j==i ){/*Found*/ 
485                                 return yymbchars[mid].tvalue;
486                         }else if( j<i ){
487                                 first = mid + 1;
488                         }else{
489                                 last = mid -1;
490                         }
491                 }
492                 /*No entry in the table.*/
493                 return i;/* Giving up.*/
494         }else{/* i is already a token. */
495                 return i;
496         }
497 }
498 #else/*!YYNMBCHARS*/
499 #define YYLEX()         yylex()
500 #endif/*!YYNMBCHARS*/
501
502 /*
503 ** yyparse - return 0 if worked, 1 if syntax error not recovered from
504 */
505 #if defined(__STDC__) || defined(__cplusplus)
506 int _Tt_types_table::yyparse(void)
507 #else
508 int _Tt_types_table::yyparse()
509 #endif
510 {
511         register YYSTYPE *yypvt;        /* top of value stack for $vars */
512
513 #if defined(__cplusplus) || defined(lint)
514 /*
515         hacks to please C++ and lint - goto's inside switch should never be
516         executed; yypvt is set to 0 to avoid "used before set" warning.
517 */
518         static int __yaccpar_lint_hack__ = 0;
519         switch (__yaccpar_lint_hack__)
520         {
521                 case 1: goto yyerrlab;
522                 case 2: goto yynewstate;
523         }
524         yypvt = 0;
525 #endif
526
527         /*
528         ** Initialize externals - yyparse may be called more than once
529         */
530         yypv = &yyv[-1];
531         yyps = &yys[-1];
532         yystate = 0;
533         yytmp = 0;
534         yynerrs = 0;
535         yyerrflag = 0;
536         yychar = -1;
537
538 #if YYMAXDEPTH <= 0
539         if (yymaxdepth <= 0)
540         {
541                 if ((yymaxdepth = YYEXPAND(0)) <= 0)
542                 {
543                         yyerror("yacc initialization error");
544                         YYABORT;
545                 }
546         }
547 #endif
548
549         {
550                 register YYSTYPE *yy_pv;        /* top of value stack */
551                 register int *yy_ps;            /* top of state stack */
552                 register int yy_state;          /* current state */
553                 register int  yy_n;             /* internal state number info */
554         goto yystack;   /* moved from 6 lines above to here to please C++ */
555
556                 /*
557                 ** get globals into registers.
558                 ** branch to here only if YYBACKUP was called.
559                 */
560         yynewstate:
561                 yy_pv = yypv;
562                 yy_ps = yyps;
563                 yy_state = yystate;
564                 goto yy_newstate;
565
566                 /*
567                 ** get globals into registers.
568                 ** either we just started, or we just finished a reduction
569                 */
570         yystack:
571                 yy_pv = yypv;
572                 yy_ps = yyps;
573                 yy_state = yystate;
574
575                 /*
576                 ** top of for (;;) loop while no reductions done
577                 */
578         yy_stack:
579                 /*
580                 ** put a state and value onto the stacks
581                 */
582 #if YYDEBUG
583                 /*
584                 ** if debugging, look up token value in list of value vs.
585                 ** name pairs.  0 and negative (-1) are special values.
586                 ** Note: linear search is used since time is not a real
587                 ** consideration while debugging.
588                 */
589                 if ( yydebug )
590                 {
591                         register int yy_i;
592
593                         printf( "State %d, token ", yy_state );
594                         if ( yychar == 0 )
595                                 printf( "end-of-file\n" );
596                         else if ( yychar < 0 )
597                                 printf( "-none-\n" );
598                         else
599                         {
600                                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
601                                         yy_i++ )
602                                 {
603                                         if ( yytoks[yy_i].t_val == yychar )
604                                                 break;
605                                 }
606                                 printf( "%s\n", yytoks[yy_i].t_name );
607                         }
608                 }
609 #endif /* YYDEBUG */
610                 if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
611                 {
612                         /*
613                         ** reallocate and recover.  Note that pointers
614                         ** have to be reset, or bad things will happen
615                         */
616                         int yyps_index = (yy_ps - yys);
617                         int yypv_index = (yy_pv - yyv);
618                         int yypvt_index = (yypvt - yyv);
619                         int yynewmax;
620 #ifdef YYEXPAND
621                         yynewmax = YYEXPAND(yymaxdepth);
622 #else
623                         yynewmax = 2 * yymaxdepth;      /* double table size */
624                         if (yymaxdepth == YYMAXDEPTH)   /* first time growth */
625                         {
626                                 char *newyys = (char *)YYNEW(int);
627                                 char *newyyv = (char *)YYNEW(YYSTYPE);
628                                 if (newyys != 0 && newyyv != 0)
629                                 {
630                                         yys = YYCOPY(newyys, yys, int);
631                                         yyv = YYCOPY(newyyv, yyv, YYSTYPE);
632                                 }
633                                 else
634                                         yynewmax = 0;   /* failed */
635                         }
636                         else                            /* not first time */
637                         {
638                                 yys = YYENLARGE(yys, int);
639                                 yyv = YYENLARGE(yyv, YYSTYPE);
640                                 if (yys == 0 || yyv == 0)
641                                         yynewmax = 0;   /* failed */
642                         }
643 #endif
644                         if (yynewmax <= yymaxdepth)     /* tables not expanded */
645                         {
646                                 yyerror( "yacc stack overflow" );
647                                 YYABORT;
648                         }
649                         yymaxdepth = yynewmax;
650
651                         yy_ps = yys + yyps_index;
652                         yy_pv = yyv + yypv_index;
653                         yypvt = yyv + yypvt_index;
654                 }
655                 *yy_ps = yy_state;
656                 *++yy_pv = yyval;
657
658                 /*
659                 ** we have a new state - find out what to do
660                 */
661         yy_newstate:
662                 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
663                         goto yydefault;         /* simple state */
664 #if YYDEBUG
665                 /*
666                 ** if debugging, need to mark whether new token grabbed
667                 */
668                 yytmp = yychar < 0;
669 #endif
670                 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
671                         yychar = 0;             /* reached EOF */
672 #if YYDEBUG
673                 if ( yydebug && yytmp )
674                 {
675                         register int yy_i;
676
677                         printf( "Received token " );
678                         if ( yychar == 0 )
679                                 printf( "end-of-file\n" );
680                         else if ( yychar < 0 )
681                                 printf( "-none-\n" );
682                         else
683                         {
684                                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
685                                         yy_i++ )
686                                 {
687                                         if ( yytoks[yy_i].t_val == yychar )
688                                                 break;
689                                 }
690                                 printf( "%s\n", yytoks[yy_i].t_name );
691                         }
692                 }
693 #endif /* YYDEBUG */
694                 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
695                         goto yydefault;
696                 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )  /*valid shift*/
697                 {
698                         yychar = -1;
699                         yyval = yylval;
700                         yy_state = yy_n;
701                         if ( yyerrflag > 0 )
702                                 yyerrflag--;
703                         goto yy_stack;
704                 }
705
706         yydefault:
707                 if ( ( yy_n = yydef[ yy_state ] ) == -2 )
708                 {
709 #if YYDEBUG
710                         yytmp = yychar < 0;
711 #endif
712                         if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
713                                 yychar = 0;             /* reached EOF */
714 #if YYDEBUG
715                         if ( yydebug && yytmp )
716                         {
717                                 register int yy_i;
718
719                                 printf( "Received token " );
720                                 if ( yychar == 0 )
721                                         printf( "end-of-file\n" );
722                                 else if ( yychar < 0 )
723                                         printf( "-none-\n" );
724                                 else
725                                 {
726                                         for ( yy_i = 0;
727                                                 yytoks[yy_i].t_val >= 0;
728                                                 yy_i++ )
729                                         {
730                                                 if ( yytoks[yy_i].t_val
731                                                         == yychar )
732                                                 {
733                                                         break;
734                                                 }
735                                         }
736                                         printf( "%s\n", yytoks[yy_i].t_name );
737                                 }
738                         }
739 #endif /* YYDEBUG */
740                         /*
741                         ** look through exception table
742                         */
743                         {
744                                 register int *yyxi = yyexca;
745
746                                 while ( ( *yyxi != -1 ) ||
747                                         ( yyxi[1] != yy_state ) )
748                                 {
749                                         yyxi += 2;
750                                 }
751                                 while ( ( *(yyxi += 2) >= 0 ) &&
752                                         ( *yyxi != yychar ) )
753                                         ;
754                                 if ( ( yy_n = yyxi[1] ) < 0 )
755                                         YYACCEPT;
756                         }
757                 }
758
759                 /*
760                 ** check for syntax error
761                 */
762                 if ( yy_n == 0 )        /* have an error */
763                 {
764                         /* no worry about speed here! */
765                         switch ( yyerrflag )
766                         {
767                         case 0:         /* new error */
768                                 yyerror( "syntax error" );
769                                 goto skip_init;
770                         yyerrlab:
771                                 /*
772                                 ** get globals into registers.
773                                 ** we have a user generated syntax type error
774                                 */
775                                 yy_pv = yypv;
776                                 yy_ps = yyps;
777                                 yy_state = yystate;
778                         skip_init:
779                                 yynerrs++;
780                                 /* FALLTHRU */
781                         case 1:
782                         case 2:         /* incompletely recovered error */
783                                         /* try again... */
784                                 yyerrflag = 3;
785                                 /*
786                                 ** find state where "error" is a legal
787                                 ** shift action
788                                 */
789                                 while ( yy_ps >= yys )
790                                 {
791                                         yy_n = yypact[ *yy_ps ] + YYERRCODE;
792                                         if ( yy_n >= 0 && yy_n < YYLAST &&
793                                                 yychk[yyact[yy_n]] == YYERRCODE)                                        {
794                                                 /*
795                                                 ** simulate shift of "error"
796                                                 */
797                                                 yy_state = yyact[ yy_n ];
798                                                 goto yy_stack;
799                                         }
800                                         /*
801                                         ** current state has no shift on
802                                         ** "error", pop stack
803                                         */
804 #if YYDEBUG
805 #       define _POP_ "Error recovery pops state %d, uncovers state %d\n"
806                                         if ( yydebug )
807                                                 printf( _POP_, *yy_ps,
808                                                         yy_ps[-1] );
809 #       undef _POP_
810 #endif
811                                         yy_ps--;
812                                         yy_pv--;
813                                 }
814                                 /*
815                                 ** there is no state on stack with "error" as
816                                 ** a valid shift.  give up.
817                                 */
818                                 YYABORT;
819                         case 3:         /* no shift yet; eat a token */
820 #if YYDEBUG
821                                 /*
822                                 ** if debugging, look up token in list of
823                                 ** pairs.  0 and negative shouldn't occur,
824                                 ** but since timing doesn't matter when
825                                 ** debugging, it doesn't hurt to leave the
826                                 ** tests here.
827                                 */
828                                 if ( yydebug )
829                                 {
830                                         register int yy_i;
831
832                                         printf( "Error recovery discards " );
833                                         if ( yychar == 0 )
834                                                 printf( "token end-of-file\n" );
835                                         else if ( yychar < 0 )
836                                                 printf( "token -none-\n" );
837                                         else
838                                         {
839                                                 for ( yy_i = 0;
840                                                         yytoks[yy_i].t_val >= 0;
841                                                         yy_i++ )
842                                                 {
843                                                         if ( yytoks[yy_i].t_val
844                                                                 == yychar )
845                                                         {
846                                                                 break;
847                                                         }
848                                                 }
849                                                 printf( "token %s\n",
850                                                         yytoks[yy_i].t_name );
851                                         }
852                                 }
853 #endif /* YYDEBUG */
854                                 if ( yychar == 0 )      /* reached EOF. quit */
855                                         YYABORT;
856                                 yychar = -1;
857                                 goto yy_newstate;
858                         }
859                 }/* end if ( yy_n == 0 ) */
860                 /*
861                 ** reduction by production yy_n
862                 ** put stack tops, etc. so things right after switch
863                 */
864 #if YYDEBUG
865                 /*
866                 ** if debugging, print the string that is the user's
867                 ** specification of the reduction which is just about
868                 ** to be done.
869                 */
870                 if ( yydebug )
871                         printf( "Reduce by (%d) \"%s\"\n",
872                                 yy_n, yyreds[ yy_n ] );
873 #endif
874                 yytmp = yy_n;                   /* value to switch over */
875                 yypvt = yy_pv;                  /* $vars top of value stack */
876                 /*
877                 ** Look in goto table for next state
878                 ** Sorry about using yy_state here as temporary
879                 ** register variable, but why not, if it works...
880                 ** If yyr2[ yy_n ] doesn't have the low order bit
881                 ** set, then there is no action to be done for
882                 ** this reduction.  So, no saving & unsaving of
883                 ** registers done.  The only difference between the
884                 ** code just after the if and the body of the if is
885                 ** the goto yy_stack in the body.  This way the test
886                 ** can be made before the choice of what to do is needed.
887                 */
888                 {
889                         /* length of production doubled with extra bit */
890                         register int yy_len = yyr2[ yy_n ];
891
892                         if ( !( yy_len & 01 ) )
893                         {
894                                 yy_len >>= 1;
895                                 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
896                                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
897                                         *( yy_ps -= yy_len ) + 1;
898                                 if ( yy_state >= YYLAST ||
899                                         yychk[ yy_state =
900                                         yyact[ yy_state ] ] != -yy_n )
901                                 {
902                                         yy_state = yyact[ yypgo[ yy_n ] ];
903                                 }
904                                 goto yy_stack;
905                         }
906                         yy_len >>= 1;
907                         yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
908                         yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
909                                 *( yy_ps -= yy_len ) + 1;
910                         if ( yy_state >= YYLAST ||
911                                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
912                         {
913                                 yy_state = yyact[ yypgo[ yy_n ] ];
914                         }
915                 }
916                                         /* save until reenter driver code */
917                 yystate = yy_state;
918                 yyps = yy_ps;
919                 yypv = yy_pv;
920         }
921         /*
922         ** code supplied by user is placed in this switch
923         */
924         switch( yytmp )
925         {
926                 
927 case 5:
928 # line 86 "mp_types_gram.y"
929 {
930                           insert_otype(tmp_otype);
931                           tmp_otype = new _Tt_otype();
932                         } break;
933 case 6:
934 # line 92 "mp_types_gram.y"
935 { tmp_otype->set_otid(tmp_otid); } break;
936 case 7:
937 # line 94 "mp_types_gram.y"
938 {
939                                 tmp_otype->set_ancestors(tmp_otidl);
940                                 tmp_otidl = new _Tt_string_list();
941                         } break;
942 case 8:
943 # line 101 "mp_types_gram.y"
944 {
945                                 tmp_otid = yytext;
946                         } break;
947 case 11:
948 # line 111 "mp_types_gram.y"
949 {
950                           tmp_otidl->append(tmp_otid);
951                         } break;
952 case 12:
953 # line 115 "mp_types_gram.y"
954 {
955                           tmp_otidl->append(tmp_otid);
956                         } break;
957 case 19:
958 # line 131 "mp_types_gram.y"
959 {
960                           tmp_otype->append_osigs(tmp_sigl);
961                           tmp_sigl = new _Tt_signature_list();
962                         } break;
963 case 20:
964 # line 138 "mp_types_gram.y"
965 {
966                           tmp_otype->append_hsigs(tmp_sigl, TT_HANDLE);
967                           tmp_sigl = new _Tt_signature_list();
968                         } break;
969 case 21:
970 # line 145 "mp_types_gram.y"
971 {
972                           tmp_otype->append_hsigs(tmp_sigl, TT_HANDLE_PUSH);
973                           tmp_sigl = new _Tt_signature_list();
974                         } break;
975 case 22:
976 # line 152 "mp_types_gram.y"
977 {
978                           tmp_otype->append_hsigs(tmp_sigl, TT_HANDLE_ROTATE);
979                           tmp_sigl = new _Tt_signature_list();
980                         } break;
981 case 25:
982 # line 163 "mp_types_gram.y"
983 {
984                           tmp_sig->set_otid(tmp_otype->otid());
985                           tmp_sig->set_super_otid(tmp_otid);
986                           append_sig(tmp_sig);
987                           tmp_sig = new _Tt_signature();
988                         } break;
989 case 26:
990 # line 171 "mp_types_gram.y"
991 { tmp_sig->set_ptid(yytext); } break;
992 case 31:
993 # line 182 "mp_types_gram.y"
994 {
995                           tmp_sig->set_super_otid(tmp_otid);
996                         } break;
997 case 32:
998 # line 218 "mp_types_gram.y"
999 { tmp_ptype->set_ptid(yytext); } break;
1000 case 33:
1001 # line 220 "mp_types_gram.y"
1002 {
1003                           insert_ptype(tmp_ptype);
1004                           tmp_ptype = new _Tt_ptype();
1005                         } break;
1006 case 37:
1007 # line 234 "mp_types_gram.y"
1008 {
1009                           tmp_ptype->appendprop(tmp_propname, tmp_propvalue);
1010                           tmp_propname = tmp_propvalue = 0;
1011                         } break;
1012 case 44:
1013 # line 251 "mp_types_gram.y"
1014 { set_tmp_propname(_Tt_string((const unsigned char *)yytext, yyleng)); } break;
1015 case 45:
1016 # line 253 "mp_types_gram.y"
1017 { set_tmp_propname(_Tt_string((const unsigned char *)yytext, yyleng));} break;
1018 case 46:
1019 # line 255 "mp_types_gram.y"
1020 { set_tmp_propname(_Tt_string((const unsigned char *)yytext,yyleng)); } break;
1021 case 47:
1022 # line 261 "mp_types_gram.y"
1023 {
1024                           tmp_propvalue.set((const unsigned char *)yytext+1,
1025                                             yyleng - 2);
1026                         } break;
1027 case 48:
1028 # line 266 "mp_types_gram.y"
1029 {
1030                           _Tt_string stringfrag;
1031                           stringfrag.set((const unsigned char *)yytext+1,
1032                                          yyleng - 2);
1033                           tmp_propvalue = tmp_propvalue.cat(stringfrag);
1034                         } break;
1035 case 50:
1036 # line 276 "mp_types_gram.y"
1037 {
1038                           tmp_propvalue = yytext;
1039                         } break;
1040 case 51:
1041 # line 282 "mp_types_gram.y"
1042 {
1043                           tmp_ptype->append_osigs(tmp_sigl);
1044                           tmp_sigl = new _Tt_signature_list();
1045                         } break;
1046 case 52:
1047 # line 289 "mp_types_gram.y"
1048 {
1049                           tmp_ptype->append_hsigs(tmp_sigl, TT_HANDLE);
1050                           tmp_sigl = new _Tt_signature_list();
1051                         } break;
1052 case 53:
1053 # line 296 "mp_types_gram.y"
1054 {
1055                           tmp_ptype->append_hsigs(tmp_sigl, TT_HANDLE_PUSH);
1056                           tmp_sigl = new _Tt_signature_list();
1057                         } break;
1058 case 54:
1059 # line 303 "mp_types_gram.y"
1060 {
1061                           tmp_ptype->append_hsigs(tmp_sigl, TT_HANDLE_ROTATE);
1062                           tmp_sigl = new _Tt_signature_list();
1063                         } break;
1064 case 59:
1065 # line 320 "mp_types_gram.y"
1066 {
1067                                 tmp_sig->set_ptid(tmp_ptype->ptid());
1068                                 append_sig(tmp_sig);
1069                                 tmp_sig = new _Tt_signature();
1070                         } break;
1071 case 61:
1072 # line 328 "mp_types_gram.y"
1073 {
1074                         tmp_sig->set_scope(TT_FILE);
1075                 } break;
1076 case 62:
1077 # line 331 "mp_types_gram.y"
1078 {
1079                         tmp_sig->set_scope(TT_SESSION);
1080                 } break;
1081 case 63:
1082 # line 334 "mp_types_gram.y"
1083 {
1084                         tmp_sig->set_scope(TT_FILE_IN_SESSION);
1085                 } break;
1086 case 64:
1087 # line 340 "mp_types_gram.y"
1088 {
1089                           tmp_sig->set_op(yytext);
1090                         } break;
1091 case 71:
1092 # line 365 "mp_types_gram.y"
1093 {
1094                           tmp_sig->append_arg(tmp_arg);
1095                           tmp_arg = new _Tt_arg();
1096                         } break;
1097 case 72:
1098 # line 371 "mp_types_gram.y"
1099 { tmp_arg->set_mode(TT_IN); } break;
1100 case 73:
1101 # line 372 "mp_types_gram.y"
1102 { tmp_arg->set_mode(TT_OUT); } break;
1103 case 74:
1104 # line 373 "mp_types_gram.y"
1105 { tmp_arg->set_mode(TT_INOUT); } break;
1106 case 75:
1107 # line 377 "mp_types_gram.y"
1108 {
1109                           _Tt_string tmptext(yytext);
1110                           tmp_arg->set_type(tmptext);
1111                         } break;
1112 case 76:
1113 # line 384 "mp_types_gram.y"
1114 {
1115                           _Tt_string tmptext(yytext);
1116                           tmp_arg->set_name(tmptext);
1117                         } break;
1118 case 81:
1119 # line 399 "mp_types_gram.y"
1120 {
1121                           _Tt_context_ptr tmpcntxt = new _Tt_context;
1122                           tmpcntxt->setName(yytext);
1123                           tmp_sig->append_context(tmpcntxt);
1124                         } break;
1125 case 85:
1126 # line 414 "mp_types_gram.y"
1127 { tmp_sig->set_reliability(TT_START); } break;
1128 case 87:
1129 # line 418 "mp_types_gram.y"
1130 { tmp_sig->set_reliability(TT_QUEUE); } break;
1131 case 89:
1132 # line 424 "mp_types_gram.y"
1133 { tmp_sig->set_opnum(atoi(yytext)); } break;
1134         }
1135         goto yystack;           /* reset registers in driver code */
1136 }
1137