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