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

Cache object: 161147f20c71836c8e6df8b8926c263e


[ 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.