--- xinu/con/config.y 2018/04/24 17:39:04 1.1 +++ xinu/con/config.y 2018/04/24 17:40:15 1.1.1.2 @@ -7,15 +7,10 @@ #define CONFIGC "../sys/conf.c" /* name of .c output */ #define CONFIGH "../h/conf.h" /* name of .h output */ -#define DISPCONF "../h/dispconf.h" /* name of dispatcher .h*/ -#define IODISP "../h/iodisp.h" /* name of dispat loc .h*/ -#define CONFHREF "" /* how conf.h referenced*/ #define CONFIGIN "Configuration" /* name of input file */ FILE *confc; FILE *confh; -FILE *dispconf; -FILE *iodisp; char *dbstr; extern char *malloc(); @@ -64,10 +59,8 @@ typedef struct dvtype *dvptr; dvptr currtype = NIL; char *ftout[] = - {"#ifndef\tASM\n", - "struct\tdevsw\t{\t\t\t/* device table entry */\n", + {"struct\tdevsw\t{\t\t\t/* device table entry */\n", "\tint\tdvnum;\n", - "\tchar\t*dvname;\n", "\tint\t(*dvinit)();\n", "\tint\t(*dvopen)();\n", "\tint\t(*dvclose)();\n", @@ -86,8 +79,7 @@ char *ftout[] = "\tint\tdvminor;\n", "\t};\n\n", "extern\tstruct\tdevsw devtab[];", - "\t\t/* one entry per device */\n", - "#endif\n\n", + "\t\t/* one entry per device */\n\n", NULL}; %} %% @@ -228,23 +220,11 @@ main(argc, argv) fprintf(stderr, "Can't write on %s\n", CONFIGH); exit(1); } - if ( (dispconf=fopen(DISPCONF,"w") ) == NULL) { - fprintf(stderr, "Can't write on %s\n",DISPCONF); - exit(1); - } - if ( (iodisp=fopen(IODISP,"w") ) == NULL) { - fprintf(stderr, "Can't write on %s\n",IODISP); - exit(1); - } fprintf(confh, "/* conf.h (GENERATED FILE; DO NOT EDIT) */\n"); fprintf(confc, "/* conf.c (GENERATED FILE; DO NOT EDIT) */\n"); - fprintf(dispconf, - "/* dispconf.h (GENERATED FILE; DO NOT EDIT) */\n"); - fprintf(iodisp, - "/* iodisp.h (GENERATED FILE; DO NOT EDIT) */\n"); - fprintf(confc, "\n#include %s\n", CONFHREF); + fprintf(confc, "\n#include \"%s\"\n", CONFIGH); fprintf(confh, "\n#define\tNULLPTR\t(char *)0\n"); @@ -253,8 +233,7 @@ main(argc, argv) fprintf(confh,"\n/* Device table declarations */\n"); for (i=0 ; (p=ftout[i])!=NULL ; i++) fprintf(confh, "%s", p); - fprintf(dispconf,"\n/* vector-to points for each device */\n\n"); - fprintf(iodisp,"\n/* i/o dispatch vector-to location externs */\n\n"); + /* write device declarations and definitions; count type refs. */ fprintf(confh, "\n/* Device name definitions */\n\n"); @@ -294,30 +273,18 @@ main(argc, argv) } fprintf(confh, "/* Declarations of I/O routines referenced */\n\n"); - fprintf(confh, "#ifndef\tASM\n"); for (i=0 ; i 0) { + if (ndevs > 0) fprintf(confc, "struct\tdevsw\tdevtab[NDEVS] = {\n"); - fprintf(confc, "\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", - "/* Format of entries is:", - "device-number, device-name,", - "init, open, close,", - "read, write, seek,", - "getc, putc, cntl,", - "device-csr-address, input-vector, output-vector,", - "iint-handler, oint-handler, control-block, minor-device,", - "*/"); - } for (fcount=0,s=devs ; s!=NIL ; s=s->dvnext,fcount++) { - fprintf(confc, "\n/* %s is %s */\n\n",s->dvname,s->dvtname); - fprintf(confc, "%d, \"%s\",\n", fcount, s->dvname); + fprintf(confc, "\n/* %s */\n", s->dvname, s->dvtname); + fprintf(confc, "%d,\n", fcount); fprintf(confc, "%s, %s, %s,\n", s->dvinit, s->dvopen, s->dvclose); fprintf(confc, "%s, %s, %s,\n", @@ -333,20 +300,6 @@ main(argc, argv) else fprintf(confc, "\n\t};"); } - for (i=0; i