The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netiso/xebec/xebec.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: xebec.c,v 1.9 2005/02/26 22:39:49 perry Exp $  */
    2 
    3 #include <sys/cdefs.h>
    4 __RCSID("$NetBSD: xebec.c,v 1.9 2005/02/26 22:39:49 perry Exp $");
    5 
    6 #include "xebec.h"
    7 #include "llparse.h"
    8 #ifndef E_TABLE
    9 #define E_TABLE "xebec.e"
   10 #endif  /* !E_TABLE */
   11 
   12 #include "main.h"
   13 #include "sets.h"
   14 #include "procs.h"
   15 #include <stdio.h>
   16 
   17 extern FILE *eventfile_h, *actfile;
   18 
   19 void
   20 llaction(lln,token)
   21 LLtoken *token;
   22 {
   23         struct llattr *llattr;
   24         llattr = &llattrdesc[lldescindex-1];
   25 switch(lln) {
   26 case 1:
   27         llfinprod();
   28         break;
   29 
   30 case 10: {
   31 
   32                                         if(strlen(llattr->llabase[3].ID.address) > 50 ) {
   33                                                 fprintf(stderr,
   34                                                 "Protocol name may not exceed 50 chars in length.\n");
   35                                                 Exit(-1);
   36                                         }
   37                                         strcpy(protocol, llattr->llabase[3].ID.address);
   38                                         openfiles(protocol);
   39 
   40 } break;
   41 
   42 case 11: {
   43 
   44                                         llattr->llabase[7].pcb.isevent = 0;
   45 
   46 } break;
   47 
   48 case 12: {
   49 
   50                                   fprintf(actfile, "\ntypedef %s %s%s;\n",
   51                                                           llattr->llabase[7].pcb.address,protocol, PCBNAME);
   52                                   llattr->llabase[8].syn.type = PCB_SYN;
   53 
   54 } break;
   55 
   56 case 13: {
   57  llattr->llabase[11].part.type = (unsigned char) STATESET;
   58 } break;
   59 
   60 case 14: {
   61  end_states(eventfile_h);
   62 } break;
   63 
   64 case 15: {
   65  llattr->llabase[14].pcb.isevent = 1;
   66 } break;
   67 
   68 case 16: {
   69 
   70                                         fprintf(eventfile_h, "\t"); /* fmq gags on single chars */
   71                                         includecode(eventfile_h, llattr->llabase[14].pcb.address);
   72                                         fprintf(eventfile_h, "\n"); /* fmq gags on single chars */
   73                                         llattr->llabase[15].syn.type = EVENT_SYN;
   74 
   75 } break;
   76 
   77 case 17: {
   78 
   79                                         llattr->llabase[16].part.type = (unsigned char)EVENTSET;
   80 
   81 } break;
   82 
   83 case 18: {
   84  end_events();
   85 } break;
   86 
   87 case 19: {
   88 
   89                                         putincludes();
   90                                         putdriver(actfile, 9);
   91 
   92 } break;
   93 
   94 case 20: {
   95         if(llattr->llabase[0].pcb.isevent)  {
   96                                         fprintf(stderr,
   97                                         "Event is a list of objects enclosed by \"{}\"\n");
   98                                         Exit(-1);
   99                                 }
  100                           fprintf(eventfile_h, "struct ");
  101 
  102 } break;
  103 
  104 case 21: {
  105  llattr->llabase[0].pcb.address = llattr->llabase[2].ACTION.address;
  106 } break;
  107 
  108 case 22: {
  109         if( ! llattr->llabase[0].pcb.isevent)  {
  110                                         fprintf(stderr,
  111                                         "Pcb requires a type or structure definition.\"{}\"\n");
  112                                         Exit(-1);
  113                                 }
  114                            llattr->llabase[0].pcb.address = llattr->llabase[1].ACTION.address;
  115 
  116 } break;
  117 
  118 case 23: {
  119   llattr->llabase[0].pcb.address = llattr->llabase[1].ID.address;
  120 } break;
  121 
  122 case 24: {
  123  synonyms[llattr->llabase[0].syn.type] = stash( llattr->llabase[2].ID.address );
  124 } break;
  125 
  126 case 25: {
  127  includecode(actfile, llattr->llabase[2].ACTION.address);
  128 } break;
  129 
  130 case 26: {
  131 
  132                         llattr->llabase[2].partrest.address = llattr->llabase[1].ID.address;
  133                         llattr->llabase[2].partrest.type = llattr->llabase[0].part.type;
  134 
  135 } break;
  136 
  137 case 27: {
  138  llattr->llabase[3].parttail.type = llattr->llabase[0].part.type;
  139 } break;
  140 
  141 case 28: {
  142  llattr->llabase[1].part.type = llattr->llabase[0].parttail.type;
  143 } break;
  144 
  145 case 29: {
  146 
  147                           if(  lookup( llattr->llabase[0].partrest.type, llattr->llabase[0].partrest.address ) ) {
  148                                 fprintf(stderr, "bnf:trying to redefine obj type 0x%x, adr %s\n",
  149                                         llattr->llabase[0].partrest.type, llattr->llabase[0].partrest.address);
  150                                 Exit(-1);
  151                           }
  152                           llattr->llabase[2].setdef.type = llattr->llabase[0].partrest.type;
  153                           llattr->llabase[2].setdef.address = stash( llattr->llabase[0].partrest.address );
  154                           llattr->llabase[2].setdef.keep = 1;
  155 
  156 } break;
  157 
  158 case 30: {
  159  llattr->llabase[3].setstruct.object = llattr->llabase[2].setdef.object;
  160 } break;
  161 
  162 case 31: {
  163 
  164                  defineitem(llattr->llabase[0].partrest.type,
  165                                         llattr->llabase[0].partrest.address, llattr->llabase[1].ACTION.address);
  166 
  167 } break;
  168 
  169 case 32: {
  170 
  171                         defineitem(llattr->llabase[0].partrest.type, llattr->llabase[0].partrest.address, (char *)0);
  172 
  173 } break;
  174 
  175 case 33: {
  176 
  177                                 if(llattr->llabase[0].setstruct.object)  {
  178                                         /* WHEN COULD THIS BE FALSE??
  179                                          * isn't it supposed to be setstruct.object???
  180                                          * (it used to be $ACTION.address)
  181                                          */
  182 
  183                                         llattr->llabase[0].setstruct.object->obj_struc = llattr->llabase[1].ACTION.address;
  184                                         fprintf(eventfile_h,
  185                                                 "struct %s %s%s;\n\n", llattr->llabase[1].ACTION.address,
  186                                                 EV_PREFIX,  llattr->llabase[0].setstruct.object->obj_name);
  187                                 }
  188 
  189 } break;
  190 
  191 case 34: {
  192 
  193                         llattr->llabase[2].setlist.setnum =
  194                         defineset(llattr->llabase[0].setdef.type, llattr->llabase[0].setdef.address, llattr->llabase[0].setdef.keep);
  195 
  196 } break;
  197 
  198 case 35: {
  199  llattr->llabase[0].setdef.object = llattr->llabase[2].setlist.setnum;
  200 } break;
  201 
  202 case 36: {
  203 
  204                 member(llattr->llabase[0].setlist.setnum, llattr->llabase[1].ID.address);
  205                                 llattr->llabase[2].setlisttail.setnum = llattr->llabase[0].setlist.setnum;
  206 
  207 } break;
  208 
  209 case 37: {
  210  llattr->llabase[2].setlist.setnum = llattr->llabase[0].setlisttail.setnum;
  211 } break;
  212 
  213 case 38: {
  214  transno++;
  215 } break;
  216 
  217 case 39: {
  218 
  219                 CurrentEvent /* GAG! */ = llattr->llabase[6].event.object;
  220 
  221 } break;
  222 
  223 case 40: {
  224 
  225                 llattr->llabase[8].actionpart.string = llattr->llabase[7].predicatepart.string;
  226                 llattr->llabase[8].actionpart.newstate = llattr->llabase[1].newstate.object;
  227                 llattr->llabase[8].actionpart.oldstate = llattr->llabase[5].oldstate.object;
  228 
  229 } break;
  230 
  231 case 41: {
  232 
  233                  llattr->llabase[0].predicatepart.string = stash ( llattr->llabase[1].PREDICATE.address );
  234 
  235 } break;
  236 
  237 case 42: {
  238 
  239                 llattr->llabase[0].predicatepart.string = (char *)0;
  240 
  241 } break;
  242 
  243 case 43: {
  244 
  245           statetable( llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate,
  246                                         llattr->llabase[0].actionpart.newstate,
  247                                         acttable(actfile, llattr->llabase[1].ACTION.address ),
  248                                         CurrentEvent );
  249           if( print_trans ) {
  250                 dump_trans( llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate,
  251                                         llattr->llabase[0].actionpart.newstate,
  252                                         llattr->llabase[1].ACTION.address, CurrentEvent );
  253           }
  254 
  255 } break;
  256 
  257 case 44: {
  258 
  259           statetable(llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate, llattr->llabase[0].actionpart.newstate,
  260                                   0, CurrentEvent ); /* KLUDGE - remove this */
  261           if( print_trans ) {
  262                 dump_trans( llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate,
  263                                         llattr->llabase[0].actionpart.newstate,
  264                                         "NULLACTION", CurrentEvent );
  265           }
  266 
  267 } break;
  268 
  269 case 45: {
  270 
  271                 llattr->llabase[0].oldstate.object = Lookup(STATESET, llattr->llabase[1].ID.address);
  272 
  273 } break;
  274 
  275 case 46: {
  276 
  277                         llattr->llabase[1].setdef.address = (char *)0;
  278                         llattr->llabase[1].setdef.type = (unsigned char)STATESET;
  279                         llattr->llabase[1].setdef.keep = 0;
  280 
  281 } break;
  282 
  283 case 47: {
  284 
  285                         llattr->llabase[0].oldstate.object = llattr->llabase[1].setdef.object;
  286 
  287 } break;
  288 
  289 case 48: {
  290 
  291                 llattr->llabase[0].newstate.object = Lookup(STATESET, llattr->llabase[1].ID.address);
  292 
  293 } break;
  294 
  295 case 49: {
  296 
  297                 extern struct Object *SameState;
  298 
  299                 llattr->llabase[0].newstate.object = SameState;
  300 
  301 } break;
  302 
  303 case 50: {
  304 
  305                         llattr->llabase[0].event.object = Lookup(EVENTSET, llattr->llabase[1].ID.address);
  306 
  307 } break;
  308 
  309 case 51: {
  310 
  311                         llattr->llabase[1].setdef.address = (char *)0;
  312                         llattr->llabase[1].setdef.type = (unsigned char)EVENTSET;
  313                         llattr->llabase[1].setdef.keep = 0;
  314 
  315 } break;
  316 
  317 case 52: {
  318 
  319                         llattr->llabase[0].event.object = llattr->llabase[1].setdef.object;
  320 
  321 } break;
  322 }
  323 }
  324 char *llstrings[] = {
  325         "<null>",
  326         "ID",
  327         "STRUCT",
  328         "SYNONYM",
  329         "PREDICATE",
  330         "ACTION",
  331         "PROTOCOL",
  332         "LBRACK",
  333         "RBRACK",
  334         "LANGLE",
  335         "EQUAL",
  336         "COMMA",
  337         "STAR",
  338         "EVENTS",
  339         "TRANSITIONS",
  340         "INCLUDE",
  341         "STATES",
  342         "SEMI",
  343         "PCB",
  344         "DEFAULT",
  345         "NULLACTION",
  346         "SAME",
  347         "ENDMARKER",
  348         "pcb",
  349         "syn",
  350         "setlist",
  351         "setlisttail",
  352         "part",
  353         "parttail",
  354         "partrest",
  355         "setstruct",
  356         "setdef",
  357         "translist",
  358         "transition",
  359         "event",
  360         "oldstate",
  361         "newstate",
  362         "predicatepart",
  363         "actionpart",
  364         "program",
  365         "includelist",
  366         "optsemi",
  367         "translisttail",
  368         "$goal$",
  369         (char *) 0
  370 };
  371 short llnterms = 23;
  372 short llnsyms = 44;
  373 short llnprods = 38;
  374 short llinfinite = 10000;
  375 short llproductions[] = {
  376 41, -21, 5, -20, 2,
  377 41, -22, 5,
  378 41, -23, 1,
  379 -24, 1, 3,
  380 
  381 26, -36, 1,
  382 25, -37, 11,
  383 
  384 28, -27, 29, -26, 1,
  385 27, -28,
  386 
  387 30, -30, 31, -29, 10,
  388 -31, 5,
  389 -32,
  390 -33, 5,
  391 
  392 -35, 8, 25, -34, 7,
  393 42, 33,
  394 17, 38, -40, 37, -39, 34, 35, 10, 10, 9, -38, 36,
  395 -50, 1,
  396 -52, 31, -51,
  397 -45, 1,
  398 -47, 31, -46,
  399 -48, 1,
  400 -49, 21,
  401 -41, 4,
  402 -42, 19,
  403 -43, 5,
  404 -44, 20,
  405 32, -19, 14, -18, 12, 27, -17, 24, -16, 23, -15, 13, -14, 12, 27, -13, 16, 12, 24, -12, 23, -11, 18, 40, 12, -10, 1, 6, 12,
  406 12, -25, 5, 15,
  407 
  408 17,
  409 
  410 32,
  411 
  412 22, 39,
  413 
  414 };
  415 struct llprodindex llprodindex[] = {
  416 {   0,   0,   0 }, {   0,   5,  19 }, {   5,   3,   3 }, {   8,   3,   2 },
  417 {  11,   3,   2 }, {  14,   0,   2 }, {  14,   3,   0 }, {  17,   3,   1 },
  418 {  20,   0,   0 }, {  20,   5,   3 }, {  25,   2,   0 }, {  27,   0,   3 },
  419 {  27,   5,   1 }, {  32,   2,   0 }, {  34,   1,   3 }, {  35,   2,   1 },
  420 {  37,   0,   0 }, {  37,   5,   1 }, {  42,   2,   0 }, {  44,  12,   3 },
  421 {  56,   2,   2 }, {  58,   3,   2 }, {  61,   2,   0 }, {  63,   3,   2 },
  422 {  66,   2,   1 }, {  68,   2,   0 }, {  70,   2,   9 }, {  72,   2,   1 },
  423 {  74,   2,   1 }, {  76,   2,   1 }, {  78,  29,   1 }, { 107,   4,   1 },
  424 { 111,   0,   1 }, { 111,   1,   1 }, { 112,   0,   1 }, { 112,   1,   1 },
  425 { 113,   0,   1 }, { 113,   2,   2 }, {   0,   0,   0 }
  426 };
  427 short llepsilon[] = {
  428  0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
  429  0, 1, 0, 0, 1, 0, 1, 0, 0, 0,
  430  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  431  0, 0, 1, 0, 1, 0, 1, 0, 0
  432 };
  433 struct llparsetable llparsetable[] = {
  434 {   1,   3 }, {   2,   1 }, {   5,   2 }, {   0,  23 }, {   1,   5 },
  435 {   3,   4 }, {  12,   5 }, {   0,  24 }, {   1,   6 }, {   0,  25 },
  436 {   8,   8 }, {  11,   7 }, {   0,  26 }, {   1,   9 }, {   0,  27 },
  437 {   1,  10 }, {  12,  11 }, {   0,  28 }, {   1,  14 }, {   5,  13 },
  438 {  10,  12 }, {  12,  14 }, {   0,  29 }, {   1,  16 }, {   5,  15 },
  439 {  12,  16 }, {   0,  30 }, {   7,  17 }, {   0,  31 }, {   1,  18 },
  440 {  21,  18 }, {   0,  32 }, {   1,  19 }, {  21,  19 }, {   0,  33 },
  441 {   1,  20 }, {   7,  21 }, {   0,  34 }, {   1,  22 }, {   7,  23 },
  442 {   0,  35 }, {   1,  24 }, {  21,  25 }, {   0,  36 }, {   4,  26 },
  443 {  19,  27 }, {   0,  37 }, {   5,  28 }, {  20,  29 }, {   0,  38 },
  444 {  12,  30 }, {   0,  39 }, {  15,  31 }, {  18,  32 }, {   0,  40 },
  445 {   1,  34 }, {   3,  34 }, {  12,  34 }, {  17,  33 }, {   0,  41 },
  446 {   1,  35 }, {  21,  35 }, {  22,  36 }, {   0,  42 }, {  12,  37 },
  447 {   0,  43 }, {   0,   0 }
  448 };
  449 short llparseindex[] = {
  450  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  451  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  452  0, 0, 0, 0, 4, 8, 10, 13, 15, 18,
  453  23, 27, 29, 32, 35, 38, 41, 44, 47, 50,
  454  52, 55, 60, 64, 0
  455 };

Cache object: 4d8c85bccc69c0070df5b38108c910a2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.