Make compilable with -Wall, in hope this could be actually useful

(which is unlikely)
This commit is contained in:
jdolecek 2001-06-18 09:57:27 +00:00
parent 49ed2592ce
commit 176beeea9e
14 changed files with 232 additions and 137 deletions

View File

@ -1,9 +1,10 @@
# $NetBSD: Makefile,v 1.7 1999/02/13 02:54:54 lukem Exp $
# $NetBSD: Makefile,v 1.8 2001/06/18 09:57:27 jdolecek 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
CPPFLAGS+= -DDEBUG -traditional
CPPFLAGS+= -Wall -DDEBUG -traditional
MKMAN= no
WARNS=0
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: llparse.c,v 1.4 1994/06/29 06:41:02 cgd Exp $ */
/* $NetBSD: llparse.c,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* ************************* NOTICE *******************************
@ -24,13 +24,16 @@ short llparsestack[STACKSIZE];
short llstackptr = 0;
LLtoken lltoken;
void prt_token();
int
llparse()
{
register havetoken = FALSE;
register sym;
register int havetoken = FALSE;
register int sym;
register LLtoken *t = &lltoken;
register parseaction;
register accepted = FALSE;
register int parseaction;
register int accepted = FALSE;
llpushprod(llnprods-1); /* $$$ ::= <start symbol> */
@ -115,12 +118,13 @@ llparse()
return(0);
}
void
llpushprod(prod) /* recognize production prod - push rhs on stack */
short prod;
short prod;
{
register start;
register length;
register count;
register int start;
register int length;
register int count;
start = llprodindex[prod].llprodstart;
length = llprodindex[prod].llprodlength;
@ -162,14 +166,14 @@ short prod;
}
}
int
llepsilonok(term)
{
register ptr;
register sym;
register pact;
register nomore;
register rval;
register int ptr;
register int sym;
register int pact;
register int nomore;
register int rval;
IFDEBUG(L)
printf("llepsilonok() enter\n");
@ -215,9 +219,10 @@ llepsilonok(term)
}
short llfindaction(sym, term)
short
llfindaction(sym, term)
{
register index;
register int index;
IFDEBUG(L)
printf("llfindaction(sym=%d, term=%d) enter \n", sym, term);
@ -233,7 +238,7 @@ short llfindaction(sym, term)
return(0);
}
void
llparsererror(token)
LLtoken *token;
{
@ -248,9 +253,9 @@ LLtoken *token;
Exit(-1);
}
void
llgettoken(token)
LLtoken *token;
LLtoken *token;
{
llscan(token);
token->llstate = NORMAL;
@ -283,8 +288,9 @@ struct llattr llattrdesc[LLMAXDESC];
int lldescindex = 1;
void
llsetattr(n)
int n;
{
register struct llattr *ptr;
@ -306,8 +312,9 @@ llsetattr(n)
lldescindex++;
}
void
llpushattr(attr)
LLattrib attr;
LLattrib attr;
{
struct llattr *a;
@ -323,6 +330,7 @@ LLattrib attr;
a->llaindex++; /* inc count of attrs on the stack for this prod */
}
void
llfinprod()
{
IFDEBUG(L)
@ -337,6 +345,7 @@ llfinprod()
#ifndef LINT
#ifdef DEBUG
void
dump_parse_stack()
{
int ind;
@ -352,10 +361,11 @@ dump_parse_stack()
#endif DEBUG
#endif LINT
void
prt_token(t)
LLtoken *t;
LLtoken *t;
{
fprintf(stdout, "t at 0x%x\n", t);
fprintf(stdout, "t at 0x%p\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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: llparse.h,v 1.4 1994/06/29 06:41:04 cgd Exp $ */
/* $NetBSD: llparse.h,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
/************************************************************
attributes stack garbage
@ -127,18 +127,29 @@ extern char *llstrings[];
routines defined in llparse.c
************************************************************/
extern llparse();
extern llcopye();
extern llcopys();
extern llcorrector();
extern llepsilonok();
extern llexpand();
extern int llparse();
extern void llcopye();
extern void llcopys();
extern void llcorrector();
extern int llepsilonok();
extern void llexpand();
extern short llfindaction();
extern llgetprefix();
extern llgettoken();
extern llinsert();
extern llinsertsym();
extern llinserttokens();
extern llparsererror();
extern llpushprod();
extern llreadetab();
extern void llgetprefix();
extern void llgettoken();
extern void llinsert();
extern void llinsertsym();
extern void llinserttokens();
extern void llparsererror();
extern void llpushprod();
extern void llreadetab();
extern void llaction();
extern void llpushattr();
extern void llsetattr();
extern void llfinprod();
/************************************************************
routines defined in llscan.c
************************************************************/
extern void llscan();
extern void dump_buffer();
extern void llaccept();

View File

@ -1,4 +1,4 @@
/* $NetBSD: llscan.c,v 1.5 1994/06/29 06:41:05 cgd Exp $ */
/* $NetBSD: llscan.c,v 1.6 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* ************************* NOTICE *******************************
@ -16,6 +16,7 @@
#include <stdio.h>
#include "procs.h"
#include "debug.h"
#include <string.h>
#define EOFILE 0x01
#define UNUSED 0x02
@ -72,6 +73,10 @@ static int currentbuf = 1;
static int ch = ' ';
int getch();
extern void AddCurrentEventName();
void
skip()
{
while((chtype[ch] == IGNORE) ) {
@ -79,8 +84,9 @@ skip()
}
}
void
llaccept(t)
LLtoken *t;
LLtoken *t;
{
switch(t->llstate) {
case NORMAL:
@ -96,7 +102,7 @@ LLtoken *t;
#define TVAL (t->llattrib)
void
dump_buffer()
{
register int i;
@ -135,6 +141,7 @@ char **buf;
return(0);
}
void
getstr(o,c)
/* c is the string delimiter
* allow the delimiter to be escaped
@ -151,7 +158,7 @@ char o,c;
IFDEBUG(S)
fprintf(stdout,"getstr: ch=%c, delimiters %c %c\n",
ch,o, c);
fprintf(stdout,"getstr: buffptr 0x%x, currentbuf 0x%x\n",
fprintf(stdout,"getstr: buffptr 0x%p, currentbuf 0x%x\n",
buffptr, currentbuf);
ENDDEBUG
@ -234,7 +241,7 @@ char o,c;
fprintf(stderr,
"%s too long.\n", (o=='{')?"Action":"Predicate"); /*}*/
fprintf(stderr,
"buffptr, currentbuf 0x%x, 0x%x\n",buffptr,currentbuf );
"buffptr, currentbuf 0x%p, 0x%x\n",buffptr,currentbuf );
Exit(-1);
}
IFDEBUG(S)
@ -247,11 +254,12 @@ char o,c;
IFDEBUG(S)
fprintf(stdout,"exit getstr: got %s\n", buffer[currentbuf]);
fprintf(stdout,"exit getstr: buffptr 0x%x, currentbuf 0x%x\n",
fprintf(stdout,"exit getstr: buffptr 0x%p, currentbuf 0x%x\n",
buffptr, currentbuf);
ENDDEBUG
}
int
getch()
{
char c;
@ -271,8 +279,9 @@ getch()
return c;
}
void
llscan(t)
LLtoken *t;
LLtoken *t;
{
char c;
@ -418,7 +427,7 @@ again:
TVAL.ID.address = buffer[currentbuf];
}
IFDEBUG(S)
fprintf(stdout, "llscan: id or keyword 0x%x, %s\n",
fprintf(stdout, "llscan: id or keyword 0x%p, %s\n",
TVAL.ID.address, TVAL.ID.address);
ENDDEBUG
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.6 2001/04/06 11:13:56 wiz Exp $ */
/* $NetBSD: main.c,v 1.7 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* TODO:
@ -13,9 +13,11 @@
#include <stdio.h>
#include <strings.h>
#include <time.h>
#include "malloc.h"
#include "debug.h"
#include "main.h"
#include "procs.h"
int debug[128];
@ -42,8 +44,16 @@ char *synonyms[] = {
0
};
void FakeFilename();
extern void llparse();
extern void initsets();
extern void init_alloc();
extern void dump_predtable();
extern void printprotoerrs();
void
usage(a)
char *a;
char *a;
{
fprintf(stderr,
"usage: %s <transition file> {-D<debug options>} <other options>\n",
@ -68,8 +78,9 @@ char *a;
Exit(-1);
}
void
openfiles(proto)
register char *proto;
register char *proto;
{
register char *junk;
register int lenp = strlen(proto);
@ -123,9 +134,10 @@ register char *proto;
initsets(eventfile_h, statefile);
}
void
includecode(file, f)
FILE *file;
register char *f;
FILE *file;
register char *f;
{
register int count=1;
static char o='{';
@ -133,7 +145,7 @@ register char *f;
register char *g;
IFDEBUG(a)
fprintf(stdout, "including: %s, f=0x%x", f,f);
fprintf(stdout, "including: %s, f=0x%p", f,f);
ENDDEBUG
g = ++f;
while(count>0) {
@ -149,6 +161,7 @@ register char *f;
FakeFilename(file, Transfilename, lineno);
}
void
putincludes()
{
FakeFilename(actfile, Transfilename, lineno);
@ -161,6 +174,7 @@ putincludes()
FakeFilename(actfile, Transfilename, lineno);
}
int
main(argc, argv)
int argc;
char *argv[];
@ -201,12 +215,12 @@ char *argv[];
fprintf(stdout, "debugging file is %s\n",actfile_name);
break;
case 'K':
debug[c]=1;
debug[(unsigned char) 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;
debug[(unsigned char) c]=1;
name = &argv[i][++j];
astringfile_name = Malloc( strlen(name)+4);
astringfile_name = (char *)strcpy(astringfile_name,name);
@ -255,13 +269,13 @@ char *argv[];
debug['X']);
break;
case 'D':
while( c = argv[i][++j] ) {
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;
debug[(unsigned char) c]=1;
fprintf(OUT, "debug %c\n",c);
}
break;
@ -371,10 +385,13 @@ char *argv[];
fprintf(stdout, "%d seconds\n", finish - start);
if( print_protoerrs )
printprotoerrs();
exit(0);
}
int transno = 0;
void
Exit(n)
{
fprintf(stderr, "Error at line %d\n",lineno);
@ -386,6 +403,7 @@ Exit(n)
exit(n);
}
#if 0
syntax()
{
static char *synt[] = {
@ -397,11 +415,13 @@ syntax()
"*TRANSITIONS <string>\n",
};
}
#endif
void
FakeFilename(outfile, name, l)
FILE *outfile;
char *name;
int l;
FILE *outfile;
char *name;
int l;
{
/*
doesn't work

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.h,v 1.4 1994/06/29 06:41:08 cgd Exp $ */
/* $NetBSD: main.h,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
#define TRUE 1
#define FALSE 0
@ -28,4 +28,7 @@ extern char *synonyms[];
extern int transno;
extern int print_trans;
extern char *stash();
extern void Exit();
extern void putincludes();
extern void openfiles();
extern void includecode();

View File

@ -1,4 +1,4 @@
/* $NetBSD: malloc.c,v 1.4 1994/06/29 06:41:10 cgd Exp $ */
/* $NetBSD: malloc.c,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* This code is such a kludge that I don't want to put my name on it.
@ -15,13 +15,14 @@
#include <stdio.h>
#include "malloc.h"
#include "debug.h"
#include "main.h"
#define CHUNKSIZE 4096*2
static char *hiwat, *highend;
int bytesmalloced=0;
int byteswasted = 0;
void
init_alloc()
{
#ifdef LINT
@ -36,11 +37,12 @@ init_alloc()
#endif LINT
}
void
HIWAT(s)
char *s;
char *s;
{
IFDEBUG(M)
fprintf(stdout, "HIWAT 0x%x %s\n", hiwat,s);
fprintf(stdout, "HIWAT 0x%p %s\n", hiwat,s);
fflush(stdout);
ENDDEBUG
}
@ -63,7 +65,7 @@ int x;
fflush(stdout);
ENDDEBUG
IFDEBUG(M)
fprintf(stdout, "Malloc 0x%x, %d, hiwat 0x%x\n",
fprintf(stdout, "Malloc 0x%x, %d, hiwat 0x%p\n",
total,total, hiwat);
fflush(stdout);
ENDDEBUG
@ -89,7 +91,7 @@ int x;
if ( (hiwat + x) > highend) {
c = sbrk(CHUNKSIZE);
IFDEBUG(M)
fprintf(stdout, "hiwat 0x%x, x 0x%x, highend 0x%x, c 0x%x\n",
fprintf(stdout, "hiwat 0x%p, x 0x%x, highend 0x%p, c 0x%p\n",
hiwat, x, highend, c);
fflush(stdout);
ENDDEBUG
@ -124,11 +126,11 @@ int x;
hiwat = (char *)((unsigned)(hiwat + 3) & ~0x3);
}
IFDEBUG(M)
fprintf(stdout, "Malloc = 0x%x, bytesm 0x%x, wasted 0x%x, hiwat 0x%x\n",
fprintf(stdout, "Malloc = 0x%p, bytesm 0x%x, wasted 0x%x, hiwat 0x%p\n",
returnvalue, bytesmalloced, byteswasted, hiwat);
ENDDEBUG
IFDEBUG(N)
fprintf(stdout, "Malloc returns 0x%x, sbrk(0) 0x%x\n", returnvalue, sbrk(0));
fprintf(stdout, "Malloc returns 0x%p, sbrk(0) 0x%p\n", returnvalue, sbrk(0));
fflush(stdout);
ENDDEBUG
return(returnvalue);

View File

@ -1,4 +1,4 @@
/* $NetBSD: procs.c,v 1.4 1994/06/29 06:41:12 cgd Exp $ */
/* $NetBSD: procs.c,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* This code is such a kludge that I don't want to put my name on it.
@ -8,6 +8,7 @@
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include "malloc.h"
#include "main.h"
#include "debug.h"
@ -36,7 +37,11 @@ struct Predicate **Predlist;
struct Stateent **Statelist;
extern FILE *astringfile;
end_events() {
int predtable();
void
end_events()
{
int size, part;
char *addr;
@ -57,18 +62,18 @@ end_events() {
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",
fprintf(OUT, "Predlist at 0x%p, sbrk 0x%p bzero size %d at addr 0x%p\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);
fprintf(OUT, "bzero addr 0x%p 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);
fprintf(OUT, "after bzero addr 0x%p part %d size %d\n",addr, part, size);
ENDDEBUG
addr += part;
size -= part;
@ -79,11 +84,12 @@ end_events() {
ENDDEBUG
}
int acttable(f,actstring)
char *actstring;
FILE *f;
int
acttable(f,actstring)
char *actstring;
FILE *f;
{
static Actindex = 0;
static int Actindex = 0;
extern FILE *astringfile;
extern int pgoption;
@ -138,15 +144,16 @@ FILE *f;
static int Npred=0, Ndefpred=0, Ntrans=0, Ndefevent=0, Nnulla=0;
void
statetable(string, oldstate, newstate, action, event)
char *string;
int action;
struct Object *oldstate, *newstate, *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",
fprintf(OUT,"statetable(0x%p, 0x%p,0x%p, 0x%x)\n",
string, oldstate, newstate, action);
fprintf(OUT,"statetable(%s, %s,%s, 0x%x)\n",
string, oldstate->obj_name, newstate->obj_name, action);
@ -166,14 +173,15 @@ struct Object *oldstate, *newstate, *event;
ENDDEBUG
}
void
stateentry(index, oldstate, newstate, action)
int index, action;
int oldstate, newstate;
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",
fprintf(OUT,"stateentry(0x%x,0x%x,0x%x,0x%x) Statelist@0x%p, val 0x%p\n",
index, oldstate, newstate,action, &Statelist, Statelist);
ENDDEBUG
@ -181,10 +189,11 @@ int oldstate, newstate;
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;
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;
@ -194,7 +203,7 @@ int action, newstate;
if (oe == (struct Object *)0 ) {
Ndefevent ++;
fprintf(stderr, "DEFAULT EVENTS aren't implemented; trans ignored\n");
return;
return (-1);
}
Ntrans++;
IFDEBUG(g)
@ -258,7 +267,7 @@ int action, newstate;
IFDEBUG(g)
fprintf(stdout,
"predtable index 0x%x, transno %d, E 0x%x, S 0x%x\n",
"predtable index 0x%x, transno %d, E 0x%p, S 0x%p\n",
Index, transno, e, s);
ENDDEBUG
@ -269,6 +278,7 @@ int action, newstate;
return Index ;
}
void
printprotoerrs()
{
register int e,s;
@ -285,8 +295,9 @@ printprotoerrs()
}
#ifndef LINT
void
dump_predtable(f)
FILE *f;
FILE *f;
{
struct Predicate *p;
register int e,s, hadapred;
@ -385,7 +396,7 @@ FILE *f;
if (xyz == (struct Predicate *)(-1))
fprintf(f, "-1,");
else
fprintf(f, "0x%x,", Predlist[(e<<Eventshift)+s]);
fprintf(f, "0x%p,", Predlist[(e<<Eventshift)+s]);
}
fprintf(f, " },\n");
}
@ -409,7 +420,7 @@ char *buf;
strcpy(c, buf);
IFDEBUG(z)
fprintf(stdout,"stash %s at 0x%x\n", c,c);
fprintf(stdout,"stash %s at 0x%p\n", c,c);
ENDDEBUG
return(c);
}

View File

@ -1,4 +1,8 @@
/* $NetBSD: procs.h,v 1.4 1994/06/29 06:41:13 cgd Exp $ */
/* $NetBSD: procs.h,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
extern char *stash();
extern void putdriver();
extern void end_events();
extern void statetable();
extern int acttable();
extern struct Object *SameState;

View File

@ -1,4 +1,4 @@
/* $NetBSD: putdriver.c,v 1.4 1994/06/29 06:41:15 cgd Exp $ */
/* $NetBSD: putdriver.c,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* This code is such a kludge that I don't want to put my name on it.
@ -229,9 +229,10 @@ static struct { int start; int finish; } parts[] = {
PART15,
};
void
putdriver(f, x)
FILE *f;
int x;
FILE *f;
int x;
{
register int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sets.c,v 1.5 2001/04/06 11:13:56 wiz Exp $ */
/* $NetBSD: sets.c,v 1.6 2001/06/18 09:57:27 jdolecek Exp $ */
/*
* This code is such a kludge that I don't want to put my name on it.
@ -11,6 +11,10 @@
#include "debug.h"
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <signal.h>
struct Object *CurrentEvent = (struct Object *)0;
struct Object *Objtree;
struct Object dummy;
@ -25,8 +29,12 @@ static FILE *Sfile, *Efile;
extern FILE *astringfile;
char *Noname = "Unnamed set\0";
void dumptree();
void defineitem();
void
initsets(f,s)
FILE *f, *s;
FILE *f, *s;
{
static char errorstring[20];
extern struct Object *SameState;
@ -36,7 +44,7 @@ FILE *f, *s;
IFDEBUG(X)
fprintf(astringfile, "char *%s_sstring[] = {\n", protocol);
ENDDEBUG
sprintf(errorstring, "%sERROR\0", ST_PREFIX);
sprintf(errorstring, "%sERROR", ST_PREFIX);
defineitem(STATESET, errorstring, (char *)0); /* state 0 */
SameState = (struct Object *) Malloc( sizeof (struct Object) );
SameState->obj_kind = OBJ_ITEM;
@ -69,7 +77,7 @@ char *name;
while( p && val ) {
IFDEBUG(o)
fprintf(OUT, "lookup strcmp 0x%x,%s, 0x%x,%s\n",
fprintf(OUT, "lookup strcmp 0x%p,%s, 0x%p,%s\n",
name, name, OBJ_NAME(p), OBJ_NAME(p));
ENDDEBUG
if( p->obj_name == (char *)0 ) {
@ -91,15 +99,16 @@ char *name;
p = NULL;
}
IFDEBUG(o)
fprintf(stdout,"lookup 0x%x,%s returning 0x%x\n",type, name, p);
fprintf(stdout,"lookup 0x%x,%s returning 0x%p\n",type, name, p);
ENDDEBUG
return(p);
}
static int states_done = 0;
void
end_states(f)
FILE *f;
FILE *f;
{
register unsigned n = Nstates;
register int i;
@ -114,7 +123,7 @@ FILE *f;
IFDEBUG(d)
fprintf(OUT, "Eventshift=%d\n", Eventshift);
ENDDEBUG
sprintf(Eventshiftstring, "%d\0",Eventshift);
sprintf(Eventshiftstring, "%d",Eventshift);
fprintf(f, "struct %s_event {\n\tint ev_number;\n", &protocol[0]);
IFDEBUG(X)
/* finish sstring[] & start estring[] */
@ -125,9 +134,9 @@ FILE *f;
int FirstEventAttribute = 1;
static
static void
insert(o)
struct Object *o;
struct Object *o;
{
struct Object *p = Objtree;
struct Object **q = &Objtree;
@ -215,8 +224,9 @@ struct Object *o;
ENDDEBUG
}
void
delete(o)
struct Object *o;
struct Object *o;
{
register struct Object *p = o->obj_right;
register struct Object *q;
@ -224,7 +234,7 @@ struct Object *o;
register struct Object **np_childlink;
IFDEBUG(T)
fprintf(stdout, "delete(0x%x)\n", o);
fprintf(stdout, "delete(0x%p)\n", o);
dumptree(Objtree,0);
ENDDEBUG
@ -245,7 +255,7 @@ struct Object *o;
np_childlink = &(o->obj_parent->obj_right);
}
IFDEBUG(T)
fprintf(OUT, "newparent=0x%x\n");
fprintf(OUT, "newparent=0x%p\n", newparent);
ENDDEBUG
if (q) { /* q gets the left, parent gets the right */
@ -266,7 +276,7 @@ struct Object *o;
p->obj_parent = newparent;
IFDEBUG(T)
fprintf(OUT, "After deleting 0x%x\n",o);
fprintf(OUT, "After deleting 0x%p\n",o);
dumptree(Objtree,0);
ENDDEBUG
}
@ -291,20 +301,21 @@ int keep;
insert( onew );
/* address already stashed before calling defineset */
IFDEBUG(o)
printf("defineset(0x%x,%s) returning 0x%x\n", type , adr, onew);
printf("defineset(0x%x,%s) returning 0x%p\n", type , adr, onew);
dumptree(Objtree,0);
ENDDEBUG
return(onew);
}
void
dumpit(o, s)
char *o;
char *s;
char *o;
char *s;
{
register int i;
IFDEBUG(o)
fprintf(OUT, "object 0x%x, %s\n",o, s);
fprintf(OUT, "object 0x%p, %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) );
@ -312,17 +323,18 @@ IFDEBUG(o)
ENDDEBUG
}
void
defineitem(type, adr, struc)
unsigned char type;
char *adr;
char *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);
printf("defineitem(0x%x, %s at 0x%p, %s)\n", type, adr, adr, struc);
ENDDEBUG
if( onew = lookup( type, adr ) ) {
if((onew = lookup( type, adr ))) {
fprintf(stderr,
"Internal error at defineitem: trying to redefine obj type 0x%x, adr %s\n",
type, adr);
@ -337,17 +349,18 @@ char *struc;
insert( onew );
}
IFDEBUG(o)
fprintf(OUT, "defineitem(0x%x, %s) returning 0x%x\n", type, adr, onew);
fprintf(OUT, "defineitem(0x%x, %s) returning 0x%p\n", type, adr, onew);
ENDDEBUG
}
void
member(o, adr)
struct Object *o;
char *adr;
struct Object *o;
char *adr;
{
struct Object *onew, *oold;
IFDEBUG(o)
printf("member(0x%x, %s)\n", o, adr);
printf("member(0x%p, %s)\n", o, adr);
ENDDEBUG
oold = lookup( o->obj_type, adr );
@ -392,8 +405,9 @@ char *name;
return(o);
}
void
AddCurrentEventName(x)
register char **x;
register char **x;
{
register char *n = EV_PREFIX; ;
@ -417,6 +431,7 @@ register char **x;
}
}
void
dumptree(o,i)
register struct Object *o;
int i;
@ -431,16 +446,16 @@ dumptree(o,i)
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));
fprintf(stdout, "%3d 0x%p: %s\n", i,o, OBJ_NAME(o));
dumptree(o->obj_right, i+1);
}
}
void
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);
@ -448,9 +463,10 @@ dump(c,a)
kill(0, SIGQUIT);
}
void
dump_trans( pred, oldstate, newstate, action, event )
struct Object *oldstate, *newstate, *event;
char *pred, *action;
struct Object *oldstate, *newstate, *event;
char *pred, *action;
{
extern int transno;
struct Object *o;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sets.h,v 1.4 1994/06/29 06:41:17 cgd Exp $ */
/* $NetBSD: sets.h,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
#define MAXEVENTS 200
#define MAXSTATES 200
@ -30,6 +30,10 @@ extern int Nevents, Nstates;
int Eventshift;
extern struct Object *CurrentEvent;
extern struct Object *Lookup();
extern struct Object *lookup();
extern struct Object *defineset();
extern void end_states();
extern struct Object *Lookup();
extern void defineitem();
extern void member();
extern void dump_trans();

View File

@ -1,7 +1,8 @@
/* $NetBSD: xebec.bnf,v 1.4 1994/06/29 06:41:22 cgd Exp $ */
/* $NetBSD: xebec.bnf,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
#include "main.h"
#include "sets.h"
#include "procs.h"
#include <stdio.h>
extern FILE *eventfile_h, *actfile;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xebec.c,v 1.4 1994/06/29 06:41:23 cgd Exp $ */
/* $NetBSD: xebec.c,v 1.5 2001/06/18 09:57:27 jdolecek Exp $ */
#include "xebec.h"
#include "llparse.h"
@ -8,10 +8,12 @@
#include "main.h"
#include "sets.h"
#include "procs.h"
#include <stdio.h>
extern FILE *eventfile_h, *actfile;
void
llaction(lln,token)
LLtoken *token;
{