1 2 # line 2 "../prexgram.y" 3 /* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12 * or http://www.opensolaris.org/os/licensing. 13 * See the License for the specific language governing permissions 14 * and limitations under the License. 15 * 16 * When distributing Covered Code, include this CDDL HEADER in each 17 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18 * If applicable, add the following below this CDDL HEADER, with the 19 * fields enclosed by brackets "[]" replaced with your own identifying 20 * information: Portions Copyright [yyyy] [name of copyright owner] 21 * 22 * CDDL HEADER END 23 * 24 * Copyright (c) 1994, by Sun Microsytems, Inc. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 # define ADD 257 29 # define ALLOC 258 30 # define BUFFER 259 31 # define CLEAR 260 32 # define COMMA 261 33 # define CONNECT 262 34 # define DEALLOC 263 35 # define DELETE 264 36 # define FILTER 265 37 # define CONTINUE 266 38 # define CREATE 267 39 # define DISABLE 268 40 # define ENABLE 269 41 # define EQ 270 42 # define FCNNAME 271 43 # define FCNS 272 44 # define ON 273 45 # define OFF 274 46 # define HELP 275 47 # define KTRACE 276 48 # define HISTORY 277 49 # define IDENT 278 50 # define INVAL 279 51 # define KILL 280 52 # define LIST 281 53 # define NL 282 54 # define PFILTER 283 55 # define PROBES 284 56 # define QUIT 285 57 # define REGEXP 286 58 # define RESUME 287 59 # define SCALED_INT 288 60 # define SETNAME 289 61 # define SETS 290 62 # define SOURCE 291 63 # define SUSPEND 292 64 # define TRACE 293 65 # define TRACEFILE 294 66 # define UNTRACE 295 67 # define VALSTR 296 68 # define VALUES 297 69 70 # line 72 "../prexgram.y" 71 #include <stdio.h> 72 #include <string.h> 73 #include <sys/types.h> 74 75 #include "set.h" 76 #include "cmd.h" 77 #include "fcn.h" 78 #include "list.h" 79 #include "expr.h" 80 #include "spec.h" 81 #include "source.h" 82 #include "prbk.h" 83 84 extern int yylex(); 85 86 extern void help_on_topic(char *topic); 87 extern void help_on_command(int cmd); 88 extern boolean_t g_kernelmode; 89 extern tnfctl_handle_t *g_hndl; 90 91 void quit(boolean_t killtarget, boolean_t runtarget); 92 extern void help(void); 93 extern void process_cmd(tnfctl_handle_t *hndl, cmd_t *cmd); 94 extern void cmd_listtracefile(); 95 96 # line 98 "../prexgram.y" 97 typedef union 98 #ifdef __cplusplus 99 YYSTYPE 100 #endif 101 102 { 103 char * strval; 104 expr_t * exprval; 105 spec_t * specval; 106 void * pidlistval; 107 int intval; 108 } YYSTYPE; 109 110 #include <inttypes.h> 111 112 #ifdef __STDC__ 113 #include <stdlib.h> 114 #include <string.h> 115 #define YYCONST const 116 #else 117 #include <malloc.h> 118 #include <memory.h> 119 #define YYCONST 120 #endif 121 122 #include <values.h> 123 124 #if defined(__cplusplus) || defined(__STDC__) 125 126 #if defined(__cplusplus) && defined(__EXTERN_C__) 127 extern "C" { 128 #endif 129 #ifndef yyerror 130 #if defined(__cplusplus) 131 void yyerror(YYCONST char *); 132 #endif 133 #endif 134 #ifndef yylex 135 int yylex(void); 136 #endif 137 int yyparse(void); 138 #if defined(__cplusplus) && defined(__EXTERN_C__) 139 } 140 #endif 141 142 #endif 143 144 #define yyclearin yychar = -1 145 #define yyerrok yyerrflag = 0 146 extern int yychar; 147 extern int yyerrflag; 148 YYSTYPE yylval; 149 YYSTYPE yyval; 150 typedef int yytabelem; 151 #ifndef YYMAXDEPTH 152 #define YYMAXDEPTH 150 153 #endif 154 #if YYMAXDEPTH > 0 155 int yy_yys[YYMAXDEPTH], *yys = yy_yys; 156 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; 157 #else /* user does initial allocation */ 158 int *yys; 159 YYSTYPE *yyv; 160 #endif 161 static int yymaxdepth = YYMAXDEPTH; 162 # define YYERRCODE 256 163 164 # line 382 "../prexgram.y" 165 166 static YYCONST yytabelem yyexca[] ={ 167 -1, 1, 168 0, -1, 169 -2, 0, 170 -1, 2, 171 0, 1, 172 -2, 0, 173 }; 174 # define YYNPROD 96 175 # define YYLAST 291 176 static YYCONST yytabelem yyact[]={ 177 178 25, 150, 127, 38, 35, 115, 34, 74, 128, 123, 179 28, 39, 31, 30, 71, 106, 69, 67, 90, 27, 180 37, 138, 65, 108, 88, 41, 26, 36, 145, 29, 181 155, 55, 58, 107, 59, 40, 89, 32, 46, 33, 182 47, 48, 87, 81, 82, 149, 94, 49, 56, 146, 183 45, 92, 83, 50, 43, 57, 85, 51, 106, 147, 184 142, 86, 156, 52, 91, 53, 108, 54, 93, 106, 185 106, 96, 137, 152, 148, 106, 107, 108, 108, 143, 186 84, 106, 106, 108, 136, 118, 114, 107, 107, 108, 187 108, 135, 134, 107, 106, 133, 106, 106, 112, 107, 188 107, 110, 108, 106, 108, 108, 62, 103, 61, 78, 189 145, 108, 107, 63, 107, 107, 79, 132, 64, 129, 190 126, 107, 125, 120, 119, 76, 77, 117, 113, 111, 191 109, 144, 102, 101, 80, 100, 99, 98, 97, 60, 192 42, 131, 73, 141, 122, 66, 105, 95, 121, 24, 193 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 194 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 195 3, 2, 1, 104, 44, 0, 0, 68, 70, 72, 196 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 199 0, 0, 0, 0, 0, 0, 0, 0, 0, 116, 200 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 201 0, 0, 0, 130, 0, 0, 0, 0, 0, 0, 202 0, 0, 139, 0, 140, 0, 0, 0, 0, 0, 203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 206 0, 0, 0, 0, 151, 0, 0, 139, 153, 0, 207 154 }; 208 static YYCONST yytabelem yypact[]={ 209 210 -10000000,-10000000, -256,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 211 -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 212 -10000000,-10000000,-10000000,-10000000,-10000000, -142,-10000000, -228, -143, -174, 213 -267, -272, -273, -275, -129, -282, -148, -230, -202, -247, 214 -260, -226,-10000000,-10000000, -144, -145,-10000000,-10000000,-10000000,-10000000, 215 -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, 216 -10000000,-10000000, -146, -147, -149, -150, -175, -152, -181, -153, 217 -184, -154, -196, -284, -155, -197, -158, -159, -279, -279, 218 -10000000, -160, -162,-10000000,-10000000, -280, -163,-10000000, -137, -165, 219 -187, -190, -191, -198, -210, -263,-10000000,-10000000,-10000000,-10000000, 220 -10000000,-10000000,-10000000,-10000000,-10000000, -127,-10000000,-10000000,-10000000,-10000000, 221 -10000000,-10000000,-10000000,-10000000,-10000000, -222, -203,-10000000,-10000000,-10000000, 222 -10000000, -151,-10000000,-10000000, -233,-10000000,-10000000,-10000000, -223,-10000000, 223 -208, -237,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -288,-10000000, 224 -209, -182,-10000000,-10000000,-10000000, -279,-10000000,-10000000,-10000000,-10000000, 225 -252, -220,-10000000,-10000000,-10000000,-10000000,-10000000 }; 226 static YYCONST yytabelem yypgo[]={ 227 228 0, 174, 173, 145, 146, 147, 148, 144, 172, 171, 229 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 230 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 231 150, 149 }; 232 static YYCONST yytabelem yyr1[]={ 233 234 0, 8, 9, 9, 10, 10, 10, 10, 10, 10, 235 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 236 10, 10, 10, 10, 10, 10, 11, 1, 1, 1, 237 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 238 1, 12, 12, 12, 13, 14, 14, 14, 14, 15, 239 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 240 20, 24, 24, 25, 25, 26, 27, 28, 29, 21, 241 21, 21, 21, 21, 22, 22, 22, 30, 30, 31, 242 3, 3, 5, 5, 2, 2, 4, 4, 4, 6, 243 6, 7, 23, 23, 23, 23 }; 244 static YYCONST yytabelem yyr2[]={ 245 246 0, 2, 1, 5, 2, 2, 2, 2, 2, 2, 247 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 248 2, 2, 2, 2, 2, 5, 2, 3, 3, 3, 249 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 250 3, 5, 7, 7, 5, 5, 7, 7, 7, 7, 251 7, 7, 7, 7, 7, 7, 7, 9, 9, 7, 252 7, 9, 9, 7, 7, 7, 7, 7, 7, 7, 253 7, 9, 9, 5, 7, 7, 5, 11, 11, 9, 254 1, 5, 1, 5, 7, 3, 3, 3, 3, 7, 255 3, 2, 5, 7, 9, 7 }; 256 static YYCONST yytabelem yychk[]={ 257 258 -10000000, -8, -9, -10, -11, -12, -13, -14, -15, -16, 259 -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, 260 -27, -28, -29, -30, -31, 256, 282, 275, 266, 285, 261 269, 268, 293, 295, 262, 260, 283, 276, 259, 267, 262 291, 281, 282, 282, -1, 278, 266, 268, 269, 275, 263 281, 285, 291, 293, 295, 259, 276, 283, 260, 262, 264 282, 282, 280, 287, 292, 289, -3, 289, -3, 289, 265 -3, 289, -3, 271, 289, -3, 273, 274, 257, 264, 266 282, 273, 274, 282, 282, 258, 263, 289, 271, 296, 267 278, 290, 277, 294, 272, -5, 297, 282, 282, 282, 268 282, 282, 282, 282, -2, -4, 278, 296, 286, 282, 269 282, 282, 282, 282, 282, 289, -3, 282, 282, 282, 270 282, -6, -7, 288, -6, 282, 282, 282, 288, 282, 271 -3, 278, 282, 282, 282, 282, 282, 282, 284, -4, 272 -5, 270, 282, 282, 282, 261, 282, 282, 282, 282, 273 289, -3, 282, -4, -7, 282, 282 }; 274 static YYCONST yytabelem yydef[]={ 275 276 2, -2, -2, 3, 4, 5, 6, 7, 8, 9, 277 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 278 20, 21, 22, 23, 24, 0, 26, 0, 0, 0, 279 80, 80, 80, 80, 0, 80, 0, 0, 0, 0, 280 0, 82, 25, 41, 0, 0, 27, 28, 29, 30, 281 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 282 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 283 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 284 73, 0, 0, 76, 92, 0, 0, 80, 0, 0, 285 0, 0, 0, 0, 0, 0, 82, 42, 43, 46, 286 47, 48, 49, 50, 81, 85, 86, 87, 88, 51, 287 52, 53, 54, 55, 56, 0, 0, 59, 60, 69, 288 70, 0, 90, 91, 0, 74, 75, 93, 0, 95, 289 0, 0, 63, 64, 65, 66, 67, 68, 80, 83, 290 0, 0, 57, 58, 71, 0, 72, 94, 61, 62, 291 0, 0, 79, 84, 89, 77, 78 }; 292 typedef struct 293 #ifdef __cplusplus 294 yytoktype 295 #endif 296 { 297 #ifdef __cplusplus 298 const 299 #endif 300 char *t_name; int t_val; } yytoktype; 301 #ifndef YYDEBUG 302 # define YYDEBUG 0 /* don't allow debugging */ 303 #endif 304 305 #if YYDEBUG 306 307 yytoktype yytoks[] = 308 { 309 "ADD", 257, 310 "ALLOC", 258, 311 "BUFFER", 259, 312 "CLEAR", 260, 313 "COMMA", 261, 314 "CONNECT", 262, 315 "DEALLOC", 263, 316 "DELETE", 264, 317 "FILTER", 265, 318 "CONTINUE", 266, 319 "CREATE", 267, 320 "DISABLE", 268, 321 "ENABLE", 269, 322 "EQ", 270, 323 "FCNNAME", 271, 324 "FCNS", 272, 325 "ON", 273, 326 "OFF", 274, 327 "HELP", 275, 328 "KTRACE", 276, 329 "HISTORY", 277, 330 "IDENT", 278, 331 "INVAL", 279, 332 "KILL", 280, 333 "LIST", 281, 334 "NL", 282, 335 "PFILTER", 283, 336 "PROBES", 284, 337 "QUIT", 285, 338 "REGEXP", 286, 339 "RESUME", 287, 340 "SCALED_INT", 288, 341 "SETNAME", 289, 342 "SETS", 290, 343 "SOURCE", 291, 344 "SUSPEND", 292, 345 "TRACE", 293, 346 "TRACEFILE", 294, 347 "UNTRACE", 295, 348 "VALSTR", 296, 349 "VALUES", 297, 350 "-unknown-", -1 /* ends search */ 351 }; 352 353 #ifdef __cplusplus 354 const 355 #endif 356 char * yyreds[] = 357 { 358 "-no such reduction-", 359 "file : statement_list", 360 "statement_list : /* empty */", 361 "statement_list : statement_list statement", 362 "statement : empty_statement", 363 "statement : help_statement", 364 "statement : continue_statement", 365 "statement : quit_statement", 366 "statement : enable_statement", 367 "statement : disable_statement", 368 "statement : trace_statement", 369 "statement : untrace_statement", 370 "statement : connect_statement", 371 "statement : clear_statement", 372 "statement : pfilter_statement", 373 "statement : ktrace_statement", 374 "statement : buffer_statement", 375 "statement : create_statement", 376 "statement : source_statement", 377 "statement : listsets_statement", 378 "statement : listhistory_statement", 379 "statement : listtracefile_statement", 380 "statement : listfcns_statement", 381 "statement : listprobes_statement", 382 "statement : listvalues_statement", 383 "statement : error NL", 384 "empty_statement : NL", 385 "command : CONTINUE", 386 "command : DISABLE", 387 "command : ENABLE", 388 "command : HELP", 389 "command : LIST", 390 "command : QUIT", 391 "command : SOURCE", 392 "command : TRACE", 393 "command : UNTRACE", 394 "command : BUFFER", 395 "command : KTRACE", 396 "command : PFILTER", 397 "command : CLEAR", 398 "command : CONNECT", 399 "help_statement : HELP NL", 400 "help_statement : HELP command NL", 401 "help_statement : HELP IDENT NL", 402 "continue_statement : CONTINUE NL", 403 "quit_statement : QUIT NL", 404 "quit_statement : QUIT KILL NL", 405 "quit_statement : QUIT RESUME NL", 406 "quit_statement : QUIT SUSPEND NL", 407 "enable_statement : ENABLE SETNAME NL", 408 "enable_statement : ENABLE exprlist NL", 409 "disable_statement : DISABLE SETNAME NL", 410 "disable_statement : DISABLE exprlist NL", 411 "trace_statement : TRACE SETNAME NL", 412 "trace_statement : TRACE exprlist NL", 413 "untrace_statement : UNTRACE SETNAME NL", 414 "untrace_statement : UNTRACE exprlist NL", 415 "connect_statement : CONNECT FCNNAME SETNAME NL", 416 "connect_statement : CONNECT FCNNAME exprlist NL", 417 "clear_statement : CLEAR SETNAME NL", 418 "clear_statement : CLEAR exprlist NL", 419 "create_statement : CREATE SETNAME exprlist NL", 420 "create_statement : CREATE FCNNAME IDENT NL", 421 "source_statement : SOURCE VALSTR NL", 422 "source_statement : SOURCE IDENT NL", 423 "listsets_statement : LIST SETS NL", 424 "listhistory_statement : LIST HISTORY NL", 425 "listtracefile_statement : LIST TRACEFILE NL", 426 "listfcns_statement : LIST FCNS NL", 427 "pfilter_statement : PFILTER ON NL", 428 "pfilter_statement : PFILTER OFF NL", 429 "pfilter_statement : PFILTER ADD pidlist NL", 430 "pfilter_statement : PFILTER DELETE pidlist NL", 431 "pfilter_statement : PFILTER NL", 432 "ktrace_statement : KTRACE ON NL", 433 "ktrace_statement : KTRACE OFF NL", 434 "ktrace_statement : KTRACE NL", 435 "listprobes_statement : LIST speclist PROBES SETNAME NL", 436 "listprobes_statement : LIST speclist PROBES exprlist NL", 437 "listvalues_statement : LIST VALUES speclist NL", 438 "exprlist : /* empty */", 439 "exprlist : exprlist expr", 440 "speclist : /* empty */", 441 "speclist : speclist spec", 442 "expr : spec EQ spec", 443 "expr : spec", 444 "spec : IDENT", 445 "spec : VALSTR", 446 "spec : REGEXP", 447 "pidlist : pidlist COMMA singlepid", 448 "pidlist : singlepid", 449 "singlepid : SCALED_INT", 450 "buffer_statement : BUFFER NL", 451 "buffer_statement : BUFFER ALLOC NL", 452 "buffer_statement : BUFFER ALLOC SCALED_INT NL", 453 "buffer_statement : BUFFER DEALLOC NL", 454 }; 455 #endif /* YYDEBUG */ 456 # line 1 "/usr/share/lib/ccs/yaccpar" 457 /* 458 * CDDL HEADER START 459 * 460 * The contents of this file are subject to the terms of the 461 * Common Development and Distribution License, Version 1.0 only 462 * (the "License"). You may not use this file except in compliance 463 * with the License. 464 * 465 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 466 * or http://www.opensolaris.org/os/licensing. 467 * See the License for the specific language governing permissions 468 * and limitations under the License. 469 * 470 * When distributing Covered Code, include this CDDL HEADER in each 471 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 472 * If applicable, add the following below this CDDL HEADER, with the 473 * fields enclosed by brackets "[]" replaced with your own identifying 474 * information: Portions Copyright [yyyy] [name of copyright owner] 475 * 476 * CDDL HEADER END 477 */ 478 /* 479 * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 480 * Use is subject to license terms. 481 */ 482 483 /* Copyright (c) 1988 AT&T */ 484 /* All Rights Reserved */ 485 486 #pragma ident "%Z%%M% %I% %E% SMI" 487 488 /* 489 ** Skeleton parser driver for yacc output 490 */ 491 492 /* 493 ** yacc user known macros and defines 494 */ 495 #define YYERROR goto yyerrlab 496 #define YYACCEPT return(0) 497 #define YYABORT return(1) 498 #define YYBACKUP( newtoken, newvalue )\ 499 {\ 500 if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 501 {\ 502 yyerror( "syntax error - cannot backup" );\ 503 goto yyerrlab;\ 504 }\ 505 yychar = newtoken;\ 506 yystate = *yyps;\ 507 yylval = newvalue;\ 508 goto yynewstate;\ 509 } 510 #define YYRECOVERING() (!!yyerrflag) 511 #define YYNEW(type) malloc(sizeof(type) * yynewmax) 512 #define YYCOPY(to, from, type) \ 513 (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 514 #define YYENLARGE( from, type) \ 515 (type *) realloc((char *) from, yynewmax * sizeof(type)) 516 #ifndef YYDEBUG 517 # define YYDEBUG 1 /* make debugging available */ 518 #endif 519 520 /* 521 ** user known globals 522 */ 523 int yydebug; /* set to 1 to get debugging */ 524 525 /* 526 ** driver internal defines 527 */ 528 #define YYFLAG (-10000000) 529 530 /* 531 ** global variables used by the parser 532 */ 533 YYSTYPE *yypv; /* top of value stack */ 534 int *yyps; /* top of state stack */ 535 536 int yystate; /* current state */ 537 int yytmp; /* extra var (lasts between blocks) */ 538 539 int yynerrs; /* number of errors */ 540 int yyerrflag; /* error recovery flag */ 541 int yychar; /* current input token number */ 542 543 544 545 #ifdef YYNMBCHARS 546 #define YYLEX() yycvtok(yylex()) 547 /* 548 ** yycvtok - return a token if i is a wchar_t value that exceeds 255. 549 ** If i<255, i itself is the token. If i>255 but the neither 550 ** of the 30th or 31st bit is on, i is already a token. 551 */ 552 #if defined(__STDC__) || defined(__cplusplus) 553 int yycvtok(int i) 554 #else 555 int yycvtok(i) int i; 556 #endif 557 { 558 int first = 0; 559 int last = YYNMBCHARS - 1; 560 int mid; 561 wchar_t j; 562 563 if(i&0x60000000){/*Must convert to a token. */ 564 if( yymbchars[last].character < i ){ 565 return i;/*Giving up*/ 566 } 567 while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 568 mid = (first+last)/2; 569 j = yymbchars[mid].character; 570 if( j==i ){/*Found*/ 571 return yymbchars[mid].tvalue; 572 }else if( j<i ){ 573 first = mid + 1; 574 }else{ 575 last = mid -1; 576 } 577 } 578 /*No entry in the table.*/ 579 return i;/* Giving up.*/ 580 }else{/* i is already a token. */ 581 return i; 582 } 583 } 584 #else/*!YYNMBCHARS*/ 585 #define YYLEX() yylex() 586 #endif/*!YYNMBCHARS*/ 587 588 /* 589 ** yyparse - return 0 if worked, 1 if syntax error not recovered from 590 */ 591 #if defined(__STDC__) || defined(__cplusplus) 592 int yyparse(void) 593 #else 594 int yyparse() 595 #endif 596 { 597 register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 598 599 #if defined(__cplusplus) || defined(lint) 600 /* 601 hacks to please C++ and lint - goto's inside 602 switch should never be executed 603 */ 604 static int __yaccpar_lint_hack__ = 0; 605 switch (__yaccpar_lint_hack__) 606 { 607 case 1: goto yyerrlab; 608 case 2: goto yynewstate; 609 } 610 #endif 611 612 /* 613 ** Initialize externals - yyparse may be called more than once 614 */ 615 yypv = &yyv[-1]; 616 yyps = &yys[-1]; 617 yystate = 0; 618 yytmp = 0; 619 yynerrs = 0; 620 yyerrflag = 0; 621 yychar = -1; 622 623 #if YYMAXDEPTH <= 0 624 if (yymaxdepth <= 0) 625 { 626 if ((yymaxdepth = YYEXPAND(0)) <= 0) 627 { 628 yyerror("yacc initialization error"); 629 YYABORT; 630 } 631 } 632 #endif 633 634 { 635 register YYSTYPE *yy_pv; /* top of value stack */ 636 register int *yy_ps; /* top of state stack */ 637 register int yy_state; /* current state */ 638 register int yy_n; /* internal state number info */ 639 goto yystack; /* moved from 6 lines above to here to please C++ */ 640 641 /* 642 ** get globals into registers. 643 ** branch to here only if YYBACKUP was called. 644 */ 645 yynewstate: 646 yy_pv = yypv; 647 yy_ps = yyps; 648 yy_state = yystate; 649 goto yy_newstate; 650 651 /* 652 ** get globals into registers. 653 ** either we just started, or we just finished a reduction 654 */ 655 yystack: 656 yy_pv = yypv; 657 yy_ps = yyps; 658 yy_state = yystate; 659 660 /* 661 ** top of for (;;) loop while no reductions done 662 */ 663 yy_stack: 664 /* 665 ** put a state and value onto the stacks 666 */ 667 #if YYDEBUG 668 /* 669 ** if debugging, look up token value in list of value vs. 670 ** name pairs. 0 and negative (-1) are special values. 671 ** Note: linear search is used since time is not a real 672 ** consideration while debugging. 673 */ 674 if ( yydebug ) 675 { 676 register int yy_i; 677 678 printf( "State %d, token ", yy_state ); 679 if ( yychar == 0 ) 680 printf( "end-of-file\n" ); 681 else if ( yychar < 0 ) 682 printf( "-none-\n" ); 683 else 684 { 685 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 686 yy_i++ ) 687 { 688 if ( yytoks[yy_i].t_val == yychar ) 689 break; 690 } 691 printf( "%s\n", yytoks[yy_i].t_name ); 692 } 693 } 694 #endif /* YYDEBUG */ 695 if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 696 { 697 /* 698 ** reallocate and recover. Note that pointers 699 ** have to be reset, or bad things will happen 700 */ 701 long yyps_index = (yy_ps - yys); 702 long yypv_index = (yy_pv - yyv); 703 long yypvt_index = (yypvt - yyv); 704 int yynewmax; 705 #ifdef YYEXPAND 706 yynewmax = YYEXPAND(yymaxdepth); 707 #else 708 yynewmax = 2 * yymaxdepth; /* double table size */ 709 if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 710 { 711 char *newyys = (char *)YYNEW(int); 712 char *newyyv = (char *)YYNEW(YYSTYPE); 713 if (newyys != 0 && newyyv != 0) 714 { 715 yys = YYCOPY(newyys, yys, int); 716 yyv = YYCOPY(newyyv, yyv, YYSTYPE); 717 } 718 else 719 yynewmax = 0; /* failed */ 720 } 721 else /* not first time */ 722 { 723 yys = YYENLARGE(yys, int); 724 yyv = YYENLARGE(yyv, YYSTYPE); 725 if (yys == 0 || yyv == 0) 726 yynewmax = 0; /* failed */ 727 } 728 #endif 729 if (yynewmax <= yymaxdepth) /* tables not expanded */ 730 { 731 yyerror( "yacc stack overflow" ); 732 YYABORT; 733 } 734 yymaxdepth = yynewmax; 735 736 yy_ps = yys + yyps_index; 737 yy_pv = yyv + yypv_index; 738 yypvt = yyv + yypvt_index; 739 } 740 *yy_ps = yy_state; 741 *++yy_pv = yyval; 742 743 /* 744 ** we have a new state - find out what to do 745 */ 746 yy_newstate: 747 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 748 goto yydefault; /* simple state */ 749 #if YYDEBUG 750 /* 751 ** if debugging, need to mark whether new token grabbed 752 */ 753 yytmp = yychar < 0; 754 #endif 755 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 756 yychar = 0; /* reached EOF */ 757 #if YYDEBUG 758 if ( yydebug && yytmp ) 759 { 760 register int yy_i; 761 762 printf( "Received token " ); 763 if ( yychar == 0 ) 764 printf( "end-of-file\n" ); 765 else if ( yychar < 0 ) 766 printf( "-none-\n" ); 767 else 768 { 769 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 770 yy_i++ ) 771 { 772 if ( yytoks[yy_i].t_val == yychar ) 773 break; 774 } 775 printf( "%s\n", yytoks[yy_i].t_name ); 776 } 777 } 778 #endif /* YYDEBUG */ 779 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 780 goto yydefault; 781 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 782 { 783 yychar = -1; 784 yyval = yylval; 785 yy_state = yy_n; 786 if ( yyerrflag > 0 ) 787 yyerrflag--; 788 goto yy_stack; 789 } 790 791 yydefault: 792 if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 793 { 794 #if YYDEBUG 795 yytmp = yychar < 0; 796 #endif 797 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 798 yychar = 0; /* reached EOF */ 799 #if YYDEBUG 800 if ( yydebug && yytmp ) 801 { 802 register int yy_i; 803 804 printf( "Received token " ); 805 if ( yychar == 0 ) 806 printf( "end-of-file\n" ); 807 else if ( yychar < 0 ) 808 printf( "-none-\n" ); 809 else 810 { 811 for ( yy_i = 0; 812 yytoks[yy_i].t_val >= 0; 813 yy_i++ ) 814 { 815 if ( yytoks[yy_i].t_val 816 == yychar ) 817 { 818 break; 819 } 820 } 821 printf( "%s\n", yytoks[yy_i].t_name ); 822 } 823 } 824 #endif /* YYDEBUG */ 825 /* 826 ** look through exception table 827 */ 828 { 829 register YYCONST int *yyxi = yyexca; 830 831 while ( ( *yyxi != -1 ) || 832 ( yyxi[1] != yy_state ) ) 833 { 834 yyxi += 2; 835 } 836 while ( ( *(yyxi += 2) >= 0 ) && 837 ( *yyxi != yychar ) ) 838 ; 839 if ( ( yy_n = yyxi[1] ) < 0 ) 840 YYACCEPT; 841 } 842 } 843 844 /* 845 ** check for syntax error 846 */ 847 if ( yy_n == 0 ) /* have an error */ 848 { 849 /* no worry about speed here! */ 850 switch ( yyerrflag ) 851 { 852 case 0: /* new error */ 853 yyerror( "syntax error" ); 854 goto skip_init; 855 yyerrlab: 856 /* 857 ** get globals into registers. 858 ** we have a user generated syntax type error 859 */ 860 yy_pv = yypv; 861 yy_ps = yyps; 862 yy_state = yystate; 863 skip_init: 864 yynerrs++; 865 /* FALLTHRU */ 866 case 1: 867 case 2: /* incompletely recovered error */ 868 /* try again... */ 869 yyerrflag = 3; 870 /* 871 ** find state where "error" is a legal 872 ** shift action 873 */ 874 while ( yy_ps >= yys ) 875 { 876 yy_n = yypact[ *yy_ps ] + YYERRCODE; 877 if ( yy_n >= 0 && yy_n < YYLAST && 878 yychk[yyact[yy_n]] == YYERRCODE) { 879 /* 880 ** simulate shift of "error" 881 */ 882 yy_state = yyact[ yy_n ]; 883 goto yy_stack; 884 } 885 /* 886 ** current state has no shift on 887 ** "error", pop stack 888 */ 889 #if YYDEBUG 890 # define _POP_ "Error recovery pops state %d, uncovers state %d\n" 891 if ( yydebug ) 892 printf( _POP_, *yy_ps, 893 yy_ps[-1] ); 894 # undef _POP_ 895 #endif 896 yy_ps--; 897 yy_pv--; 898 } 899 /* 900 ** there is no state on stack with "error" as 901 ** a valid shift. give up. 902 */ 903 YYABORT; 904 case 3: /* no shift yet; eat a token */ 905 #if YYDEBUG 906 /* 907 ** if debugging, look up token in list of 908 ** pairs. 0 and negative shouldn't occur, 909 ** but since timing doesn't matter when 910 ** debugging, it doesn't hurt to leave the 911 ** tests here. 912 */ 913 if ( yydebug ) 914 { 915 register int yy_i; 916 917 printf( "Error recovery discards " ); 918 if ( yychar == 0 ) 919 printf( "token end-of-file\n" ); 920 else if ( yychar < 0 ) 921 printf( "token -none-\n" ); 922 else 923 { 924 for ( yy_i = 0; 925 yytoks[yy_i].t_val >= 0; 926 yy_i++ ) 927 { 928 if ( yytoks[yy_i].t_val 929 == yychar ) 930 { 931 break; 932 } 933 } 934 printf( "token %s\n", 935 yytoks[yy_i].t_name ); 936 } 937 } 938 #endif /* YYDEBUG */ 939 if ( yychar == 0 ) /* reached EOF. quit */ 940 YYABORT; 941 yychar = -1; 942 goto yy_newstate; 943 } 944 }/* end if ( yy_n == 0 ) */ 945 /* 946 ** reduction by production yy_n 947 ** put stack tops, etc. so things right after switch 948 */ 949 #if YYDEBUG 950 /* 951 ** if debugging, print the string that is the user's 952 ** specification of the reduction which is just about 953 ** to be done. 954 */ 955 if ( yydebug ) 956 printf( "Reduce by (%d) \"%s\"\n", 957 yy_n, yyreds[ yy_n ] ); 958 #endif 959 yytmp = yy_n; /* value to switch over */ 960 yypvt = yy_pv; /* $vars top of value stack */ 961 /* 962 ** Look in goto table for next state 963 ** Sorry about using yy_state here as temporary 964 ** register variable, but why not, if it works... 965 ** If yyr2[ yy_n ] doesn't have the low order bit 966 ** set, then there is no action to be done for 967 ** this reduction. So, no saving & unsaving of 968 ** registers done. The only difference between the 969 ** code just after the if and the body of the if is 970 ** the goto yy_stack in the body. This way the test 971 ** can be made before the choice of what to do is needed. 972 */ 973 { 974 /* length of production doubled with extra bit */ 975 register int yy_len = yyr2[ yy_n ]; 976 977 if ( !( yy_len & 01 ) ) 978 { 979 yy_len >>= 1; 980 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 981 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 982 *( yy_ps -= yy_len ) + 1; 983 if ( yy_state >= YYLAST || 984 yychk[ yy_state = 985 yyact[ yy_state ] ] != -yy_n ) 986 { 987 yy_state = yyact[ yypgo[ yy_n ] ]; 988 } 989 goto yy_stack; 990 } 991 yy_len >>= 1; 992 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 993 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 994 *( yy_ps -= yy_len ) + 1; 995 if ( yy_state >= YYLAST || 996 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 997 { 998 yy_state = yyact[ yypgo[ yy_n ] ]; 999 } 1000 } 1001 /* save until reenter driver code */ 1002 yystate = yy_state; 1003 yyps = yy_ps; 1004 yypv = yy_pv; 1005 } 1006 /* 1007 ** code supplied by user is placed in this switch 1008 */ 1009 switch( yytmp ) 1010 { 1011 1012 case 2: 1013 # line 119 "../prexgram.y" 1014 { prompt(); } break; 1015 case 3: 1016 # line 121 "../prexgram.y" 1017 { 1018 if (g_kernelmode) 1019 prbk_warn_pfilter_empty(); 1020 prompt(); 1021 } break; 1022 case 25: 1023 # line 149 "../prexgram.y" 1024 { yyerrok; } break; 1025 case 27: 1026 # line 155 "../prexgram.y" 1027 { yyval.intval = yypvt[-0].intval; } break; 1028 case 28: 1029 # line 156 "../prexgram.y" 1030 { yyval.intval = yypvt[-0].intval; } break; 1031 case 29: 1032 # line 157 "../prexgram.y" 1033 { yyval.intval = yypvt[-0].intval; } break; 1034 case 30: 1035 # line 158 "../prexgram.y" 1036 { yyval.intval = yypvt[-0].intval; } break; 1037 case 31: 1038 # line 159 "../prexgram.y" 1039 { yyval.intval = yypvt[-0].intval; } break; 1040 case 32: 1041 # line 160 "../prexgram.y" 1042 { yyval.intval = yypvt[-0].intval; } break; 1043 case 33: 1044 # line 161 "../prexgram.y" 1045 { yyval.intval = yypvt[-0].intval; } break; 1046 case 34: 1047 # line 162 "../prexgram.y" 1048 { yyval.intval = yypvt[-0].intval; } break; 1049 case 35: 1050 # line 163 "../prexgram.y" 1051 { yyval.intval = yypvt[-0].intval; } break; 1052 case 36: 1053 # line 164 "../prexgram.y" 1054 { yyval.intval = yypvt[-0].intval; } break; 1055 case 37: 1056 # line 165 "../prexgram.y" 1057 { yyval.intval = yypvt[-0].intval; } break; 1058 case 38: 1059 # line 166 "../prexgram.y" 1060 { yyval.intval = yypvt[-0].intval; } break; 1061 case 39: 1062 # line 167 "../prexgram.y" 1063 { yyval.intval = yypvt[-0].intval; } break; 1064 case 40: 1065 # line 168 "../prexgram.y" 1066 { yyval.intval = yypvt[-0].intval; } break; 1067 case 41: 1068 # line 171 "../prexgram.y" 1069 { help(); } break; 1070 case 42: 1071 # line 172 "../prexgram.y" 1072 { help_on_command(yypvt[-1].intval); } break; 1073 case 43: 1074 # line 173 "../prexgram.y" 1075 { help_on_topic(yypvt[-1].strval); } break; 1076 case 44: 1077 # line 177 "../prexgram.y" 1078 { 1079 if (!g_kernelmode) YYACCEPT; 1080 } break; 1081 case 45: 1082 # line 182 "../prexgram.y" 1083 { quit(B_TRUE, B_TRUE); } break; 1084 case 46: 1085 # line 183 "../prexgram.y" 1086 { quit(B_TRUE, B_FALSE); } break; 1087 case 47: 1088 # line 184 "../prexgram.y" 1089 { quit(B_FALSE, B_TRUE); } break; 1090 case 48: 1091 # line 185 "../prexgram.y" 1092 { quit(B_FALSE, B_FALSE); } break; 1093 case 49: 1094 # line 189 "../prexgram.y" 1095 { 1096 cmd_t *cmd_p; 1097 cmd_p = cmd_set(yypvt[-1].strval, CMD_ENABLE, NULL); 1098 if (cmd_p) 1099 process_cmd(g_hndl, cmd_p); 1100 } break; 1101 case 50: 1102 # line 196 "../prexgram.y" 1103 { 1104 cmd_t *cmd_p; 1105 cmd_p = cmd_expr(yypvt[-1].exprval, CMD_ENABLE, NULL); 1106 if (cmd_p) 1107 process_cmd(g_hndl, cmd_p); 1108 } break; 1109 case 51: 1110 # line 205 "../prexgram.y" 1111 { 1112 cmd_t *cmd_p; 1113 cmd_p = cmd_set(yypvt[-1].strval, CMD_DISABLE, NULL); 1114 if (cmd_p) 1115 process_cmd(g_hndl, cmd_p); 1116 } break; 1117 case 52: 1118 # line 212 "../prexgram.y" 1119 { 1120 cmd_t *cmd_p; 1121 cmd_p = cmd_expr(yypvt[-1].exprval, CMD_DISABLE, NULL); 1122 if (cmd_p) 1123 process_cmd(g_hndl, cmd_p); 1124 } break; 1125 case 53: 1126 # line 221 "../prexgram.y" 1127 { 1128 cmd_t *cmd_p; 1129 cmd_p = cmd_set(yypvt[-1].strval, CMD_TRACE, NULL); 1130 if (cmd_p) 1131 process_cmd(g_hndl, cmd_p); 1132 } break; 1133 case 54: 1134 # line 228 "../prexgram.y" 1135 { 1136 cmd_t *cmd_p; 1137 cmd_p = cmd_expr(yypvt[-1].exprval, CMD_TRACE, NULL); 1138 if (cmd_p) 1139 process_cmd(g_hndl, cmd_p); 1140 } break; 1141 case 55: 1142 # line 237 "../prexgram.y" 1143 { 1144 cmd_t *cmd_p; 1145 cmd_p = cmd_set(yypvt[-1].strval, CMD_UNTRACE, NULL); 1146 if (cmd_p) 1147 process_cmd(g_hndl, cmd_p); 1148 } break; 1149 case 56: 1150 # line 244 "../prexgram.y" 1151 { 1152 cmd_t *cmd_p; 1153 cmd_p = cmd_expr(yypvt[-1].exprval, CMD_UNTRACE, NULL); 1154 if (cmd_p) 1155 process_cmd(g_hndl, cmd_p); 1156 } break; 1157 case 57: 1158 # line 253 "../prexgram.y" 1159 { 1160 cmd_t *cmd_p; 1161 cmd_p = cmd_set(yypvt[-1].strval, CMD_CONNECT, yypvt[-2].strval); 1162 if (cmd_p) 1163 process_cmd(g_hndl, cmd_p); 1164 } break; 1165 case 58: 1166 # line 260 "../prexgram.y" 1167 { 1168 cmd_t *cmd_p; 1169 cmd_p = cmd_expr(yypvt[-1].exprval, CMD_CONNECT, yypvt[-2].strval); 1170 if (cmd_p) 1171 process_cmd(g_hndl, cmd_p); 1172 } break; 1173 case 59: 1174 # line 269 "../prexgram.y" 1175 { 1176 cmd_t *cmd_p; 1177 cmd_p = cmd_set(yypvt[-1].strval, CMD_CLEAR, NULL); 1178 if (cmd_p) 1179 process_cmd(g_hndl, cmd_p); 1180 } break; 1181 case 60: 1182 # line 276 "../prexgram.y" 1183 { 1184 cmd_t *cmd_p; 1185 cmd_p = cmd_expr(yypvt[-1].exprval, CMD_CLEAR, NULL); 1186 if (cmd_p) 1187 process_cmd(g_hndl, cmd_p); 1188 } break; 1189 case 61: 1190 # line 284 "../prexgram.y" 1191 { (void) set(yypvt[-2].strval, yypvt[-1].exprval); } break; 1192 case 62: 1193 # line 285 "../prexgram.y" 1194 { fcn(yypvt[-2].strval, yypvt[-1].strval); } break; 1195 case 63: 1196 # line 288 "../prexgram.y" 1197 { source_file(yypvt[-1].strval); } break; 1198 case 64: 1199 # line 289 "../prexgram.y" 1200 { source_file(yypvt[-1].strval); } break; 1201 case 65: 1202 # line 292 "../prexgram.y" 1203 { set_list(); } break; 1204 case 66: 1205 # line 295 "../prexgram.y" 1206 { cmd_list(); } break; 1207 case 67: 1208 # line 298 "../prexgram.y" 1209 { cmd_listtracefile(); } break; 1210 case 68: 1211 # line 301 "../prexgram.y" 1212 { fcn_list(); } break; 1213 case 69: 1214 # line 307 "../prexgram.y" 1215 { prbk_set_pfilter_mode(B_TRUE); } break; 1216 case 70: 1217 # line 309 "../prexgram.y" 1218 { prbk_set_pfilter_mode(B_FALSE); } break; 1219 case 71: 1220 # line 311 "../prexgram.y" 1221 { prbk_pfilter_add(yypvt[-1].pidlistval); } break; 1222 case 72: 1223 # line 313 "../prexgram.y" 1224 { prbk_pfilter_drop(yypvt[-1].pidlistval); } break; 1225 case 73: 1226 # line 315 "../prexgram.y" 1227 { prbk_show_pfilter_mode(); } break; 1228 case 74: 1229 # line 319 "../prexgram.y" 1230 { prbk_set_tracing(B_TRUE); } break; 1231 case 75: 1232 # line 321 "../prexgram.y" 1233 { prbk_set_tracing(B_FALSE); } break; 1234 case 76: 1235 # line 323 "../prexgram.y" 1236 { prbk_show_tracing(); } break; 1237 case 77: 1238 # line 327 "../prexgram.y" 1239 { list_set(yypvt[-3].specval, yypvt[-1].strval); } break; 1240 case 78: 1241 # line 329 "../prexgram.y" 1242 { list_expr(yypvt[-3].specval, yypvt[-1].exprval); } break; 1243 case 79: 1244 # line 332 "../prexgram.y" 1245 { list_values(yypvt[-1].specval); } break; 1246 case 80: 1247 # line 335 "../prexgram.y" 1248 { yyval.exprval = NULL; } break; 1249 case 81: 1250 # line 336 "../prexgram.y" 1251 { yyval.exprval = expr_list(yypvt[-1].exprval, yypvt[-0].exprval); } break; 1252 case 82: 1253 # line 339 "../prexgram.y" 1254 { yyval.specval = NULL; } break; 1255 case 83: 1256 # line 340 "../prexgram.y" 1257 { yyval.specval = spec_list(yypvt[-1].specval, yypvt[-0].specval); } break; 1258 case 84: 1259 # line 343 "../prexgram.y" 1260 { yyval.exprval = expr(yypvt[-2].specval, yypvt[-0].specval); } break; 1261 case 85: 1262 # line 344 "../prexgram.y" 1263 { yyval.exprval = expr(spec(strdup("keys"), 1264 SPEC_EXACT), yypvt[-0].specval); } break; 1265 case 86: 1266 # line 348 "../prexgram.y" 1267 { yyval.specval = spec(yypvt[-0].strval, SPEC_EXACT); } break; 1268 case 87: 1269 # line 349 "../prexgram.y" 1270 { yyval.specval = spec(yypvt[-0].strval, SPEC_EXACT); } break; 1271 case 88: 1272 # line 350 "../prexgram.y" 1273 { yyval.specval = spec(yypvt[-0].strval, SPEC_REGEXP); } break; 1274 case 89: 1275 # line 354 "../prexgram.y" 1276 { yyval.pidlistval = prbk_pidlist_add(yypvt[-2].pidlistval, yypvt[-0].intval); } break; 1277 case 90: 1278 # line 356 "../prexgram.y" 1279 { yyval.pidlistval = prbk_pidlist_add(NULL, yypvt[-0].intval); } break; 1280 case 92: 1281 # line 363 "../prexgram.y" 1282 { 1283 prbk_buffer_list(); 1284 } break; 1285 case 93: 1286 # line 367 "../prexgram.y" 1287 { 1288 extern int g_outsize; 1289 prbk_buffer_alloc(g_outsize); 1290 } break; 1291 case 94: 1292 # line 372 "../prexgram.y" 1293 { 1294 prbk_buffer_alloc(yypvt[-1].intval); 1295 } break; 1296 case 95: 1297 # line 376 "../prexgram.y" 1298 { 1299 prbk_buffer_dealloc(); 1300 } break; 1301 # line 556 "/usr/share/lib/ccs/yaccpar" 1302 } 1303 goto yystack; /* reset registers in driver code */ 1304 } 1305 1306