diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-02-18 21:46:04 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-02-18 21:46:04 +0000 |
commit | b2150490a157b3181fa1a0615ce7b5c154e482aa (patch) | |
tree | d22c8d3fdba01b112d6497573cea2294367df647 /sys/netiso | |
parent | b2602402b6e07aaca13715b0f5bc5a2abcc69f11 (diff) |
bye bye. i delete this not because it is disgusting, but because it is disgusting code in the wrong place
Diffstat (limited to 'sys/netiso')
-rw-r--r-- | sys/netiso/xebec/Makefile | 10 | ||||
-rw-r--r-- | sys/netiso/xebec/debug.h | 22 | ||||
-rw-r--r-- | sys/netiso/xebec/llparse.c | 367 | ||||
-rw-r--r-- | sys/netiso/xebec/llparse.h | 145 | ||||
-rw-r--r-- | sys/netiso/xebec/llscan.c | 431 | ||||
-rw-r--r-- | sys/netiso/xebec/main.c | 411 | ||||
-rw-r--r-- | sys/netiso/xebec/main.h | 32 | ||||
-rw-r--r-- | sys/netiso/xebec/malloc.c | 135 | ||||
-rw-r--r-- | sys/netiso/xebec/malloc.h | 4 | ||||
-rw-r--r-- | sys/netiso/xebec/procs.c | 438 | ||||
-rw-r--r-- | sys/netiso/xebec/procs.h | 5 | ||||
-rw-r--r-- | sys/netiso/xebec/putdriver.c | 244 | ||||
-rw-r--r-- | sys/netiso/xebec/sets.c | 473 | ||||
-rw-r--r-- | sys/netiso/xebec/sets.h | 36 | ||||
-rw-r--r-- | sys/netiso/xebec/test.trans | 65 | ||||
-rw-r--r-- | sys/netiso/xebec/test_def.h | 15 | ||||
-rw-r--r-- | sys/netiso/xebec/xebec.bnf | 317 | ||||
-rw-r--r-- | sys/netiso/xebec/xebec.c | 451 | ||||
-rw-r--r-- | sys/netiso/xebec/xebec.h | 88 |
19 files changed, 0 insertions, 3689 deletions
diff --git a/sys/netiso/xebec/Makefile b/sys/netiso/xebec/Makefile deleted file mode 100644 index 200d10088c7..00000000000 --- a/sys/netiso/xebec/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $OpenBSD: Makefile,v 1.2 1996/03/04 10:37:00 mickey Exp $ -# $NetBSD: Makefile,v 1.5 1994/06/29 06:40:59 cgd Exp $ -# @(#)Makefile 5.16 (Berkeley) 4/26/91 - -PROG= xebec -SRCS= llparse.c llscan.c main.c malloc.c procs.c putdriver.c sets.c xebec.c -CFLAGS+= -DDEBUG -traditional -NOMAN = noman - -.include <bsd.prog.mk> diff --git a/sys/netiso/xebec/debug.h b/sys/netiso/xebec/debug.h deleted file mode 100644 index d2ed5992039..00000000000 --- a/sys/netiso/xebec/debug.h +++ /dev/null @@ -1,22 +0,0 @@ -/* $OpenBSD: debug.h,v 1.3 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: debug.h,v 1.4 1994/06/29 06:41:00 cgd Exp $ */ - -#define OUT stdout - -extern int debug[128]; - -#ifdef DEBUG -extern int column; - -#define IFDEBUG(letter) \ - if(debug['letter']) { -#define ENDDEBUG ; (void) fflush(stdout);} - -#else - -#define STAR * -#define IFDEBUG(letter) //*beginning of comment*/STAR -#define ENDDEBUG STAR/*end of comment*// - -#endif /* DEBUG */ - diff --git a/sys/netiso/xebec/llparse.c b/sys/netiso/xebec/llparse.c deleted file mode 100644 index 43d25fb3b68..00000000000 --- a/sys/netiso/xebec/llparse.c +++ /dev/null @@ -1,367 +0,0 @@ -/* $OpenBSD: llparse.c,v 1.3 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: llparse.c,v 1.4 1994/06/29 06:41:02 cgd Exp $ */ - -/* - * ************************* NOTICE ******************************* - * This code is in the public domain. It cannot be copyrighted. - * This ll parser was originally written by Keith Thompson for the - * University of Wisconsin Crystal project. - * It was based on an FMQ lr parser written by Jon Mauney at the - * University of Wisconsin. - * It was subsequently modified very slightly by Nancy Hall at the - * University of Wisconsin for the Crystal project. - * **************************************************************** - */ -#include "xebec.h" -#include "llparse.h" -#include "main.h" -#include <stdio.h> - -#include "debug.h" - -#define LLMINACTION -LLINF - -short llparsestack[STACKSIZE]; -short llstackptr = 0; -LLtoken lltoken; - -llparse() -{ - register havetoken = FALSE; - register sym; - register LLtoken *t = &lltoken; - register parseaction; - register accepted = FALSE; - - llpushprod(llnprods-1); /* $$$ ::= <start symbol> */ - - do { - sym = llparsestack[llstackptr]; - IFDEBUG(L) - printf("llparse() top of loop, llstackptr=%d, sym=%d\n", - llstackptr, sym); - ENDDEBUG - - if(sym < 0) { - /* action symbol */ - if(sym <= LLMINACTION) { - for(;sym<=LLMINACTION;sym++) { - llaction(1, t); /* calls llfinprod */ - } - llstackptr--; - continue; - } else { llaction(-sym, t); - llstackptr--; - continue; - } - } - - if(sym < llnterms) { - - /* it's a terminal symbol */ - - if(!havetoken) { - llgettoken(t); - havetoken = TRUE; - } - - if(sym == t->llterm) { - llpushattr(t->llattrib); - llaccept(t); - llstackptr--; /* pop terminal */ - if(t->llterm == llnterms-1) { /* end symbol $$$ */ - accepted = TRUE; - } else { - havetoken = FALSE; - } - } else { - llparsererror(t); /* wrong terminal on input */ - havetoken = FALSE; - } - continue; - } - - /* non terminal */ - - if(!havetoken) { - llgettoken(t); - havetoken = TRUE; - } - - /* consult parse table for new production */ - parseaction = llfindaction(sym, t->llterm); - - if(parseaction == 0) { - /* error entry */ - llparsererror(t); - havetoken = FALSE; - continue; - } - - if(llepsilon[parseaction]) { - /* epsilon production */ - if(llepsilonok(t->llterm)) { - llstackptr--; /* pop nonterminal */ - llpushprod(parseaction); /* push rhs of production */ - } else { - llparsererror(t); - havetoken = FALSE; - } - } else { - llstackptr--; /* pop nonterminal */ - llpushprod(parseaction); /* push rhs of production */ - } - } while(!accepted); - - return(0); -} - -llpushprod(prod) /* recognize production prod - push rhs on stack */ -short prod; -{ - register start; - register length; - register count; - - start = llprodindex[prod].llprodstart; - length = llprodindex[prod].llprodlength; - - IFDEBUG(L) - printf("llpushprod(%d) llstackptr=0x%x(%d), length = 0x%x(%d)\n", - prod, llstackptr, llstackptr, length , length); - /* - dump_parse_stack(); - */ - ENDDEBUG - if(llstackptr+length >= STACKSIZE) { - fprintf(stderr,"Parse stack overflow. llstackptr=0x%x, length=0x%x\n", - llstackptr, length); - Exit(-1); - } - - - llsetattr(llprodindex[prod].llprodtlen); - - /* put a marker on the stack to mark beginning of production */ - if(llparsestack[llstackptr] <= LLMINACTION) { - (llparsestack[llstackptr]) --; /* if there's already one there, don't - put another on; just let it represent all of - the adjacent markers */ - } - else { - llstackptr++; - llparsestack[llstackptr] = LLMINACTION; - } - - for(count=0; count<length; count++) { - llstackptr++; - llparsestack[llstackptr] = llproductions[start++]; - } - if(llstackptr > STACKSIZE) { - fprintf(stderr, "PARSE STACK OVERFLOW! \n"); Exit(-1); - Exit(-1); - } -} - - -llepsilonok(term) -{ - register ptr; - register sym; - register pact; - register nomore; - register rval; - - IFDEBUG(L) - printf("llepsilonok() enter\n"); - ENDDEBUG - rval = TRUE; - - ptr = llstackptr; - - do { - sym = llparsestack[ptr]; - - if(sym < 0) { - ptr--; - nomore = ptr == 0; - continue; - } - - if(sym < llnterms) { - nomore = TRUE; - rval = sym == term; - continue; - } - - pact = llfindaction(sym, term); - - if(pact == 0) { - nomore = TRUE; - rval = FALSE; - continue; - } - - if(llepsilon[pact] == TRUE) { - ptr--; - nomore = ptr == 0; - } - else { - nomore = TRUE; - } - - } while(!nomore); - - return(rval); -} - - -short llfindaction(sym, term) -{ - register index; - - IFDEBUG(L) - printf("llfindaction(sym=%d, term=%d) enter \n", sym, term); - ENDDEBUG - index = llparseindex[sym]; - - while(llparsetable[index].llterm != 0) { - if(llparsetable[index].llterm == term) { - return(llparsetable[index].llprod); - } - index++; - } - return(0); -} - - -llparsererror(token) -LLtoken *token; -{ - IFDEBUG(L) - fprintf(stderr,"llparsererror() enter\n"); - prt_token(token); - ENDDEBUG - - fprintf(stderr, "Syntax error: "); - prt_token(token); - dump_buffer(); - Exit(-1); -} - - -llgettoken(token) -LLtoken *token; -{ - llscan(token); - token->llstate = NORMAL; - IFDEBUG(L) - printf("llgettoken(): "); - prt_token(token); - ENDDEBUG -} - - -/****************************************************************************** - - Attribute support routines - -******************************************************************************/ -/* -** attribute stack -** -** AttrStack = stack of record -** values : array of values; -** ptr : index; -** end; -** -*/ - -LLattrib llattributes[LLMAXATTR]; -int llattrtop = 0; - -struct llattr llattrdesc[LLMAXDESC]; - -int lldescindex = 1; - - -llsetattr(n) -{ - register struct llattr *ptr; - - IFDEBUG(L) - printf("llsetattr(%d) enter\n",n); - ENDDEBUG - if(lldescindex >= LLMAXDESC) { - fprintf(stdout, "llattribute stack overflow: desc\n"); - fprintf(stdout, - "lldescindex=0x%x, llattrtop=0x%x\n",lldescindex, llattrtop); - Exit(-1); - } - ptr = &llattrdesc[lldescindex]; - ptr->llabase = &llattributes[llattrtop]; - ptr->lloldtop = ++llattrtop; - ptr->llaindex = 1; - ptr->llacnt = n+1; /* the lhs ALWAYS uses an attr; it remains on the - stack when the production is recognized */ - lldescindex++; -} - -llpushattr(attr) -LLattrib attr; -{ - struct llattr *a; - - IFDEBUG(L) - printf("llpushattr() enter\n"); - ENDDEBUG - if(llattrtop + 1 > LLMAXATTR) { - fprintf(stderr, "ATTRIBUTE STACK OVERFLOW!\n"); - Exit(-1); - } - a = &llattrdesc[lldescindex-1]; - llattributes[llattrtop++] = attr; - a->llaindex++; /* inc count of attrs on the stack for this prod */ -} - -llfinprod() -{ - IFDEBUG(L) - printf("llfinprod() enter\n"); - ENDDEBUG - lldescindex--; - llattrtop = llattrdesc[lldescindex].lloldtop; - llattrdesc[lldescindex-1].llaindex++; /* lhs-of-prod.attr stays on - the stack; it is now one of the rhs attrs of the now-top production - on the stack */ -} - -#ifndef LINT -#ifdef DEBUG -dump_parse_stack() -{ - int ind; - - printf("PARSE STACK:\n"); - for(ind=llstackptr; ind>=0; ind--) { - printf("%d\t%d\t%s\n", - ind, llparsestack[ind], - llparsestack[ind]<0? "Action symbol" : llstrings[llparsestack[ind]]); - } -} - -#endif /* DEBUG */ -#endif /* LINT */ - -prt_token(t) -LLtoken *t; -{ - fprintf(stdout, "t at 0x%x\n", t); - fprintf(stdout, "t->llterm=0x%x\n", t->llterm); (void) fflush(stdout); - fprintf(stdout, "TOK: %s\n", llstrings[t->llterm]); - (void) fflush(stdout); -#ifdef LINT - /* to make lint shut up */ - fprintf(stdout, "", llnterms, llnsyms, llnprods, llinfinite); -#endif /* LINT */ -} diff --git a/sys/netiso/xebec/llparse.h b/sys/netiso/xebec/llparse.h deleted file mode 100644 index 43ad4418299..00000000000 --- a/sys/netiso/xebec/llparse.h +++ /dev/null @@ -1,145 +0,0 @@ -/* $OpenBSD: llparse.h,v 1.2 1996/03/04 10:37:05 mickey Exp $ */ -/* $NetBSD: llparse.h,v 1.4 1994/06/29 06:41:04 cgd Exp $ */ - - /************************************************************ - attributes stack garbage - ************************************************************/ - -#define LLMAXATTR 512 -#define LLMAXDESC 256 -#define LLATTR /* build an attribute stack */ - - /* - ** attribute stack - ** - ** AttrStack = stack of record - ** values : array of values; - ** ptr : index; - ** end; - ** - */ - - typedef union llattrib LLattrib; - - extern LLattrib llattributes[LLMAXATTR]; - extern int llattrtop; - - extern struct llattr { - LLattrib *llabase; /* ptr into the attr stack (llattributes) */ - int llaindex;/* # attrs on the stack so far for this prod */ - int llacnt;/* total # ever to go on for this prod */ - - int lloldtop;/* when popping this prod, restore stack to here ; - one attr will remain on the stack (for the lhs) */ - } llattrdesc[LLMAXDESC]; - - extern int lldescindex; - - /************************************************************ - attributes stack garbage - ************************************************************/ - - extern struct lltoken { - short llterm; /* token number */ - short llstate; /* inserted deleted normal */ - LLattrib llattrib; - } lltoken; - typedef struct lltoken LLtoken; - -/************************************************************ - constants used in llparse.c -************************************************************/ - -#define STACKSIZE 500 -#define MAXCORR 16 - -#define NORMAL 0 -#define DELETE 1 -#define INSERT 2 - -/************************************************************ - datatypes used to communicate with the parser -************************************************************/ - -struct llinsert { - short llinscost; - short llinslength; - short llinsert[MAXCORR]; -}; -typedef struct llinsert LLinsert; - -extern short llparsestack[]; -extern short llstackptr; -extern short llinfinite; - -/************************************************************ - variables used to pass information - specific to each grammer -************************************************************/ - -extern short llnterms; -extern short llnsyms; -extern short llnprods; - -extern char *llefile; - -extern struct llparsetable { - short llterm; - short llprod; -} llparsetable[]; - -extern short llparseindex[]; - -extern short llepsilon[]; - -extern short llproductions[]; - -extern struct llprodindex { - short llprodstart; - short llprodlength; - short llprodtlen; -} llprodindex[]; - -extern struct llcosts { - short llinsert; - short lldelete; -} llcosts[]; - -extern struct llstable { - short llsstart; - short llslength; -} llstable[]; - -extern short llsspace[]; - -extern struct lletable { - short llecost; - short llelength; - short llestart; -} lletable[]; - -extern long lleindex[]; - -extern short llespace[]; - -extern char *llstrings[]; - -/************************************************************ - routines defined in llparse.c -************************************************************/ - -extern llparse(); -extern llcopye(); -extern llcopys(); -extern llcorrector(); -extern llepsilonok(); -extern llexpand(); -extern short llfindaction(); -extern llgetprefix(); -extern llgettoken(); -extern llinsert(); -extern llinsertsym(); -extern llinserttokens(); -extern llparsererror(); -extern llpushprod(); -extern llreadetab(); diff --git a/sys/netiso/xebec/llscan.c b/sys/netiso/xebec/llscan.c deleted file mode 100644 index c55c1b51e37..00000000000 --- a/sys/netiso/xebec/llscan.c +++ /dev/null @@ -1,431 +0,0 @@ -/* $OpenBSD: llscan.c,v 1.3 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: llscan.c,v 1.5 1994/06/29 06:41:05 cgd Exp $ */ - -/* - * ************************* NOTICE ******************************* - * This code is in the public domain. It cannot be copyrighted. - * This scanner was originally written by Keith Thompson for the - * University of Wisconsin Crystal project. - * It was subsequently modified significantly by Nancy Hall at the - * University of Wisconsin for the ARGO project. - * **************************************************************** - */ -#include "xebec.h" -#include "llparse.h" - -#include "main.h" -#include <stdio.h> -#include "procs.h" -#include "debug.h" - -#define EOFILE 0x01 -#define UNUSED 0x02 -#define IGNORE 0x04 -#define OPCHAR 0x8 -#define DIGITS 0x10 -#define LETTER 0x20 - -int chtype[128] = { -/* null, soh ^a, stx ^b etx ^c eot ^d enq ^e ack ^f bel ^g */ - EOFILE, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, -/* bs ^h ht ^i lf ^j vt ^k ff ^l cr ^m so ^n si ^o */ - UNUSED, IGNORE, IGNORE, UNUSED, IGNORE, IGNORE, UNUSED, UNUSED, -/* dle ^p dc1 ^q dc2 ^r dc3 ^s dc4 ^t nak ^u syn ^v etb ^w */ - UNUSED, UNUSED, UNUSED, UNUSED, EOFILE, UNUSED, UNUSED, UNUSED, -/* can ^x em ^y sub ^z esc ^] fs ^\ gs ^} rs ^` us ^/ */ - UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, - -/* ! " # $ % & ' */ - IGNORE, UNUSED, OPCHAR, UNUSED, OPCHAR, UNUSED, OPCHAR, OPCHAR, -/* ( ) * + , - . / */ - OPCHAR, OPCHAR, OPCHAR, OPCHAR, OPCHAR, OPCHAR, OPCHAR, OPCHAR, -/* 0 1 2 3 4 5 6 7 */ - DIGITS, DIGITS, DIGITS, DIGITS, DIGITS, DIGITS, DIGITS, DIGITS, -/* 8 9 : ; < = > ? */ - DIGITS, DIGITS, OPCHAR, OPCHAR, OPCHAR, OPCHAR, OPCHAR, OPCHAR, - -/* @ A B C D E F G */ - UNUSED, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, -/* H I J K L M N O */ - LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, -/* P Q R S T U V W */ - LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, -/* X Y Z [ \ ] ^ _ */ - LETTER, LETTER, LETTER, OPCHAR, UNUSED, OPCHAR, OPCHAR, LETTER, - -/* ` a b c d e f g */ - UNUSED, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, -/* h i j k l m n o */ - LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, -/* p q r s t u v w */ - LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, -/* x y z { | } ~ del */ - LETTER, LETTER, LETTER, OPCHAR, UNUSED, OPCHAR, UNUSED, UNUSED -}; - - -extern FILE *astringfile; -static char *buffptr; -static char buffer[2][LINELEN]; -static int currentbuf = 1; - -#define addbuf(x) *buffptr++ = x - -static int ch = ' '; - -skip() -{ - while((chtype[ch] == IGNORE) ) { - ch = getch(); - } -} - -llaccept(t) -LLtoken *t; -{ - switch(t->llstate) { - case NORMAL: - break; - case INSERT: - fprintf(stderr,"Insert %s\n", llstrings[t->llterm]); - break; - case DELETE: - fprintf(stderr,"Delete %s\n", llstrings[t->llterm]); - break; - } -} - -#define TVAL (t->llattrib) - - -dump_buffer() -{ - register int i; - for(i=0; i<20; i++) - (void) fputc(buffer[currentbuf][i], stderr); - (void) fputc('\n', stderr); - (void) fflush(stderr); -} - -int iskey(c, buf) -char *c; -char **buf; -{ - register int i; - static struct { char *key_word; int term_type; } keys[] = { - { "SAME", T_SAME }, - { "DEFAULT", T_DEFAULT }, - { "NULLACTION", T_NULLACTION }, - { "STRUCT", T_STRUCT }, - { "SYNONYM", T_SYNONYM }, - { "TRANSITIONS", T_TRANSITIONS }, - { "STATES", T_STATES }, - { "EVENTS", T_EVENTS }, - { "PCB", T_PCB }, - { "INCLUDE", T_INCLUDE }, - { "PROTOCOL", T_PROTOCOL }, - { 0, 0}, - }; - - for (i = 0; keys[i].key_word ; i++) { - if( !strcmp(c, (*buf = keys[i].key_word) ) ) { - return ( keys[i].term_type ); - } - } - *buf = (char *)0; - return(0); -} - -getstr(o,c) - /* c is the string delimiter - * allow the delimiter to be escaped - * the messy part: translate $ID to - * e->ev_union.ID - * where ID is an event with a non-zero obj_struc - * need we check for the field??? - */ -char o,c; -{ - register int nested = 1; - register int allow_nesting = (o==c)?-1:1; - - IFDEBUG(S) - fprintf(stdout,"getstr: ch=%c, delimiters %c %c\n", - ch,o, c); - fprintf(stdout,"getstr: buffptr 0x%x, currentbuf 0x%x\n", - buffptr, currentbuf); - ENDDEBUG - - if( ch == c ) nested--; - while(nested) { - if(ch == '\0') { - fprintf(stderr, - "Eof inside of a string, delims= %c,%c, nesting %d",c,o, nested); - Exit(-1); - /* notreached */ - } else if(ch == '$') { - /* might be an attribute */ - IFDEBUG(S) - fprintf(stdout,"getstr: atttribute?\n"); - ENDDEBUG - - /* assume it's an event */ - /* addbuf is a macro so this isn't as bad as - * it looks - * add "e->ev_union." - */ - if( (ch = getch()) == '$' ) { - addbuf('e'); addbuf('-'); addbuf('>'); - addbuf('e'); addbuf('v'); addbuf('_'); - addbuf('u'); addbuf('n'); addbuf('i'); - addbuf('o'); addbuf('n'); - addbuf('.'); - AddCurrentEventName(& buffptr); - } else { - char *obufp = buffptr; - - do { - addbuf(ch); - ch = getch(); - } while(chtype[ch] & LETTER); - addbuf('\0'); - if( !strncmp(obufp, synonyms[PCB_SYN], - strlen(synonyms[PCB_SYN]) )) { - buffptr = obufp; - addbuf('p'); - } else if( !strncmp(obufp, synonyms[EVENT_SYN], - strlen(synonyms[EVENT_SYN]))) { - buffptr = obufp; - addbuf('e'); - } else { - fprintf(stderr, "Unknown synonym %s\n", obufp); - Exit(-1); - } - if(ch == '.') { - addbuf('-'); addbuf('>'); - } else { - /* needs to be checked for nesting */ - goto check; - } - } - /* end of attribute handling */ - goto skip; - } else if(ch == '\\') { - /* possible escape - this is kludgy beyond belief: - * \ is used to escape open and closing delimiters - * and '$' - * otherwise it's passed through to be compiled by C - */ - ch = getch(); - if( (ch != o ) && (ch != c) && (ch != '$') ) { - /* may need to handle case where \ is last char in file... */ - /* don't treat is as escape; not open or close so - * don't have to worry about nesting either - */ - addbuf('\\'); - } - } - addbuf(ch); - skip: - ch = getch(); - check: - if( ch == o ) nested += allow_nesting; - else if( ch == c ) nested--; - if ( (buffptr - buffer[currentbuf]) > LINELEN) { - fprintf(stderr, - "%s too long.\n", (o=='{')?"Action":"Predicate"); /*}*/ - fprintf(stderr, - "buffptr, currentbuf 0x%x, 0x%x\n",buffptr,currentbuf ); - Exit(-1); - } - IFDEBUG(S) - fprintf(stdout,"loop in getstr: ch 0x%x,%c o=%c,c=%c nested=%d\n", - ch,ch,o,c,nested); - ENDDEBUG - } - addbuf(ch); - addbuf('\0'); - - IFDEBUG(S) - fprintf(stdout,"exit getstr: got %s\n", buffer[currentbuf]); - fprintf(stdout,"exit getstr: buffptr 0x%x, currentbuf 0x%x\n", - buffptr, currentbuf); - ENDDEBUG -} - -getch() -{ - char c; - extern FILE *infile; - extern int lineno; - - c = fgetc(infile) ; - if (c == '\n') lineno++; - if ((int)c == EOF) c = (char)0; - if (feof(infile)) c = (char) 0; - IFDEBUG(e) - fprintf(stdout, "getch: 0x%x\n", c); - (void) fputc( c, stdout); - fflush(stdout); - ENDDEBUG - - return c; -} - -llscan(t) -LLtoken *t; -{ - char c; - - t->llstate = NORMAL; - - ++currentbuf; - currentbuf&=1; -again: - buffptr = &buffer[currentbuf][0]; - - skip(); - - switch(chtype[ch]) { - - case EOFILE: - t->llterm = T_ENDMARKER; - break; - - case UNUSED: - fprintf(stderr, "Illegal character in input - 0x%x ignored.", ch); - ch = getch(); - goto again; - - case OPCHAR: - - switch(ch) { - - case '/': - /* possible comment : elide ; kludge */ - IFDEBUG(S) - fprintf(stdout, "Comment ch=%c\n", ch); - ENDDEBUG - c = getch(); - if (c != '*') { - fprintf(stderr,"Syntax error : character(0x%x) ignored", ch); - ch = c; - goto again; - } else { - register int state = 2, whatchar=0; - static int dfa[3][3] = { - /* done seen-star middle */ - /* star */ { 0, 1, 1 }, - /* / */ { 0, 0, 2 }, - /* other */ { 0, 2, 2 } - }; - - while( state ) { - if( (c = getch()) == (char)0) - break; - whatchar = (c=='*')?0:(c=='/'?1:2); - IFDEBUG(S) - fprintf(stdout, - "comment: whatchar = %d, c = 0x%x,%c, oldstate=%d", - whatchar, c,c, state); - ENDDEBUG - state = dfa[whatchar][state]; - IFDEBUG(S) - fprintf(stdout, ", newstate=%d\n", state); - ENDDEBUG - } - if(state) { - fprintf(stderr, - "Syntax error: end of file inside a comment"); - Exit(-1); - } else ch = getch(); - } - IFDEBUG(S) - fprintf(stdout, "end of comment at 0x%x,%c\n",ch,ch); - ENDDEBUG - goto again; - - - case '*': - t->llterm = T_STAR; - break; - - case ',': - t->llterm = T_COMMA; - break; - - case ';': - t->llterm = T_SEMI; - break; - - case '<': - t->llterm = T_LANGLE; - break; - - case '=': - t->llterm = T_EQUAL; - break; - - case '[': - t->llterm = T_LBRACK; - break; - - case ']': - t->llterm = T_RBRACK; - break; - -#ifdef T_FSTRING - case '"': - t->llterm = T_FSTRING; - addbuf(ch); - ch = getch(); - getstr('"', '"'); - TVAL.FSTRING.address = stash(buffer[currentbuf]); - break; -#endif /* T_FSTRING */ - - case '(': - t->llterm = T_PREDICATE; - getstr(ch, ')' ); - TVAL.PREDICATE.address = buffer[currentbuf]; - break; - - case '{': - t->llterm = T_ACTION; - getstr(ch, '}'); - TVAL.ACTION.address = buffer[currentbuf]; - break; - - default: - fprintf(stderr,"Syntax error : character(0x%x) ignored", ch); - ch = getch(); - goto again; - - } - ch = getch(); - break; - - case LETTER: - do { - addbuf(ch); - ch = getch(); - } while(chtype[ch] & (LETTER | DIGITS)); - - addbuf('\0'); - - t->llterm = iskey(buffer[currentbuf], &TVAL.ID.address); - if(!t->llterm) { - t->llterm = T_ID; - TVAL.ID.address = buffer[currentbuf]; - } - IFDEBUG(S) - fprintf(stdout, "llscan: id or keyword 0x%x, %s\n", - TVAL.ID.address, TVAL.ID.address); - ENDDEBUG - break; - - default: - fprintf(stderr, "Snark in llscan: chtype=0x%x, ch=0x%x\n", - chtype[ch], ch); - } -} diff --git a/sys/netiso/xebec/main.c b/sys/netiso/xebec/main.c deleted file mode 100644 index f95800ba5d1..00000000000 --- a/sys/netiso/xebec/main.c +++ /dev/null @@ -1,411 +0,0 @@ -/* $OpenBSD: main.c,v 1.4 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: main.c,v 1.5 1994/06/29 06:41:07 cgd Exp $ */ - -/* - * TODO: - * rewrite the command line stuff altogether - it's kludged beyond - * belief (as is the rest of the code...) - * - * DISCLAIMER DISCLAIMER DISCLAIMER - * This code is such a kludge that I don't want to put my name on it. - * It was a ridiculously fast hack and needs rewriting. - * However it does work... - */ - -#include <stdio.h> -#include <string.h> -#include "malloc.h" -#include "debug.h" -#include "main.h" - -int debug[128]; - -int lineno = 1; - -FILE *statefile, *actfile, *eventfile_h, *statevalfile; -FILE *infile, *astringfile; -char *Transfilename; -char *astringfile_name = DEBUGFILE; -char *actfile_name = ACTFILE; -char *statefile_name = STATEFILE; -char *statevalfile_name = STATEVALFILE; -char *eventfile_h_name = EVENTFILE_H; -int print_trans = 0; -int print_protoerrs = 0; -int pgoption = 0; -char kerneldirname[50] = "\0"; - -char protocol[50]; - -char *synonyms[] = { - "EVENT", - "PCB", - 0 -}; - -usage(a) -char *a; -{ - fprintf(stderr, - "usage: %s <transition file> {-D<debug options>} <other options>\n", - a); - fprintf(stderr, "\t<other options> is any combination of:\n"); - fprintf(stderr, "\t\t-A<action file name>\n"); - fprintf(stderr, "\t\t-E<event file name>\n"); - fprintf(stderr, "\t\t-S<state file name>\n"); - fprintf(stderr, "\t\t-I<initial values file name>\n"); - fprintf(stderr, "\t\t-X<debugging file name>\n"); - fprintf(stderr, "\t\t-K<directory name>\n"); - fprintf(stderr, - "\tThese names do NOT include the suffices (.c, .h)\n"); - fprintf(stderr, - "\t\t-D<options> to turn on debug options for xebec itself\n"); - fprintf(stderr, "\t-<nn> for levels of debugging output\n"); - fprintf(stderr, "\t\t<nn> ranges from 1 to 3, 1 is default(everything)\n"); - fprintf(stderr, "\t\t-T to print transitions\n"); - fprintf(stderr, "\t\t-e to print list of combinations of\n"); - fprintf(stderr, "\t\t\t [event,old_state] that produce protocol errors\n"); - fprintf(stderr, "\t\t-g include profiling code in driver\n"); - Exit(-1); -} - -openfiles(proto) -register char *proto; -{ - register char *junk; - register int lenp = strlen(proto); - - IFDEBUG(b) - fprintf(OUT, "openfiles %s\n",proto); - ENDDEBUG - -#define HEADER Header -#define SOURCE Source -#define DOIT(X)\ - /* GAG */\ - junk = Malloc( 2 + lenp + strlen(X/**/_name) );\ - (void) sprintf(junk, "%s_", proto);\ - X/**/_name = strcat(junk, X/**/_name);\ - X = fopen(X/**/_name, "w");\ - if((X)==(FILE *)0)\ - { fprintf(stderr,"Open failed: %s\n", "X"); Exit(-1); }\ - fprintf(X, "/* %cHeader%c */\n",'$', '$' );\ - fprintf(X, "/* %cSource%c */\n",'$', '$' ); - - DOIT(eventfile_h); - - IFDEBUG(X) -#ifdef DEBUG - DOIT(astringfile); -#endif /* DEBUG */ - fprintf(astringfile, - "#ifndef _NFILE\n#include <stdio.h>\n#endif _NFILE\n" ); - ENDDEBUG - - DOIT(statevalfile); - DOIT(statefile); - DOIT(actfile); - fprintf(actfile, - "#ifndef lint\nstatic char *rcsid = \"$Header/**/$\";\n#endif lint\n"); - - if(pgoption) - putdriver(actfile, 15); - else - putdriver(actfile, 14); - - FakeFilename(actfile, Transfilename, lineno); - putdriver(actfile, 1); - FakeFilename(actfile, Transfilename, lineno); - putdriver(actfile, 12); - fprintf(actfile, "#include \"%s%s\"\n", kerneldirname, statevalfile_name); - FakeFilename(actfile, Transfilename, lineno); - putdriver(actfile, 2); - - initsets(eventfile_h, statefile); -} - -includecode(file, f) -FILE *file; -register char *f; -{ - register int count=1; - static char o='{'; - static char c='}'; - register char *g; - - IFDEBUG(a) - fprintf(stdout, "including: %s, f=0x%x", f,f); - ENDDEBUG - g = ++f; - while(count>0) { - if(*g == o) count++; - if(*g == c) count--; - g++; - } - *(--g) = '\0'; - IFDEBUG(a) - fprintf(stdout, "derived: %s", f); - ENDDEBUG - fprintf(file, "%s", f); - FakeFilename(file, Transfilename, lineno); -} - -putincludes() -{ - FakeFilename(actfile, Transfilename, lineno); - fprintf(actfile, "\n#include \"%s%s\"\n", kerneldirname, eventfile_h_name); - IFDEBUG(X) - if( !debug['K'] ) - fprintf(actfile, "\n#include \"%s\"\n", astringfile_name); - /* not in kernel mode */ - ENDDEBUG - FakeFilename(actfile, Transfilename, lineno); -} - -main(argc, argv) -int argc; -char *argv[]; -{ - register int i = 2; - extern char *strcpy(); - int start, finish; - extern int FirstEventAttribute; - extern int Nevents, Nstates; - - start = time(0); - if(argc < 2) { - usage(argv[0]); - } - IFDEBUG(a) - fprintf(stdout, "infile = %s\n",argv[1]); - ENDDEBUG - Transfilename = argv[1]; - infile = fopen(argv[1], "r"); - - if(argc > 2) while(i < argc) { - register int j=0; - char c; - char *name; - - if(argv[i][j] == '-') j++; - switch(c = argv[i][j]) { - - /* GROT */ - case 'A': - name = &argv[i][++j]; - actfile_name = Malloc( strlen(name)+4); - actfile_name = (char *)strcpy(actfile_name,name); -#ifdef LINT - name = -#endif /* LINT */ - strcat(actfile_name, ".c"); - fprintf(stdout, "debugging file is %s\n",actfile_name); - break; - case 'K': - debug[c]=1; - fprintf(OUT, "option %c file %s\n",c, &argv[i][j+1]); - (void) strcpy(kerneldirname,&argv[i][++j]); - break; - case 'X': - debug[c]=1; - name = &argv[i][++j]; - astringfile_name = Malloc( strlen(name)+4); - astringfile_name = (char *)strcpy(astringfile_name,name); -#ifdef LINT - name = -#endif /* LINT */ - strcat(astringfile_name, ".c"); - fprintf(OUT, "option %c, astringfile name %s\n",c, name); - break; - case 'E': - name = &argv[i][++j]; - eventfile_h_name = Malloc( strlen(name)+4); - eventfile_h_name = (char *)strcpy(eventfile_h_name,name); -#ifdef LINT - name = -#endif /* LINT */ - strcat(eventfile_h_name, ".h"); - fprintf(stdout, "event files is %s\n",eventfile_h_name); - break; - case 'I': - name = &argv[i][++j]; - statevalfile_name = Malloc( strlen(name)+4 ); - statevalfile_name = (char *)strcpy(statevalfile_name,name); -#ifdef LINT - name = -#endif /* LINT */ - strcat(statevalfile_name, ".init"); - fprintf(stdout, "state table initial values file is %s\n",statevalfile_name); - break; - case 'S': - name = &argv[i][++j]; - statefile_name = Malloc( strlen(name)+4); - statefile_name = (char *)strcpy(statefile_name,name); -#ifdef LINT - name = -#endif /* LINT */ - strcat(statefile_name, ".h"); - fprintf(stdout, "state file is %s\n",statefile_name); - break; - /* END GROT */ - case '1': - case '2': - case '3': - debug['X']= (int)argv[i][j] - (int) '0'; - fprintf(OUT, "value of debug['X'] is 0x%x,%d\n", debug['X'], - debug['X']); - break; - case 'D': - while( c = argv[i][++j] ) { - if(c == 'X') { - fprintf(OUT, "debugging on"); - if(debug['X']) fprintf(OUT, - " - overrides any -%d flags used\n", debug['X']); - } - debug[c]=1; - fprintf(OUT, "debug %c\n",c); - } - break; - case 'g': - pgoption = 1; - fprintf(stdout, "Profiling\n"); - break; - case 'e': - print_protoerrs = 1; - fprintf(stdout, "Protocol error table:\n"); - break; - - case 'T': - print_trans = 1; - fprintf(stdout, "Transitions:\n"); - break; - default: - usage(argv[0]); - break; - } - i++; - } - if(kerneldirname[0]) { - char *c; -#ifdef notdef - if(debug['X']) { - fprintf(OUT, "Option K overrides option X\n"); - debug['X'] = 0; - } -#endif /* notdef */ - if(strlen(kerneldirname)<1) { - fprintf(OUT, "K option: dir name too short!\n"); - exit(-1); - } - /* add ../name/ */ - c = (char *) Malloc(strlen(kerneldirname)+6) ; - if(c <= (char *)0) { - fprintf(OUT, "Cannot allocate %d bytes for kerneldirname\n", - strlen(kerneldirname + 6) ); - fprintf(OUT, "kerneldirname is %s\n", kerneldirname ); - exit(-1); - } - *c = '.'; - *(c+1) = '.'; - *(c+2) = '/'; - (void) strcat(c, kerneldirname); - (void) strcat(c, "/\0"); - strcpy(kerneldirname, c); - } - - init_alloc(); - - (void) llparse(); - - /* {{ */ - if( !FirstEventAttribute ) - fprintf(eventfile_h, "\t}ev_union;\n"); - fprintf(eventfile_h, "};/* end struct event */\n"); - fprintf(eventfile_h, "\n#define %s_NEVENTS 0x%x\n", protocol, Nevents); - fprintf(eventfile_h, - "\n#define ATTR(X)ev_union.%s/**/X/**/\n",EV_PREFIX); - (void) fclose(eventfile_h); - - /* {{ */ fprintf(actfile, "\t}\nreturn 0;\n}\n"); /* end switch; end action() */ - dump_predtable(actfile); - - putdriver(actfile, 3); - IFDEBUG(X) - if(!debug['K']) - putdriver(actfile, 4); - ENDDEBUG - putdriver(actfile, 6); - IFDEBUG(X) - /* - putdriver(actfile, 10); - */ - if(debug['K']) { - putdriver(actfile, 11); - } else { - switch(debug['X']) { - case 1: - default: - putdriver(actfile, 7); - break; - case 2: - putdriver(actfile, 13); - break; - case 3: - break; - } - } - ENDDEBUG - putdriver(actfile, 8); - (void) fclose(actfile); - IFDEBUG(X) - /* { */ - fprintf(astringfile, "};\n"); - (void) fclose(astringfile); - ENDDEBUG - - (void) fclose(statevalfile); - - fprintf(statefile, "\n#define %s_NSTATES 0x%x\n", protocol, Nstates); - (void) fclose(statefile); - - finish = time(0); - fprintf(stdout, "%d seconds\n", finish - start); - if( print_protoerrs ) - printprotoerrs(); -} - -int transno = 0; - -Exit(n) -{ - fprintf(stderr, "Error at line %d\n",lineno); - if(transno) fprintf(stderr, "Transition number %d\n",transno); - (void) fflush(stdout); - (void) fflush(statefile); - (void) fflush(eventfile_h); - (void) fflush(actfile); - exit(n); -} - -syntax() -{ - static char *synt[] = { - "*PROTOCOL <string>\n", - "*PCB <string> <optional: SYNONYM synonymstring>\n", - "<optional: *INCLUDE {\n<C source>\n} >\n", - "*STATES <string>\n", - "*EVENTS <string>\n", - "*TRANSITIONS <string>\n", - }; -} - -FakeFilename(outfile, name, l) -FILE *outfile; -char *name; -int l; -{ - /* - doesn't work - fprintf(outfile, "\n\n\n\n# line %d \"%s\"\n", l, name); - */ -} diff --git a/sys/netiso/xebec/main.h b/sys/netiso/xebec/main.h deleted file mode 100644 index 0deabb0b4b8..00000000000 --- a/sys/netiso/xebec/main.h +++ /dev/null @@ -1,32 +0,0 @@ -/* $OpenBSD: main.h,v 1.2 1996/03/04 10:37:10 mickey Exp $ */ -/* $NetBSD: main.h,v 1.4 1994/06/29 06:41:08 cgd Exp $ */ - -#define TRUE 1 -#define FALSE 0 -#define LINELEN 2350 - /* approx limit on token size for C compiler - * which matters for the purpose of debugging (astring.c...) - */ - -#define MSIZE 4000 -#define DEBUGFILE "astring.c" -#define ACTFILE "driver.c" -#define EVENTFILE_H "events.h" -#define STATEFILE "states.h" -#define STATEVALFILE "states.init" - -#define EV_PREFIX "EV_" -#define ST_PREFIX "ST_" - -#define PCBNAME "_PCB_" - -extern char kerneldirname[]; -extern char protocol[]; -extern char *synonyms[]; -#define EVENT_SYN 0 -#define PCB_SYN 1 - -extern int transno; -extern int print_trans; -extern char *stash(); - diff --git a/sys/netiso/xebec/malloc.c b/sys/netiso/xebec/malloc.c deleted file mode 100644 index 25657d67278..00000000000 --- a/sys/netiso/xebec/malloc.c +++ /dev/null @@ -1,135 +0,0 @@ -/* $OpenBSD: malloc.c,v 1.4 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: malloc.c,v 1.4 1994/06/29 06:41:10 cgd Exp $ */ - -/* - * This code is such a kludge that I don't want to put my name on it. - * It was a ridiculously fast hack and needs rewriting. - * However it does work... - */ - -/* - * a simple malloc - * it might be brain-damaged but for the purposes of xebec - * it's a whole lot faster than the c library malloc - */ - -#include <stdio.h> -#include "malloc.h" -#include "debug.h" -#define CHUNKSIZE 4096*2 - -static char *hiwat, *highend; -int bytesmalloced=0; -int byteswasted = 0; - - -init_alloc() -{ -#ifdef LINT - hiwat = 0; - highend = 0; -#else /* LINT */ - extern char *sbrk(); - - hiwat = (char *) sbrk(0); - hiwat = (char *)((unsigned)(hiwat + 3) & ~0x3); - highend = hiwat; -#endif /* LINT */ -} - -HIWAT(s) -char *s; -{ - IFDEBUG(M) - fprintf(stdout, "HIWAT 0x%x %s\n", hiwat,s); - fflush(stdout); - ENDDEBUG -} - -char *Malloc(x) -int x; -{ - char *c; - extern char *sbrk(); - static int firsttime=1; - int total = x; - int first_iter = 1; - char *returnvalue; - - IFDEBUG(N) - fprintf(stdout, "Malloc 0x%x, %d, bytesmalloced %d\n", - total,total, bytesmalloced); - fflush(stdout); - ENDDEBUG - IFDEBUG(M) - fprintf(stdout, "Malloc 0x%x, %d, hiwat 0x%x\n", - total,total, hiwat); - fflush(stdout); - ENDDEBUG - if(firsttime) { - hiwat = sbrk(0); - if(((unsigned)(hiwat) & 0x3)) { - bytesmalloced = 4 - (int) ((unsigned)(hiwat) & 0x3); - hiwat = sbrk( bytesmalloced ); - } else - bytesmalloced = 0; - firsttime = 0; - highend = hiwat; - } - while( total ) { - x = MIN(CHUNKSIZE, total); - if(total != x) { - IFDEBUG(N) - fprintf(stdout, "BIG Malloc tot %d, x %d, left %d net %d\n", - total,x, total-x, bytesmalloced); - fflush(stdout); - ENDDEBUG - } - if ( (hiwat + x) > highend) { - c = sbrk(CHUNKSIZE); - IFDEBUG(M) - fprintf(stdout, "hiwat 0x%x, x 0x%x, highend 0x%x, c 0x%x\n", - hiwat, x, highend, c); - fflush(stdout); - ENDDEBUG - if( c == (char *) -1 ) { - fprintf(stderr, "Ran out of memory!\n"); - Exit(-1); - } - if(first_iter) { - returnvalue = c; - first_iter = 0; - } - bytesmalloced += CHUNKSIZE; - IFDEBUG(m) - if (highend != c) { - fprintf(OUT, "warning: %d wasted bytes!\n", highend - hiwat); - fprintf(OUT, " chunksize 0x%x, x 0x%x \n", CHUNKSIZE, x); - } - ENDDEBUG - highend = c + CHUNKSIZE; - hiwat = c; - } - c = hiwat; - if(first_iter) { - returnvalue = c; - first_iter = 0; - } - hiwat += x; - total -= x; - } - if((unsigned)hiwat & 0x3) { - byteswasted += (int)((unsigned)(hiwat) & 0x3); - hiwat = (char *)((unsigned)(hiwat + 3) & ~0x3); - } - IFDEBUG(M) - fprintf(stdout, "Malloc = 0x%x, bytesm 0x%x, wasted 0x%x, hiwat 0x%x\n", - returnvalue, bytesmalloced, byteswasted, hiwat); - ENDDEBUG - IFDEBUG(N) - fprintf(stdout, "Malloc returns 0x%x, sbrk(0) 0x%x\n", returnvalue, sbrk(0)); - fflush(stdout); - ENDDEBUG - return(returnvalue); -} - diff --git a/sys/netiso/xebec/malloc.h b/sys/netiso/xebec/malloc.h deleted file mode 100644 index af371abd2c3..00000000000 --- a/sys/netiso/xebec/malloc.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $OpenBSD: malloc.h,v 1.2 1996/03/04 10:37:13 mickey Exp $ */ -/* $NetBSD: malloc.h,v 1.4 1994/06/29 06:41:11 cgd Exp $ */ - -char *Malloc(); diff --git a/sys/netiso/xebec/procs.c b/sys/netiso/xebec/procs.c deleted file mode 100644 index 9ff626759e4..00000000000 --- a/sys/netiso/xebec/procs.c +++ /dev/null @@ -1,438 +0,0 @@ -/* $OpenBSD: procs.c,v 1.4 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: procs.c,v 1.4 1994/06/29 06:41:12 cgd Exp $ */ - -/* - * This code is such a kludge that I don't want to put my name on it. - * It was a ridiculously fast hack and needs rewriting. - * However it does work... - */ - -#include <stdio.h> -#include <string.h> -#include "malloc.h" -#include "main.h" -#include "debug.h" -#include "sets.h" -#include "procs.h" - -struct Predicate { - int p_index; - int p_transno; - char *p_str; - struct Predicate *p_next; -}; - -struct Stateent { - int s_index; - int s_newstate; - int s_action; - struct Stateent *s_next; -}; - -struct Object *SameState = (struct Object *)-1; -int Index = 0; -int Nstates = 0; -int Nevents = 0; -struct Predicate **Predlist; -struct Stateent **Statelist; -extern FILE *astringfile; - -end_events() { - int size, part; - char *addr; - - IFDEBUG(X) - /* finish estring[], start astring[] */ - if(debug['X'] < 2 ) - fprintf(astringfile, "};\n\nchar *%s_astring[] = {\n\"NULLACTION\",\n", - protocol); - ENDDEBUG - /* NOSTRICT */ - Statelist = - (struct Stateent **) Malloc((Nstates+1) * sizeof(struct Statent *)); - /* NOSTRICT */ - Predlist = - (struct Predicate **) - Malloc ( (((Nevents)<<Eventshift)+Nstates)*sizeof(struct Predicate *) ); - - size = (((Nevents)<<Eventshift)+Nstates)*sizeof(struct Predicate *) ; - addr = (char *)Predlist; - IFDEBUG(N) - fprintf(OUT, "Predlist at 0x%x, sbrk 0x%x bzero size %d at addr 0x%x\n", - Predlist, sbrk(0), size, addr); - ENDDEBUG -#define BZSIZE 8192 - while(size) { - part = size>BZSIZE?BZSIZE:size; - IFDEBUG(N) - fprintf(OUT, "bzero addr 0x%x part %d size %d\n",addr, part, size); - ENDDEBUG - bzero(addr, part); - IFDEBUG(N) - fprintf(OUT, "after bzero addr 0x%x part %d size %d\n",addr, part, size); - ENDDEBUG - addr += part; - size -= part; - - } - IFDEBUG(N) - fprintf(OUT, "endevents..done \n"); - ENDDEBUG -} - -int acttable(f,actstring) -char *actstring; -FILE *f; -{ - static Actindex = 0; - extern FILE *astringfile; - extern int pgoption; - - IFDEBUG(a) - fprintf(OUT,"acttable()\n"); - ENDDEBUG - fprintf(f, "case 0x%x: \n", ++Actindex); - - if(pgoption) { - fprintf(f, "asm(\" # dummy statement\");\n"); - fprintf(f, "asm(\"_Xebec_action_%x: \");\n", Actindex ); - fprintf(f, "asm(\".data\");\n"); - fprintf(f, "asm(\".globl _Xebec_action_%x# X profiling\");\n", - Actindex ); - fprintf(f, "asm(\".long 0 # X profiling\");\n"); - fprintf(f, "asm(\".text # X profiling\");\n"); - fprintf(f, "asm(\"cas r0,r15,r0 # X profiling\");\n"); - fprintf(f, "asm(\"bali r15,mcount # X profiling\");\n"); - } - - fprintf(f, "\t\t%s\n\t\t break;\n", actstring); - IFDEBUG(X) - if(debug['X']<2) { - register int len = 0; - fputc('"',astringfile); - while(*actstring) { - if( *actstring == '\n' ) { - fputc('\\', astringfile); - len++; - fputc('n', astringfile); - } else if (*actstring == '\\') { - fputc('\\', astringfile); - len ++; - fputc('\\', astringfile); - } else if (*actstring == '\"') { - fputc('\\', astringfile); - len ++; - fputc('\"', astringfile); - } else fputc(*actstring, astringfile); - actstring++; - len++; - } - fprintf(astringfile,"\",\n"); - if (len > LINELEN) { - fprintf(stderr, "Action too long: %d\n",len); Exit(-1); - } - } - ENDDEBUG - - return(Actindex); -} - -static int Npred=0, Ndefpred=0, Ntrans=0, Ndefevent=0, Nnulla=0; - -statetable(string, oldstate, newstate, action, event) -char *string; -int action; -struct Object *oldstate, *newstate, *event; -{ - register int different; - - IFDEBUG(a) - fprintf(OUT,"statetable(0x%x, 0x%x,0x%x, 0x%x)\n", - string, oldstate, newstate, action); - fprintf(OUT,"statetable(%s, %s,%s, 0x%x)\n", - string, oldstate->obj_name, newstate->obj_name, action); - ENDDEBUG - - if( !action) Nnulla++; - if( newstate->obj_kind == OBJ_SET) { - fprintf(stderr, "Newstate cannot be a set\n"); - Exit(-1); - } - different = (newstate != SameState); - - (void) predtable( oldstate, event, string, - action, (newstate->obj_number) * different ); - IFDEBUG(a) - fprintf(OUT,"EXIT statetable\n"); - ENDDEBUG -} - -stateentry(index, oldstate, newstate, action) -int index, action; -int oldstate, newstate; -{ - extern FILE *statevalfile; - - IFDEBUG(a) - fprintf(OUT,"stateentry(0x%x,0x%x,0x%x,0x%x) Statelist@0x%x, val 0x%x\n", - index, oldstate, newstate,action, &Statelist, Statelist); - ENDDEBUG - - - fprintf(statevalfile, "{0x%x,0x%x},\n", newstate, action); -} - -int predtable(os, oe, str, action, newstate) -struct Object *os, *oe; -char *str; -int action, newstate; -{ - register struct Predicate *p, **q; - register int event, state; - register struct Object *e, *s; - struct Object *firste; - - if (oe == (struct Object *)0 ) { - Ndefevent ++; - fprintf(stderr, "DEFAULT EVENTS aren't implemented; trans ignored\n"); - return; - } - Ntrans++; - IFDEBUG(g) - fprintf(stdout, - "PREDTAB: s %5s; e %5s\n", os->obj_kind==OBJ_SET?"SET":"item", - oe->obj_kind==OBJ_SET?"SET":"item"); - ENDDEBUG - if (os->obj_kind == OBJ_SET) s = os->obj_members; - else s = os; - if (oe->obj_kind == OBJ_SET) firste = oe->obj_members; - else firste = oe; - if(newstate) { - fprintf(statevalfile, "{0x%x,0x%x},\n",newstate, action); - Index++; - } - while (s) { - if( !newstate ) { /* !newstate --> SAME */ - /* i.e., use old obj_number */ - fprintf(statevalfile, "{0x%x,0x%x},\n",s->obj_number, action); - Index++; - } - e = firste; - while (e) { - event = e->obj_number; state = s->obj_number; - IFDEBUG(g) - fprintf(stdout,"pred table event=0x%x, state 0x%x\n", - event, state); - fflush(stdout); - ENDDEBUG - if( !str /* DEFAULT PREDICATE */) { - Ndefpred++; - IFDEBUG(g) - fprintf(stdout, - "DEFAULT pred state 0x%x, event 0x%x, Index 0x%x\n", - state, event, Index); - fflush(stdout); - ENDDEBUG - } else - Npred++; - /* put at END of list */ -#ifndef LINT - IFDEBUG(g) - fprintf(stdout, - "predicate for event 0x%x, state 0x%x is 0x%x, %s\n", - event, state, Index, str); - fflush(stdout); - ENDDEBUG -#endif /* LINT */ - for( ((q = &Predlist[(event<<Eventshift)+state]), - (p = Predlist[(event<<Eventshift)+state])); - p ; p = p->p_next ) { - q = &p->p_next; - } - - p = (struct Predicate *)Malloc(sizeof(struct Predicate)); - p->p_next = (struct Predicate *)0; - p->p_str = str; - p->p_index = Index; - p->p_transno = transno; - *q = p; - - IFDEBUG(g) - fprintf(stdout, - "predtable index 0x%x, transno %d, E 0x%x, S 0x%x\n", - Index, transno, e, s); - ENDDEBUG - - e = e->obj_members; - } - s = s->obj_members; - } - return Index ; -} - -printprotoerrs() -{ - register int e,s; - - fprintf(stderr, "[ Event, State ] without any transitions :\n"); - for(e = 0; e < Nevents; e++) { - fprintf(stderr, "Event 0x%x: states ", e); - for(s = 0; s < Nstates; s++) { - if( Predlist[(e<<Eventshift)+s] == 0 ) - fprintf(stderr, "0x%x ", s); - } - fprintf(stderr, "\n"); - } -} - -#ifndef LINT -dump_predtable(f) -FILE *f; -{ - struct Predicate *p; - register int e,s, hadapred; - int defaultindex; - int defaultItrans; - extern int bytesmalloced; - extern int byteswasted; - -#ifdef notdef - fprintf(stdout, - " Xebec used %8d bytes of storage, wasted %8d bytes\n", - bytesmalloced, byteswasted); -#endif /* notdef */ - fprintf(stdout, - " %8d states\n %8d events\n %8d transitions\n", - Nstates, Nevents, Ntrans); - fprintf(stdout, - " %8d predicates\n %8d default predicates used\n", - Npred, Ndefpred); - fprintf(stdout, - " %8d null actions\n", - Nnulla); - - putdriver(f, 5); - for(e = 0; e < Nevents; e++) { for(s = 0; s < Nstates; s++) { - p = Predlist[(e<<Eventshift)+s]; - hadapred=0; - defaultindex=0; - defaultItrans=0; - if(p) { - IFDEBUG(d) - fflush(f); - ENDDEBUG - while(p) { - if(p->p_str) { - if(!hadapred) - fprintf(f, "case 0x%x:\n\t", (e<<Eventshift) + s); - hadapred = 1; - fprintf(f, "if %s return 0x%x;\n\t else ", - p->p_str, p->p_index); - } else { - if(defaultindex) { - fprintf(stderr, -"\nConflict between transitions %d and %d: duplicate default \n", - p->p_transno, defaultItrans); - Exit(-1); - } - defaultindex = p->p_index; - defaultItrans = p->p_transno; - } - p = p->p_next; - } - if( hadapred) { - fprintf(f, "return 0x%x;\n", defaultindex); - } - IFDEBUG(d) - fflush(f); - ENDDEBUG - } - IFDEBUG(g) - fprintf(stdout, - "loop: e 0x%x s 0x%x hadapred 0x%x dindex 0x%x for trans 0x%x\n", - e, s, hadapred, defaultindex, defaultItrans); - ENDDEBUG - if ( hadapred ) { - /* put a -1 in the array - Predlist is temporary storage */ - Predlist[(e<<Eventshift)+s] = (struct Predicate *)(-1); - } else { - /* put defaultindex in the array */ - /* if defaultindex is zero, then the driver will - * cause an erroraction (same as if no default - * were given and none of the predicates were true; - * also same as if no preds or defaults were given - * for this combo) - */ - Predlist[(e<<Eventshift)+s] = (struct Predicate *)(defaultindex); - } - } } - fprintf(f, "default: return 0;\n} /* end switch */\n"); -#ifdef notdef - fprintf(f, "/*NOTREACHED*/return 0;\n} /* _Xebec_index() */\n"); -#else /* notdef */ - fprintf(f, "} /* _Xebec_index() */\n"); -#endif /* notdef */ - fprintf(f, "static int inx[%d][%d] = { {", Nevents+1,Nstates); - for(s = 0; s< Nstates; s++) fprintf(f, "0,"); /* event 0 */ - fprintf(f, "},\n"); - - for(e = 0; e < Nevents; e++) { - fprintf(f, " {"); - for(s = 0; s < Nstates; s++) { - register struct Predicate *xyz = Predlist[(e<<Eventshift)+s]; - /* this kludge is to avoid a lint msg. concerning - * loss of bits - */ - if (xyz == (struct Predicate *)(-1)) - fprintf(f, "-1,"); - else - fprintf(f, "0x%x,", Predlist[(e<<Eventshift)+s]); - } - fprintf(f, " },\n"); - } - fprintf(f, "};"); -} -#endif /* LINT */ - -char * -stash(buf) -char *buf; -{ - register int len; - register char *c; - - /* grot */ - len = strlen(buf); - c = Malloc(len+1); -#ifdef LINT - c = -#endif /* LINT */ - strcpy(c, buf); - - IFDEBUG(z) - fprintf(stdout,"stash %s at 0x%x\n", c,c); - ENDDEBUG - return(c); -} - -#ifdef notdef -dump_pentry(event,state) -int event,state; -{ - register struct Predicate *p, **q; - - for( - ((q = &Predlist[(event<<Eventshift) +state]), - (p = Predlist[(event<<Eventshift) + state])); - p!= (struct Predicate *)0 ; p = p->p_next ) { -#ifndef LINT - IFDEBUG(a) - fprintf(OUT, - "dump_pentry for event 0x%x, state 0x%x is 0x%x\n", - event, state, p); - ENDDEBUG -#endif /* LINT */ - q = &p->p_next; - } -} -#endif /* notdef */ diff --git a/sys/netiso/xebec/procs.h b/sys/netiso/xebec/procs.h deleted file mode 100644 index 55c168f2f2f..00000000000 --- a/sys/netiso/xebec/procs.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $OpenBSD: procs.h,v 1.2 1996/03/04 10:37:18 mickey Exp $ */ -/* $NetBSD: procs.h,v 1.4 1994/06/29 06:41:13 cgd Exp $ */ - -extern char *stash(); -extern struct Object *SameState; diff --git a/sys/netiso/xebec/putdriver.c b/sys/netiso/xebec/putdriver.c deleted file mode 100644 index f39f480316f..00000000000 --- a/sys/netiso/xebec/putdriver.c +++ /dev/null @@ -1,244 +0,0 @@ -/* $OpenBSD: putdriver.c,v 1.2 1996/03/04 10:37:20 mickey Exp $ */ -/* $NetBSD: putdriver.c,v 1.4 1994/06/29 06:41:15 cgd Exp $ */ - -/* - * This code is such a kludge that I don't want to put my name on it. - * It was a ridiculously fast hack and needs rewriting. - * However it does work... - */ - -/* The original idea was to put all the driver code - * in one place so it would be easy to modify - * but as hacks got thrown in it got worse and worse... - * It's to the point where a user would be better off - * writing his own driver and xebec should JUST produce - * the tables. - */ - -#include <stdio.h> -#include "main.h" -#include "debug.h" - -extern char protocol[]; -char Eventshiftstring[10]; -static char statename[] = {'_', 's', 't', 'a', 't', 'e', 0 }; - -static char *strings[] = { - -#define PART1 { 0,3 } - - "\n#include \"", - kerneldirname, - protocol, - "_states.h\"", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART12 { 10,12 } - "\n\nstatic struct act_ent {\n", - "\tint a_newstate;\n\tint a_action;\n", - "} statetable[] = { {0,0},\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART2 { 20,20 } - "};\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART3 { 30,41 } - "\n", - protocol, - "_driver(p, e)\nregister ", - protocol, - PCBNAME, - " *p;\nregister struct ", - protocol, - "_event *e;\n", - "{\n", - "\tregister int index, error=0;\n", - "\tstruct act_ent *a;\n", - "\tstatic struct act_ent erroraction = {0,-1};\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART4 { 50,54 } - - "\textern int ", - protocol, - "_debug;\n\textern FILE *", - protocol, - "_astringfile;\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART6 { 60, 65 } - "\n\tindex = inx[1 + e->ev_number][p->", - protocol, - statename, - "];\n\tif(index<0) index=_Xebec_index(e, p);\n", - "\tif (index==0) {\n\t\ta = &erroraction;\n", - "\t} else\n\t\ta = &statetable[index];\n\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART7 {70, 77 } - "\tif(", - protocol, - "_debug) fprintf(", - protocol, - "_astringfile, \"%15s <-- %15s [%15s] \\n\\t%s\\n\",\n", - "\t\tsstring[a->a_newstate], sstring[p->", - protocol, - "_state], estring[e->ev_number], astring[a->a_action]);\n\n", - (char *)0, - (char *)0, - -#define PART8 { 80, 84 } - "\tif(a->a_action)\n", - "\t\terror = _Xebec_action( a->a_action, e, p );\n", - "\tif(error==0)\n\tp->", - protocol, - "_state = a->a_newstate;\n\treturn error;\n}\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART9 { 90, 99 } - "\n_XEBEC_PG int _Xebec_action(a,e,p)\nint a;\nstruct ", - protocol, - "_event *e;\n", - protocol, - PCBNAME, - " *p;\n{\n", - "switch(a) {\n", - "case -1: return ", - protocol, - "_protocol_error(e,p);\n", - (char *)0, - -#define PART10 { 101, 105 } - "\tif(", - protocol, - "_debug) fprintf(", - protocol, - "_astringfile, \"index 0x%5x\\n\", index);\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART5 { 110, 121 } - "\n_XEBEC_PG int\n_Xebec_index( e,p )\n", - "\tstruct ", - protocol, - "_event *e;\n\t", - protocol, - PCBNAME, - " *p;\n{\nswitch( (e->ev_number<<", - Eventshiftstring, - ")+(p->", - protocol, - statename, - ") ) {\n", - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - (char *)0, - -#define PART11 {130, 137 } - "\tIFTRACE(D_DRIVER)\n", - "\t", - protocol, - "trace(DRIVERTRACE,", - "\t\ta->a_newstate, p->", - protocol, - "_state, e->ev_number, a->a_action, 0);\n\n", - "\tENDTRACE\n", - (char *)0, - (char *)0, - -#define PART13 {140, 147 } - "\tif(", - protocol, - "_debug) fprintf(", - protocol, - "_astringfile, \"%15s <-- %15s [%15s] \\n\",\n", - "\t\tsstring[a->a_newstate], sstring[p->", - protocol, - "_state], estring[e->ev_number]);\n\n", - (char *)0, - (char *)0, - -#define PART14 { 150,150 } - "#define _XEBEC_PG static\n", - -#define PART15 { 151,151 } - "#define _XEBEC_PG \n", - -}; - -static struct { int start; int finish; } parts[] = { - { 0,0 }, - PART1, - PART2, - PART3, - PART4, - PART5, - PART6, - PART7, - PART8, - PART9, - PART10, - PART11, - PART12, - PART13, - PART14, - PART15, -}; - -putdriver(f, x) -FILE *f; -int x; -{ - register int i; - - for( i = parts[x].start; i<= parts[x].finish; i++) - fprintf(f, "%s", strings[i]); - IFDEBUG(d) - fflush(f); - ENDDEBUG -} diff --git a/sys/netiso/xebec/sets.c b/sys/netiso/xebec/sets.c deleted file mode 100644 index eb19b5ea79d..00000000000 --- a/sys/netiso/xebec/sets.c +++ /dev/null @@ -1,473 +0,0 @@ -/* $OpenBSD: sets.c,v 1.2 1996/03/04 10:37:22 mickey Exp $ */ -/* $NetBSD: sets.c,v 1.4 1994/06/29 06:41:16 cgd Exp $ */ - -/* - * This code is such a kludge that I don't want to put my name on it. - * It was a ridiculously fast hack and needs rewriting. - * However it does work... - */ -#include "main.h" -#include "malloc.h" -#include "sets.h" -#include "debug.h" -#include <stdio.h> - -struct Object *CurrentEvent = (struct Object *)0; -struct Object *Objtree; -struct Object dummy; -/* - * define a set w/ type and name - * return a set number - */ -#undef NULL -#define NULL (struct Object *)0 - -static FILE *Sfile, *Efile; -extern FILE *astringfile; -char *Noname = "Unnamed set\0"; - -initsets(f,s) -FILE *f, *s; -{ - static char errorstring[20]; - extern struct Object *SameState; - Efile = f; - Sfile = s; - - IFDEBUG(X) - fprintf(astringfile, "char *%s_sstring[] = {\n", protocol); - ENDDEBUG - sprintf(errorstring, "%sERROR\0", ST_PREFIX); - defineitem(STATESET, errorstring, (char *)0); /* state 0 */ - SameState = (struct Object *) Malloc( sizeof (struct Object) ); - SameState->obj_kind = OBJ_ITEM; - SameState->obj_type = STATESET; - SameState->obj_name = "SAME"; - SameState->obj_struc = (char *)0; - SameState->obj_number = 0; - SameState->obj_members = (struct Object *)0; - SameState->obj_left = (struct Object *)0; - SameState->obj_right = (struct Object *)0; - SameState->obj_parent = (struct Object *)0; -} - -/* - * get a set based on its type and name - * returns address of an Object, may be set or item - */ - -struct Object *lookup(type, name) -unsigned char type; -char *name; -{ - register struct Object *p = Objtree; - int val = 1 ; - - IFDEBUG(o) - fprintf(stdout,"lookup 0x%x,%s \n", - type, name); - ENDDEBUG - - while( p && val ) { - IFDEBUG(o) - fprintf(OUT, "lookup strcmp 0x%x,%s, 0x%x,%s\n", - name, name, OBJ_NAME(p), OBJ_NAME(p)); - ENDDEBUG - if( p->obj_name == (char *)0 ) { - fprintf(stderr, "Unnamed set in table!\n"); - Exit(-1); - } - val = (int) strcmp(name, OBJ_NAME(p)); - if(val < 0) { - /* left */ - p = p->obj_left; - } else if (val > 0) { - /* right */ - p = p->obj_right; - } - } - if( p && ( p->obj_type != type)) { - fprintf(stdout, "lookup(0x%x,%s) found wrong obj type 0x%x\n", - type,name, p->obj_type); - p = NULL; - } - IFDEBUG(o) - fprintf(stdout,"lookup 0x%x,%s returning 0x%x\n",type, name, p); - ENDDEBUG - return(p); -} - -static int states_done = 0; - -end_states(f) -FILE *f; -{ - register unsigned n = Nstates; - register int i; - extern char Eventshiftstring[]; - - states_done = 1; - - for( i = 0; ;i++) { - if( (n >>= 1) <= 0 ) break; - } - Eventshift = i+1; - IFDEBUG(d) - fprintf(OUT, "Eventshift=%d\n", Eventshift); - ENDDEBUG - sprintf(Eventshiftstring, "%d\0",Eventshift); - fprintf(f, "struct %s_event {\n\tint ev_number;\n", &protocol[0]); - IFDEBUG(X) - /* finish sstring[] & start estring[] */ - fprintf(astringfile, - "};\n\nchar *%s_estring[] = {\n", protocol); - ENDDEBUG -} - -int FirstEventAttribute = 1; - -static -insert(o) -struct Object *o; -{ - struct Object *p = Objtree; - struct Object **q = &Objtree; - int val=1; - - - if (o->obj_name == (char *)0) { - fprintf(stderr, "Internal Error: inserting unnamed object\n"); - Exit(-1); - } - if( o->obj_type == STATESET) { - if( states_done ) { - fprintf(stderr, "No states may be defined after *TRANSITIONS\n"); - Exit(-1); - } - o->obj_number = Nstates++ ; - if(Nstates > MAXSTATES) { - fprintf(stderr, "Too many states\n"); - Exit(-1); - } - fprintf(Sfile, "#define %s 0x%x\n", o->obj_name, o->obj_number); - IFDEBUG(X) - fprintf(astringfile, "\"%s(0x%x)\",\n", o->obj_name, o->obj_number); - ENDDEBUG - } else { - /* EVENTSET */ - if( ! states_done ) { - fprintf(stderr, "states must precede events\n"); - Exit(-1); - } - o->obj_number = Nevents++ ; - if(Nevents > MAXEVENTS) { - fprintf(stderr, "Too many events\n"); - Exit(-1); - } - if(o->obj_struc) { - if( FirstEventAttribute ) { - fprintf(Efile, "\n\tunion{\n"); /*} */ - FirstEventAttribute = 0; - } - fprintf(Efile, - "struct %s %s%s;\n\n", o->obj_struc, EV_PREFIX, o->obj_name); - } - fprintf(Efile, "#define %s 0x%x\n", o->obj_name, o->obj_number); - IFDEBUG(X) - fprintf(astringfile, "\"%s(0x%x)\",\n", o->obj_name, o->obj_number); - ENDDEBUG - } - IFDEBUG(o) - fprintf(OUT, "insert(%s)\n", OBJ_NAME(o) ); - if(o->obj_right != NULL) { - fprintf(OUT, "insert: unclean Object right\n"); - exit(-1); - } - if(o->obj_left != NULL) { - fprintf(OUT, "insert: unclean Object left\n"); - exit(-1); - } - fflush(OUT); - ENDDEBUG - - while( val ) { - if(p == NULL) { - *q = o; - o->obj_parent = (struct Object *)q; - break; - } - if(!(val = strcmp(o->obj_name, p->obj_name)) ) { - /* equal */ - fprintf(stderr, "re-inserting %s\n",o->obj_name); - exit(-1); - } - if(val < 0) { - /* left */ - q = &p->obj_left; - p = p->obj_left; - } else { - /* right */ - q = &p->obj_right; - p = p->obj_right; - } - } - IFDEBUG(a) - dumptree(Objtree,0); - ENDDEBUG -} - -delete(o) -struct Object *o; -{ - register struct Object *p = o->obj_right; - register struct Object *q; - register struct Object *newparent; - register struct Object **np_childlink; - - IFDEBUG(T) - fprintf(stdout, "delete(0x%x)\n", o); - dumptree(Objtree,0); - ENDDEBUG - - /* q <== lowest valued node of the right subtree */ - while( p ) { - q = p; - p = p->obj_left; - } - - if (o->obj_parent == (struct Object *)&Objtree) { - newparent = (struct Object *)&Objtree; - np_childlink = (struct Object **)&Objtree; - } else if(o->obj_parent->obj_left == o) { - newparent = o->obj_parent; - np_childlink = &(o->obj_parent->obj_left); - } else { - newparent = o->obj_parent; - np_childlink = &(o->obj_parent->obj_right); - } - IFDEBUG(T) - fprintf(OUT, "newparent=0x%x\n"); - ENDDEBUG - - if (q) { /* q gets the left, parent gets the right */ - IFDEBUG(T) - fprintf(OUT, "delete: q null\n"); - ENDDEBUG - q->obj_left = p; - if(p) p->obj_parent = q; - p = o->obj_right; - } else { /* parent(instead of q) gets the left ; there is no right */ - IFDEBUG(T) - fprintf(OUT, "delete: q not null\n"); - ENDDEBUG - p = o->obj_left; - } - *np_childlink = p; - if(p) - p->obj_parent = newparent; - - IFDEBUG(T) - fprintf(OUT, "After deleting 0x%x\n",o); - dumptree(Objtree,0); - ENDDEBUG -} - -struct Object * -defineset(type, adr, keep) -unsigned char type; -char *adr; -int keep; -{ - struct Object *onew; - IFDEBUG(o) - printf("defineset(0x%x,%s, %s)\n", type , adr, keep?"KEEP":"NO_KEEP"); - ENDDEBUG - - onew = (struct Object *)Malloc(sizeof (struct Object)); - bzero(onew, sizeof(struct Object)); - onew->obj_name = adr; - onew->obj_kind = OBJ_SET; - onew->obj_type = type; - if(keep) - insert( onew ); - /* address already stashed before calling defineset */ - IFDEBUG(o) - printf("defineset(0x%x,%s) returning 0x%x\n", type , adr, onew); - dumptree(Objtree,0); - ENDDEBUG - return(onew); -} - -dumpit(o, s) -char *o; -char *s; -{ - register int i; - -IFDEBUG(o) - fprintf(OUT, "object 0x%x, %s\n",o, s); - for(i=0; i< sizeof(struct Object); i+=4) { - fprintf(OUT, "0x%x: 0x%x 0x%x 0x%x 0x%x\n", - *((int *)o), *o, *(o+1), *(o+2), *(o+3) ); - } -ENDDEBUG -} - -defineitem(type, adr, struc) -unsigned char type; -char *adr; -char *struc; -{ - struct Object *onew; - IFDEBUG(o) - printf("defineitem(0x%x, %s at 0x%x, %s)\n", type, adr, adr, struc); - ENDDEBUG - - if( onew = lookup( type, adr ) ) { - fprintf(stderr, - "Internal error at defineitem: trying to redefine obj type 0x%x, adr %s\n", - type, adr); - exit(-1); - } else { - onew = (struct Object *)Malloc(sizeof (struct Object)); - bzero(onew, sizeof(struct Object)); - onew->obj_name = stash(adr); - onew->obj_kind = OBJ_ITEM; - onew->obj_type = type; - onew->obj_struc = struc?stash(struc):struc; - insert( onew ); - } - IFDEBUG(o) - fprintf(OUT, "defineitem(0x%x, %s) returning 0x%x\n", type, adr, onew); - ENDDEBUG -} - -member(o, adr) -struct Object *o; -char *adr; -{ - struct Object *onew, *oold; - IFDEBUG(o) - printf("member(0x%x, %s)\n", o, adr); - ENDDEBUG - - oold = lookup( o->obj_type, adr ); - - onew = (struct Object *)Malloc(sizeof (struct Object)); - if( oold == NULL ) { - extern int lineno; - - fprintf(stderr, - "Warning at line %d: set definition of %s causes definition of\n", - lineno, OBJ_NAME(o)); - fprintf(stderr, "\t (previously undefined) member %s\n", adr); - bzero(onew, sizeof(struct Object)); - onew->obj_name = stash(adr); - onew->obj_kind = OBJ_ITEM; - onew->obj_type = o->obj_type; - onew->obj_members = NULL; - insert( onew ); - } else { - if(oold->obj_kind != OBJ_ITEM) { - fprintf(stderr, "Sets cannot be members of sets; %s\n", adr); - exit(-1); - } - bcopy(oold, onew, sizeof(struct Object)); - onew->obj_members = onew->obj_left = onew->obj_right = NULL; - } - onew->obj_members = o->obj_members; - o->obj_members = onew; -} - -struct Object *Lookup(type, name) -unsigned char type; -char *name; -{ - register struct Object *o = lookup(type,name); - - if(o == NULL) { - fprintf(stderr, "Trying to use undefined %s: %s\n", - type==STATESET?"state":"event", name); - Exit(-1); - } - return(o); -} - -AddCurrentEventName(x) -register char **x; -{ - register char *n = EV_PREFIX; ; - - if( CurrentEvent == (struct Object *)0 ) { - fprintf(stderr, "No event named! BARF!\n"); Exit(-1); - } - - if( ! CurrentEvent->obj_struc ) { - fprintf(stderr, "No attributes for current event!\n"); Exit(-1); - } - - /* add prefix first */ - while(*n) { - *(*x)++ = *n++; - } - - n = CurrentEvent->obj_name; - - while(*n) { - *(*x)++ = *n++; - } -} - -dumptree(o,i) - register struct Object *o; - int i; -{ - register int j; - - if(o == NULL) { - for(j=0; j<i; j++) - fputc(' ', stdout); - fprintf(stdout, "%3d NULL\n", i); - } else { - dumptree(o->obj_left, i+1); - for(j=0; j<i; j++) - fputc(' ', stdout); - fprintf(stdout, "%3d 0x%x: %s\n", i,o, OBJ_NAME(o)); - dumptree(o->obj_right, i+1); - } -} - -dump(c,a) -{ - register int x = 8; - int zero = 0; -#include <sys/signal.h> - - fprintf(stderr, "dump: c 0x%x, a 0x%x\n",c,a); - - x = x/zero; - kill(0, SIGQUIT); -} - -dump_trans( pred, oldstate, newstate, action, event ) -struct Object *oldstate, *newstate, *event; -char *pred, *action; -{ - extern int transno; - struct Object *o; - - fprintf(stdout, "\n%d: ", transno); -#define dumpit(x)\ - if((x)->obj_kind == OBJ_SET) {\ - o = (x)->obj_members; fprintf( stdout, "[ " );\ - while(o) { fprintf(stdout, "%s ", o->obj_name); o = o->obj_members; }\ - fprintf( stdout, " ] ");\ - } else { fprintf(stdout, "%s ", (x)->obj_name); } - - dumpit(newstate); - fprintf(stdout, " <== "); - dumpit(oldstate); - dumpit(event); - fprintf(stdout, "\n\t\t%s\n\t\t%s\n", pred?pred:"DEFAULT", - action); -} diff --git a/sys/netiso/xebec/sets.h b/sys/netiso/xebec/sets.h deleted file mode 100644 index 8459a45508d..00000000000 --- a/sys/netiso/xebec/sets.h +++ /dev/null @@ -1,36 +0,0 @@ -/* $OpenBSD: sets.h,v 1.2 1996/03/04 10:37:24 mickey Exp $ */ -/* $NetBSD: sets.h,v 1.4 1994/06/29 06:41:17 cgd Exp $ */ - -#define MAXEVENTS 200 -#define MAXSTATES 200 - -#define STATESET 10 -#define EVENTSET 5 - -#define OBJ_ITEM 2 -#define OBJ_SET 3 - -struct Object { - unsigned char obj_kind; - unsigned char obj_type; /* state or event */ - char *obj_name; - char *obj_struc; - int obj_number; - struct Object *obj_members; /* must be null for kind==item */ - /* for the tree */ - struct Object *obj_left; - struct Object *obj_right; - struct Object *obj_parent; -} ; - -extern char *Noname; - -#define OBJ_NAME(o) (((o)->obj_name)?(o)->obj_name:Noname) - -extern int Nevents, Nstates; -int Eventshift; -extern struct Object *CurrentEvent; - -extern struct Object *Lookup(); -extern struct Object *defineset(); - diff --git a/sys/netiso/xebec/test.trans b/sys/netiso/xebec/test.trans deleted file mode 100644 index 07f002fa1de..00000000000 --- a/sys/netiso/xebec/test.trans +++ /dev/null @@ -1,65 +0,0 @@ -/* $OpenBSD: test.trans,v 1.2 1996/03/04 10:37:25 mickey Exp $ */ -/* $NetBSD: test.trans,v 1.4 1994/06/29 06:41:18 cgd Exp $ */ - -*PROTOCOL test - -*INCLUDE - -{ -#include "test_def.h" -} - -*PCB test_pcbstruct SYNONYM P - -*STATES - -STATE_A -STATE_B -STATE_C -ALL_STATES = [STATE_A, STATE_B, STATE_C] - -*EVENTS { int ev_all; } SYNONYM E - -EV_1 { char *ev1_char; } -EV_2 { int ev2_int; char ev2_char; } -EV_3 -EV_4 { struct blah *ev4_blahptr; - unsigned int ev4_uint; - int ev4_int; - } - -*TRANSITIONS - -SAME <== [ STATE_A, STATE_B ] [ EV_1, EV_2, EV_3 ] - ( $E.ev_all > 0 ) - { - if( $P.test_state == STATE_A ) - printf("state is STATE_A\n"); - else - printf("state is STATE_B\n"); - printf("action first transition\n"); - } - -; -STATE_C <== [ STATE_A, STATE_B ] [ EV_1, EV_2, EV_3 ] - DEFAULT - { - printf("default - transition 2\n"); - MACRO1( $P.test_pcbfield ); - } -; - -STATE_C <== [ STATE_A, STATE_B ] EV_4 - ( $$.ev4_blahptr->blahfield & 0x1 ) - NULLACTION -; - -STATE_C <== ALL_STATES EV_4 - DEFAULT - { - printf("default - transition 4\n"); - printf("pcb is 0x%x, event is 0x%x \n", $P, $E); - printf("ev4 values are : blahptr 0x%x uint 0x%x int 0x%x\n", - $$.ev4_blahptr, $$.ev4_uint, $$.ev4_int); - } -; diff --git a/sys/netiso/xebec/test_def.h b/sys/netiso/xebec/test_def.h deleted file mode 100644 index ad54c14bf25..00000000000 --- a/sys/netiso/xebec/test_def.h +++ /dev/null @@ -1,15 +0,0 @@ -/* $OpenBSD: test_def.h,v 1.2 1996/03/04 10:37:26 mickey Exp $ */ -/* $NetBSD: test_def.h,v 1.4 1994/06/29 06:41:20 cgd Exp $ */ - -struct blah { - unsigned int blahfield; - int dummyi; - char dummyc; -}; - -struct test_pcbstruct { - int test_pcbfield; - int test_state; -}; - -#define MACRO1(arg) if(arg != 0) { printf("macro1\n"); } diff --git a/sys/netiso/xebec/xebec.bnf b/sys/netiso/xebec/xebec.bnf deleted file mode 100644 index 1ad342b2e34..00000000000 --- a/sys/netiso/xebec/xebec.bnf +++ /dev/null @@ -1,317 +0,0 @@ -/* $OpenBSD: xebec.bnf,v 1.2 1996/03/04 10:37:28 mickey Exp $ */ -/* $NetBSD: xebec.bnf,v 1.4 1994/06/29 06:41:22 cgd Exp $ */ - -#include "main.h" -#include "sets.h" -#include <stdio.h> - -extern FILE *eventfile_h, *actfile; -} - -*fmq - - novocab - nobnf - nofirst - nofollow - noparsetable - noerrortables - nos - noe - -*terminals - -ID 0 0 { char *address; } -STRUCT 0 0 -SYNONYM 0 0 -PREDICATE 0 0 { char *address; } -ACTION 0 0 { char *address; } -/* -FSTRING 0 0 { char *address; } -*/ -PROTOCOL 0 0 -LBRACK 0 0 -RBRACK 0 0 -LANGLE 0 0 -EQUAL 0 0 -COMMA 0 0 -STAR 0 0 -EVENTS 0 0 -TRANSITIONS 0 0 -INCLUDE 0 0 -STATES 0 0 -SEMI 0 0 -PCB 0 0 { char *address; } -DEFAULT 0 0 -NULLACTION 0 0 -SAME 0 0 - -*nonterminals - -pcb { char *address; int isevent; } -syn { int type; } -setlist { struct Object *setnum; } -setlisttail { struct Object *setnum; } -part { unsigned char type; } -parttail { unsigned char type; } -partrest { unsigned char type; char *address; } -setstruct { struct Object *object; } -setdef { unsigned char type,keep; char *address; struct Object *object; } -translist -transition -event { struct Object *object; } -oldstate { struct Object *object; } -newstate { struct Object *object; } -predicatepart { char *string; } -actionpart { char *string; struct Object *oldstate; struct Object *newstate; } - -*productions - -program ::= - STAR PROTOCOL ID - { - if(strlen($ID.address) > 50 ) { - fprintf(stderr, - "Protocol name may not exceed 50 chars in length.\n"); - Exit(-1); - } - strcpy(protocol, $ID.address); - openfiles(protocol); - } - STAR includelist - PCB - { - $$pcb.isevent = 0; - } - pcb - { - fprintf(actfile, "\ntypedef %s %s%s;\n", - $pcb[7].address,protocol, PCBNAME); - $$syn.type = PCB_SYN; - } - syn - STAR STATES { $$part.type = (unsigned char) STATESET; } part - STAR { end_states(eventfile_h); } EVENTS - { $$pcb.isevent = 1; } - pcb - { - fprintf(eventfile_h, "\t"); /* fmq gags on single chars */ - includecode(eventfile_h, $pcb[14].address); - fprintf(eventfile_h, "\n"); /* fmq gags on single chars */ - $$syn.type = EVENT_SYN; - } - syn - { - $$part.type = (unsigned char)EVENTSET; - } - part - STAR { end_events(); } - TRANSITIONS - { - putincludes(); - putdriver(actfile, 9); - } - translist -; -pcb ::= STRUCT - { if($pcb.isevent) { - fprintf(stderr, - "Event is a list of objects enclosed by \"{}\"\n"); - Exit(-1); - } - fprintf(eventfile_h, "struct "); - } - ACTION { $pcb.address = $ACTION.address; } - optsemi - ::= ACTION - { if( ! $pcb.isevent) { - fprintf(stderr, - "Pcb requires a type or structure definition.\"{}\"\n"); - Exit(-1); - } - $pcb.address = $ACTION.address; - } - optsemi - ::= ID { $pcb.address = $ID.address; } optsemi -; - -syn ::= SYNONYM ID { synonyms[$syn.type] = stash( $ID.address ); } - ::= -; - -optsemi ::= SEMI - ::= -; -includelist ::= INCLUDE ACTION { includecode(actfile, $ACTION.address);} STAR - ::= -; -part ::= ID - { - $$partrest.address = $ID.address; - $$partrest.type = $part.type; - } - partrest - { $$parttail.type = $part.type; } - parttail -; -parttail ::= { $$part.type = $parttail.type; } part - ::= -; -partrest ::= EQUAL - { - if( lookup( $partrest.type, $partrest.address ) ) { - fprintf(stderr, "bnf:trying to redefine obj type 0x%x, adr %s\n", - $partrest.type, $partrest.address); - Exit(-1); - } - $$setdef.type = $partrest.type; - $$setdef.address = stash( $partrest.address ); - $$setdef.keep = 1; - } setdef { $$setstruct.object = $setdef.object; } setstruct - - ::= ACTION - { - defineitem($partrest.type, - $partrest.address, $ACTION.address); - } - - ::= { - defineitem($partrest.type, $partrest.address, (char *)0); - } -; - -setstruct ::= ACTION - { - if($setstruct.object) { - /* WHEN COULD THIS BE FALSE?? - * isn't it supposed to be setstruct.object??? - * (it used to be $ACTION.address) - */ - - $setstruct.object->obj_struc = $ACTION.address; - fprintf(eventfile_h, - "struct %s %s%s;\n\n", $ACTION.address, - EV_PREFIX, $setstruct.object->obj_name); - } - } - ::= -; - -setdef ::= LBRACK - { - $$setlist.setnum = - defineset($setdef.type, $setdef.address, $setdef.keep); - } setlist RBRACK { $setdef.object = $setlist.setnum; } -; - -setlist ::= ID - { - member($setlist.setnum, $ID.address); - $$setlisttail.setnum = $setlist.setnum; - } setlisttail -; - -setlisttail ::= COMMA { $$setlist.setnum = $setlisttail.setnum; } setlist - ::= -; -translist ::= transition translisttail -; -translisttail ::= translist - ::= -; -transition ::= newstate { transno ++; } LANGLE EQUAL EQUAL oldstate - event - { - CurrentEvent /* GAG! */ = $event.object; - } - predicatepart - { - $$actionpart.string = $predicatepart.string; - $$actionpart.newstate = $newstate.object; - $$actionpart.oldstate = $oldstate.object; - } - actionpart - SEMI -; - -predicatepart ::= PREDICATE - { - $predicatepart.string = stash ( $PREDICATE.address ); - } - ::= DEFAULT - { - $predicatepart.string = (char *)0; - } -; - -actionpart ::= - ACTION - { - statetable( $actionpart.string, $actionpart.oldstate, - $actionpart.newstate, - acttable(actfile, $ACTION.address ), - CurrentEvent ); - if( print_trans ) { - dump_trans( $actionpart.string, $actionpart.oldstate, - $actionpart.newstate, - $ACTION.address, CurrentEvent ); - } - } - ::= NULLACTION - { - statetable($actionpart.string, $actionpart.oldstate, $actionpart.newstate, - 0, CurrentEvent ); /* KLUDGE - remove this */ - if( print_trans ) { - dump_trans( $actionpart.string, $actionpart.oldstate, - $actionpart.newstate, - "NULLACTION", CurrentEvent ); - } - } -; - -oldstate ::= ID - { - $oldstate.object = Lookup(STATESET, $ID.address); - } - ::= { - $$setdef.address = (char *)0; - $$setdef.type = (unsigned char)STATESET; - $$setdef.keep = 0; - } - setdef - { - $oldstate.object = $setdef.object; - } -; - -newstate ::= ID - { - $newstate.object = Lookup(STATESET, $ID.address); - } -; - -newstate ::= SAME - { - extern struct Object *SameState; - - $newstate.object = SameState; - } -; - -event ::= ID - { - $event.object = Lookup(EVENTSET, $ID.address); - } - ::= - { - $$setdef.address = (char *)0; - $$setdef.type = (unsigned char)EVENTSET; - $$setdef.keep = 0; - } - setdef - { - $event.object = $setdef.object; - } -; - -*end diff --git a/sys/netiso/xebec/xebec.c b/sys/netiso/xebec/xebec.c deleted file mode 100644 index 73808aeab05..00000000000 --- a/sys/netiso/xebec/xebec.c +++ /dev/null @@ -1,451 +0,0 @@ -/* $OpenBSD: xebec.c,v 1.3 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: xebec.c,v 1.4 1994/06/29 06:41:23 cgd Exp $ */ - -#include "xebec.h" -#include "llparse.h" -#ifndef E_TABLE -#define E_TABLE "xebec.e" -#endif /* E_TABLE */ - -#include "main.h" -#include "sets.h" -#include <stdio.h> - -extern FILE *eventfile_h, *actfile; - -llaction(lln,token) -LLtoken *token; -{ - struct llattr *llattr; - llattr = &llattrdesc[lldescindex-1]; -switch(lln) { -case 1: - llfinprod(); - break; - -case 10: { - - if(strlen(llattr->llabase[3].ID.address) > 50 ) { - fprintf(stderr, - "Protocol name may not exceed 50 chars in length.\n"); - Exit(-1); - } - strcpy(protocol, llattr->llabase[3].ID.address); - openfiles(protocol); - -} break; - -case 11: { - - llattr->llabase[7].pcb.isevent = 0; - -} break; - -case 12: { - - fprintf(actfile, "\ntypedef %s %s%s;\n", - llattr->llabase[7].pcb.address,protocol, PCBNAME); - llattr->llabase[8].syn.type = PCB_SYN; - -} break; - -case 13: { - llattr->llabase[11].part.type = (unsigned char) STATESET; -} break; - -case 14: { - end_states(eventfile_h); -} break; - -case 15: { - llattr->llabase[14].pcb.isevent = 1; -} break; - -case 16: { - - fprintf(eventfile_h, "\t"); /* fmq gags on single chars */ - includecode(eventfile_h, llattr->llabase[14].pcb.address); - fprintf(eventfile_h, "\n"); /* fmq gags on single chars */ - llattr->llabase[15].syn.type = EVENT_SYN; - -} break; - -case 17: { - - llattr->llabase[16].part.type = (unsigned char)EVENTSET; - -} break; - -case 18: { - end_events(); -} break; - -case 19: { - - putincludes(); - putdriver(actfile, 9); - -} break; - -case 20: { - if(llattr->llabase[0].pcb.isevent) { - fprintf(stderr, - "Event is a list of objects enclosed by \"{}\"\n"); - Exit(-1); - } - fprintf(eventfile_h, "struct "); - -} break; - -case 21: { - llattr->llabase[0].pcb.address = llattr->llabase[2].ACTION.address; -} break; - -case 22: { - if( ! llattr->llabase[0].pcb.isevent) { - fprintf(stderr, - "Pcb requires a type or structure definition.\"{}\"\n"); - Exit(-1); - } - llattr->llabase[0].pcb.address = llattr->llabase[1].ACTION.address; - -} break; - -case 23: { - llattr->llabase[0].pcb.address = llattr->llabase[1].ID.address; -} break; - -case 24: { - synonyms[llattr->llabase[0].syn.type] = stash( llattr->llabase[2].ID.address ); -} break; - -case 25: { - includecode(actfile, llattr->llabase[2].ACTION.address); -} break; - -case 26: { - - llattr->llabase[2].partrest.address = llattr->llabase[1].ID.address; - llattr->llabase[2].partrest.type = llattr->llabase[0].part.type; - -} break; - -case 27: { - llattr->llabase[3].parttail.type = llattr->llabase[0].part.type; -} break; - -case 28: { - llattr->llabase[1].part.type = llattr->llabase[0].parttail.type; -} break; - -case 29: { - - if( lookup( llattr->llabase[0].partrest.type, llattr->llabase[0].partrest.address ) ) { - fprintf(stderr, "bnf:trying to redefine obj type 0x%x, adr %s\n", - llattr->llabase[0].partrest.type, llattr->llabase[0].partrest.address); - Exit(-1); - } - llattr->llabase[2].setdef.type = llattr->llabase[0].partrest.type; - llattr->llabase[2].setdef.address = stash( llattr->llabase[0].partrest.address ); - llattr->llabase[2].setdef.keep = 1; - -} break; - -case 30: { - llattr->llabase[3].setstruct.object = llattr->llabase[2].setdef.object; -} break; - -case 31: { - - defineitem(llattr->llabase[0].partrest.type, - llattr->llabase[0].partrest.address, llattr->llabase[1].ACTION.address); - -} break; - -case 32: { - - defineitem(llattr->llabase[0].partrest.type, llattr->llabase[0].partrest.address, (char *)0); - -} break; - -case 33: { - - if(llattr->llabase[0].setstruct.object) { - /* WHEN COULD THIS BE FALSE?? - * isn't it supposed to be setstruct.object??? - * (it used to be $ACTION.address) - */ - - llattr->llabase[0].setstruct.object->obj_struc = llattr->llabase[1].ACTION.address; - fprintf(eventfile_h, - "struct %s %s%s;\n\n", llattr->llabase[1].ACTION.address, - EV_PREFIX, llattr->llabase[0].setstruct.object->obj_name); - } - -} break; - -case 34: { - - llattr->llabase[2].setlist.setnum = - defineset(llattr->llabase[0].setdef.type, llattr->llabase[0].setdef.address, llattr->llabase[0].setdef.keep); - -} break; - -case 35: { - llattr->llabase[0].setdef.object = llattr->llabase[2].setlist.setnum; -} break; - -case 36: { - - member(llattr->llabase[0].setlist.setnum, llattr->llabase[1].ID.address); - llattr->llabase[2].setlisttail.setnum = llattr->llabase[0].setlist.setnum; - -} break; - -case 37: { - llattr->llabase[2].setlist.setnum = llattr->llabase[0].setlisttail.setnum; -} break; - -case 38: { - transno ++; -} break; - -case 39: { - - CurrentEvent /* GAG! */ = llattr->llabase[6].event.object; - -} break; - -case 40: { - - llattr->llabase[8].actionpart.string = llattr->llabase[7].predicatepart.string; - llattr->llabase[8].actionpart.newstate = llattr->llabase[1].newstate.object; - llattr->llabase[8].actionpart.oldstate = llattr->llabase[5].oldstate.object; - -} break; - -case 41: { - - llattr->llabase[0].predicatepart.string = stash ( llattr->llabase[1].PREDICATE.address ); - -} break; - -case 42: { - - llattr->llabase[0].predicatepart.string = (char *)0; - -} break; - -case 43: { - - statetable( llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate, - llattr->llabase[0].actionpart.newstate, - acttable(actfile, llattr->llabase[1].ACTION.address ), - CurrentEvent ); - if( print_trans ) { - dump_trans( llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate, - llattr->llabase[0].actionpart.newstate, - llattr->llabase[1].ACTION.address, CurrentEvent ); - } - -} break; - -case 44: { - - statetable(llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate, llattr->llabase[0].actionpart.newstate, - 0, CurrentEvent ); /* KLUDGE - remove this */ - if( print_trans ) { - dump_trans( llattr->llabase[0].actionpart.string, llattr->llabase[0].actionpart.oldstate, - llattr->llabase[0].actionpart.newstate, - "NULLACTION", CurrentEvent ); - } - -} break; - -case 45: { - - llattr->llabase[0].oldstate.object = Lookup(STATESET, llattr->llabase[1].ID.address); - -} break; - -case 46: { - - llattr->llabase[1].setdef.address = (char *)0; - llattr->llabase[1].setdef.type = (unsigned char)STATESET; - llattr->llabase[1].setdef.keep = 0; - -} break; - -case 47: { - - llattr->llabase[0].oldstate.object = llattr->llabase[1].setdef.object; - -} break; - -case 48: { - - llattr->llabase[0].newstate.object = Lookup(STATESET, llattr->llabase[1].ID.address); - -} break; - -case 49: { - - extern struct Object *SameState; - - llattr->llabase[0].newstate.object = SameState; - -} break; - -case 50: { - - llattr->llabase[0].event.object = Lookup(EVENTSET, llattr->llabase[1].ID.address); - -} break; - -case 51: { - - llattr->llabase[1].setdef.address = (char *)0; - llattr->llabase[1].setdef.type = (unsigned char)EVENTSET; - llattr->llabase[1].setdef.keep = 0; - -} break; - -case 52: { - - llattr->llabase[0].event.object = llattr->llabase[1].setdef.object; - -} break; -} -} -char *llstrings[] = { - "<null>", - "ID", - "STRUCT", - "SYNONYM", - "PREDICATE", - "ACTION", - "PROTOCOL", - "LBRACK", - "RBRACK", - "LANGLE", - "EQUAL", - "COMMA", - "STAR", - "EVENTS", - "TRANSITIONS", - "INCLUDE", - "STATES", - "SEMI", - "PCB", - "DEFAULT", - "NULLACTION", - "SAME", - "ENDMARKER", - "pcb", - "syn", - "setlist", - "setlisttail", - "part", - "parttail", - "partrest", - "setstruct", - "setdef", - "translist", - "transition", - "event", - "oldstate", - "newstate", - "predicatepart", - "actionpart", - "program", - "includelist", - "optsemi", - "translisttail", - "$goal$", - (char *) 0 -}; -short llnterms = 23; -short llnsyms = 44; -short llnprods = 38; -short llinfinite = 10000; -short llproductions[] = { -41, -21, 5, -20, 2, -41, -22, 5, -41, -23, 1, --24, 1, 3, - -26, -36, 1, -25, -37, 11, - -28, -27, 29, -26, 1, -27, -28, - -30, -30, 31, -29, 10, --31, 5, --32, --33, 5, - --35, 8, 25, -34, 7, -42, 33, -17, 38, -40, 37, -39, 34, 35, 10, 10, 9, -38, 36, --50, 1, --52, 31, -51, --45, 1, --47, 31, -46, --48, 1, --49, 21, --41, 4, --42, 19, --43, 5, --44, 20, -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, -12, -25, 5, 15, - -17, - -32, - -22, 39, -0 -}; -struct llprodindex llprodindex[] = { -{ 0, 0, 0 }, { 0, 5, 19 }, { 5, 3, 3 }, { 8, 3, 2 }, -{ 11, 3, 2 }, { 14, 0, 2 }, { 14, 3, 0 }, { 17, 3, 1 }, -{ 20, 0, 0 }, { 20, 5, 3 }, { 25, 2, 0 }, { 27, 0, 3 }, -{ 27, 5, 1 }, { 32, 2, 0 }, { 34, 1, 3 }, { 35, 2, 1 }, -{ 37, 0, 0 }, { 37, 5, 1 }, { 42, 2, 0 }, { 44, 12, 3 }, -{ 56, 2, 2 }, { 58, 3, 2 }, { 61, 2, 0 }, { 63, 3, 2 }, -{ 66, 2, 1 }, { 68, 2, 0 }, { 70, 2, 9 }, { 72, 2, 1 }, -{ 74, 2, 1 }, { 76, 2, 1 }, { 78, 29, 1 }, { 107, 4, 1 }, -{ 111, 0, 1 }, { 111, 1, 1 }, { 112, 0, 1 }, { 112, 1, 1 }, -{ 113, 0, 1 }, { 113, 2, 2 }, { 0, 0, 0 } -}; -short llepsilon[] = { - 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, - 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 1, 0, 1, 0, 0 -}; -struct llparsetable llparsetable[] = { -{ 1, 3 }, { 2, 1 }, { 5, 2 }, { 0, 23 }, { 1, 5 }, -{ 3, 4 }, { 12, 5 }, { 0, 24 }, { 1, 6 }, { 0, 25 }, -{ 8, 8 }, { 11, 7 }, { 0, 26 }, { 1, 9 }, { 0, 27 }, -{ 1, 10 }, { 12, 11 }, { 0, 28 }, { 1, 14 }, { 5, 13 }, -{ 10, 12 }, { 12, 14 }, { 0, 29 }, { 1, 16 }, { 5, 15 }, -{ 12, 16 }, { 0, 30 }, { 7, 17 }, { 0, 31 }, { 1, 18 }, -{ 21, 18 }, { 0, 32 }, { 1, 19 }, { 21, 19 }, { 0, 33 }, -{ 1, 20 }, { 7, 21 }, { 0, 34 }, { 1, 22 }, { 7, 23 }, -{ 0, 35 }, { 1, 24 }, { 21, 25 }, { 0, 36 }, { 4, 26 }, -{ 19, 27 }, { 0, 37 }, { 5, 28 }, { 20, 29 }, { 0, 38 }, -{ 12, 30 }, { 0, 39 }, { 15, 31 }, { 18, 32 }, { 0, 40 }, -{ 1, 34 }, { 3, 34 }, { 12, 34 }, { 17, 33 }, { 0, 41 }, -{ 1, 35 }, { 21, 35 }, { 22, 36 }, { 0, 42 }, { 12, 37 }, -{ 0, 43 }, { 0, 0 } -}; -short llparseindex[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 8, 10, 13, 15, 18, - 23, 27, 29, 32, 35, 38, 41, 44, 47, 50, - 52, 55, 60, 64, 0 -}; diff --git a/sys/netiso/xebec/xebec.h b/sys/netiso/xebec/xebec.h deleted file mode 100644 index bb87d142679..00000000000 --- a/sys/netiso/xebec/xebec.h +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: xebec.h,v 1.2 1996/03/04 10:37:31 mickey Exp $ */ -/* $NetBSD: xebec.h,v 1.4 1994/06/29 06:41:25 cgd Exp $ */ - -union llattrib { - struct { - char *address; } ID; - int STRUCT; - int SYNONYM; - struct { - char *address; } PREDICATE; - struct { - char *address; } ACTION; - int PROTOCOL; - int LBRACK; - int RBRACK; - int LANGLE; - int EQUAL; - int COMMA; - int STAR; - int EVENTS; - int TRANSITIONS; - int INCLUDE; - int STATES; - int SEMI; - struct { - char *address; } PCB; - int DEFAULT; - int NULLACTION; - int SAME; - struct { - char *address; int isevent; } pcb; - struct { - int type; } syn; - struct { - struct Object *setnum; } setlist; - struct { - struct Object *setnum; } setlisttail; - struct { - unsigned char type; } part; - struct { - unsigned char type; } parttail; - struct { - unsigned char type; char *address; } partrest; - struct { - struct Object *object; } setstruct; - struct { - unsigned char type,keep; char *address; struct Object *object; } setdef; - int translist; - int transition; - struct { - struct Object *object; } event; - struct { - struct Object *object; } oldstate; - struct { - struct Object *object; } newstate; - struct { - char *string; } predicatepart; - struct { - char *string; struct Object *oldstate; struct Object *newstate; } actionpart; -}; -#define LLTERM 23 -#define LLSYM 44 -#define LLPROD 38 - -#define LLINF 10000 - -#define T_ID 1 -#define T_STRUCT 2 -#define T_SYNONYM 3 -#define T_PREDICATE 4 -#define T_ACTION 5 -#define T_PROTOCOL 6 -#define T_LBRACK 7 -#define T_RBRACK 8 -#define T_LANGLE 9 -#define T_EQUAL 10 -#define T_COMMA 11 -#define T_STAR 12 -#define T_EVENTS 13 -#define T_TRANSITIONS 14 -#define T_INCLUDE 15 -#define T_STATES 16 -#define T_SEMI 17 -#define T_PCB 18 -#define T_DEFAULT 19 -#define T_NULLACTION 20 -#define T_SAME 21 -#define T_ENDMARKER 22 |