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

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.bnf,v 1.6 2005/02/11 06:21:21 simonb Exp $       */
    2 
    3 #include "main.h"
    4 #include "sets.h"
    5 #include "procs.h"
    6 #include <stdio.h> 
    7 
    8 extern FILE *eventfile_h, *actfile; 
    9 }
   10 
   11 *fmq
   12 
   13         novocab
   14         nobnf
   15         nofirst
   16         nofollow
   17         noparsetable
   18         noerrortables
   19         nos
   20         noe
   21 
   22 *terminals
   23 
   24 ID                      0       0       { char *address; }
   25 STRUCT          0       0
   26 SYNONYM         0       0
   27 PREDICATE               0       0       { char *address; }
   28 ACTION          0       0       { char *address; }
   29 /*
   30 FSTRING         0       0       { char *address; }
   31 */
   32 PROTOCOL        0       0       
   33 LBRACK          0       0
   34 RBRACK          0       0
   35 LANGLE          0       0
   36 EQUAL           0       0
   37 COMMA           0       0
   38 STAR            0       0
   39 EVENTS          0       0
   40 TRANSITIONS     0       0
   41 INCLUDE         0       0
   42 STATES          0       0
   43 SEMI            0       0
   44 PCB                     0       0               { char *address; }
   45 DEFAULT         0       0
   46 NULLACTION      0       0
   47 SAME            0       0
   48 
   49 *nonterminals
   50 
   51 pcb                             { char *address; int isevent; }
   52 syn                             { int type; }
   53 setlist                 { struct Object *setnum; }
   54 setlisttail             { struct Object *setnum; }
   55 part                    { unsigned char type; }
   56 parttail                { unsigned char type; }
   57 partrest                { unsigned char type; char *address; }
   58 setstruct               { struct Object *object; }
   59 setdef                  { unsigned char type,keep; char *address; struct Object *object; }
   60 translist               
   61 transition      
   62 event                   { struct Object *object;  }
   63 oldstate                {       struct Object *object;  }
   64 newstate                {       struct Object *object;  }
   65 predicatepart   {       char *string; }
   66 actionpart              {       char *string; struct Object *oldstate; struct Object *newstate; }
   67 
   68 *productions
   69 
   70 program         ::= 
   71                                 STAR PROTOCOL ID 
   72                                 {       
   73                                         if(strlen($ID.address) > 50 ) {
   74                                                 fprintf(stderr, 
   75                                                 "Protocol name may not exceed 50 chars in length.\n"); 
   76                                                 Exit(-1);
   77                                         }
   78                                         strcpy(protocol, $ID.address); 
   79                                         openfiles(protocol); 
   80                                 }
   81                                 STAR includelist
   82                                 PCB  
   83                                 { 
   84                                         $$pcb.isevent = 0; 
   85                                 }
   86                                 pcb 
   87                                 {
   88                                   fprintf(actfile, "\ntypedef %s %s%s;\n",
   89                                                           $pcb[7].address,protocol, PCBNAME); 
   90                                   $$syn.type = PCB_SYN;
   91                                 } 
   92                                 syn 
   93                                 STAR STATES { $$part.type = (unsigned char) STATESET; } part
   94                                 STAR { end_states(eventfile_h); } EVENTS 
   95                                 { $$pcb.isevent = 1; }
   96                                 pcb 
   97                                 {
   98                                         fprintf(eventfile_h, "\t"); /* fmq gags on single chars */
   99                                         includecode(eventfile_h, $pcb[14].address);
  100                                         fprintf(eventfile_h, "\n"); /* fmq gags on single chars */
  101                                         $$syn.type = EVENT_SYN;
  102                                 }
  103                                 syn 
  104                                 { 
  105                                         $$part.type = (unsigned char)EVENTSET; 
  106                                 } 
  107                                 part 
  108                                 STAR { end_events(); } 
  109                                 TRANSITIONS 
  110                                 { 
  111                                         putincludes();
  112                                         putdriver(actfile, 9);
  113                                 } 
  114                                 translist
  115 ;
  116 pcb     ::=  STRUCT  
  117                          {      if($pcb.isevent)  {
  118                                         fprintf(stderr, 
  119                                         "Event is a list of objects enclosed by \"{}\"\n");
  120                                         Exit(-1);
  121                                 }
  122                           fprintf(eventfile_h, "struct "); 
  123                         }
  124                          ACTION { $pcb.address = $ACTION.address; }
  125                          optsemi
  126                 ::=      ACTION 
  127                         {       if( ! $pcb.isevent)  {
  128                                         fprintf(stderr, 
  129                                         "Pcb requires a type or structure definition.\"{}\"\n");
  130                                         Exit(-1);
  131                                 }
  132                            $pcb.address = $ACTION.address; 
  133                         }
  134                          optsemi
  135                 ::=  ID {  $pcb.address = $ID.address; } optsemi
  136 ;
  137 
  138 syn ::= SYNONYM ID { synonyms[$syn.type] = stash( $ID.address ); }
  139                 ::= 
  140 ;
  141 
  142 optsemi ::= SEMI 
  143                 ::= 
  144 ;
  145 includelist ::= INCLUDE ACTION { includecode(actfile, $ACTION.address);} STAR
  146                         ::=
  147 ;
  148 part ::= ID 
  149                 { 
  150                         $$partrest.address = $ID.address;
  151                         $$partrest.type = $part.type; 
  152                 }
  153                 partrest  
  154                 { $$parttail.type = $part.type; } 
  155                 parttail
  156 ;
  157 parttail ::= { $$part.type = $parttail.type; } part 
  158                 ::=  
  159 ;
  160 partrest ::=  EQUAL 
  161                         { 
  162                           if(  lookup( $partrest.type, $partrest.address ) ) {
  163                                 fprintf(stderr, "bnf:trying to redefine obj type 0x%x, adr %s\n",
  164                                         $partrest.type, $partrest.address);
  165                                 Exit(-1);
  166                           } 
  167                           $$setdef.type = $partrest.type;
  168                           $$setdef.address = stash( $partrest.address );
  169                           $$setdef.keep = 1;
  170                         } setdef { $$setstruct.object = $setdef.object; } setstruct
  171 
  172         ::=  ACTION 
  173                 { 
  174                  defineitem($partrest.type, 
  175                                         $partrest.address, $ACTION.address); 
  176                 }
  177 
  178         ::= { 
  179                         defineitem($partrest.type, $partrest.address, (char *)0);
  180                 }
  181 ;
  182 
  183 setstruct ::= ACTION 
  184                         {
  185                                 if($setstruct.object)  {
  186                                         /* WHEN COULD THIS BE FALSE?? 
  187                                          * isn't it supposed to be setstruct.object???
  188                                          * (it used to be $ACTION.address)
  189                                          */
  190 
  191                                         $setstruct.object->obj_struc = $ACTION.address;
  192                                         fprintf(eventfile_h, 
  193                                                 "struct %s %s%s;\n\n", $ACTION.address, 
  194                                                 EV_PREFIX,  $setstruct.object->obj_name);
  195                                 }
  196                         }
  197                 ::=
  198 ;
  199 
  200 setdef ::= LBRACK 
  201                 { 
  202                         $$setlist.setnum = 
  203                         defineset($setdef.type, $setdef.address, $setdef.keep); 
  204                 } setlist RBRACK { $setdef.object = $setlist.setnum; }
  205 ;
  206 
  207 setlist ::= ID 
  208         { 
  209                 member($setlist.setnum, $ID.address); 
  210                                 $$setlisttail.setnum = $setlist.setnum; 
  211         } setlisttail 
  212 ;
  213 
  214 setlisttail ::= COMMA { $$setlist.setnum = $setlisttail.setnum; } setlist
  215                 ::=
  216 ;
  217 translist               ::=      transition  translisttail 
  218 ;
  219 translisttail   ::= translist
  220         ::=     
  221 ;
  222 transition ::=  newstate { transno++; } LANGLE EQUAL EQUAL oldstate  
  223         event 
  224         { 
  225                 CurrentEvent /* GAG! */ = $event.object; 
  226          }
  227         predicatepart
  228         { 
  229                 $$actionpart.string = $predicatepart.string; 
  230                 $$actionpart.newstate = $newstate.object; 
  231                 $$actionpart.oldstate = $oldstate.object;
  232         }
  233         actionpart
  234         SEMI
  235 ;
  236 
  237 predicatepart ::= PREDICATE
  238         { 
  239                  $predicatepart.string = stash ( $PREDICATE.address );
  240         }
  241         ::= DEFAULT
  242         { 
  243                 $predicatepart.string = (char *)0;
  244         }
  245 ;
  246 
  247 actionpart ::=  
  248         ACTION
  249         {
  250           statetable( $actionpart.string, $actionpart.oldstate, 
  251                                         $actionpart.newstate,
  252                                         acttable(actfile, $ACTION.address ), 
  253                                         CurrentEvent ); 
  254           if( print_trans ) {
  255                 dump_trans( $actionpart.string, $actionpart.oldstate, 
  256                                         $actionpart.newstate,
  257                                         $ACTION.address, CurrentEvent ); 
  258           }
  259         }
  260         ::= NULLACTION
  261         {
  262           statetable($actionpart.string, $actionpart.oldstate, $actionpart.newstate,
  263                                   0, CurrentEvent ); /* KLUDGE - remove this */
  264           if( print_trans ) {
  265                 dump_trans( $actionpart.string, $actionpart.oldstate, 
  266                                         $actionpart.newstate,
  267                                         "NULLACTION", CurrentEvent ); 
  268           }
  269         }
  270 ;
  271 
  272 oldstate ::= ID 
  273         {       
  274                 $oldstate.object = Lookup(STATESET, $ID.address);
  275         }
  276         ::= {
  277                         $$setdef.address = (char *)0;
  278                         $$setdef.type = (unsigned char)STATESET; 
  279                         $$setdef.keep = 0;
  280                 }
  281                 setdef 
  282                 { 
  283                         $oldstate.object = $setdef.object; 
  284                 }
  285 ;
  286 
  287 newstate ::= ID 
  288         { 
  289                 $newstate.object = Lookup(STATESET, $ID.address); 
  290         }
  291 ;
  292 
  293 newstate ::= SAME 
  294         { 
  295                 extern struct Object *SameState;
  296 
  297                 $newstate.object = SameState;
  298         }
  299 ;
  300 
  301 event ::= ID 
  302                 {
  303                         $event.object = Lookup(EVENTSET, $ID.address); 
  304                 }
  305         ::= 
  306                 {
  307                         $$setdef.address = (char *)0;
  308                         $$setdef.type = (unsigned char)EVENTSET; 
  309                         $$setdef.keep = 0;
  310                 }
  311                 setdef 
  312                 { 
  313                         $event.object = $setdef.object; 
  314                 }
  315 ;
  316 
  317 *end

Cache object: cd2b73c0a5271873fdf6e496e2f472cb


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