#include "defs.h" int reading=1; int libflg=0; int fileread; int L2; /* set if ignoring current type */ int skiptype; /* current name modification */ char *qualifier=current; main(argc, argv) INT argc; STRING argv[]; { *qualifier++='/'; if(argc>1) namescan(argc,argv); if(fileread==0) filescan(""); if(libflg==0 && L2==0){ if(lslflg) filescan(Lpinslib); else filescan(pinslib); } reading=0; if(setjmp(badline)==0) prchips(c_head); if(lslflg==0) clr_pin(PINS); elif(L2==0){ /* print out type defs */ l_walk(TYPES); } if(prflg) { print("%E\nHEAP: %u\n", heapnxt); print("%E%s", "\ndefinitions\n"); t_walk(TYPES); print("%E\nchips\n\n"); walk(LCHP); print("%E\nglobal signals\n\n"); walk(ESIG); print("%E\nsignals\n\n"); walk(LSIG); print("%E\nmiscellaneous\n\n"); walk(GENTAG); exit(badflg); } if(L2==0) { prs(".q\n"); if(lslflg) prs(".e\n"); } return(0); } namescan(argc,argv) INT argc; STRING argv[]; { REG STRING cf; while (argc > 1) { if (*argv[1] == '-') { INT F; cf = argv[1]; argv++; argc--; F=0; while (F==0 && *++cf) switch(*cf) { case 'L': lslflg++; setmode(standout, "ust"); break; case 'p': prflg++; break; case 't': tpflg++; break; case 'v': vpflg++; break; case 'l': if(any('/', ++cf)){ filescan(cf); } else{ ITEM L; STRING libp; libp=movstr(libfile, L); movstr(cf, libp); filescan(L); } libflg++; F++; cf="-"; break; default: errmsg(argv[1], "illegal flag\n"); exit(1); } } else { filescan(argv[1]); argc--; argv++; } } } /* * process one file */ filescan(s) STRING s; { FILE f; INT in; STRING s_name; s_name=filename; filename=s; if(*s && (fileread++)==0) print(".f %s\n", s); pushf(&f); in=openf(standin, s, "r"); standin->flin=0; if(in<0) { print("%Ecannot open %s\n", s); exit(1); } if(*s) print("%E%s:\n", s); level++; scan(); level--; popf(); filename=s_name; } scan() { REG CHAR c; REG STRING cf; REG STRING *src; REG STRING s; TAG t; for (;;) { setjmp(badline); src=parse(1); if(src==nil(STRING*))return; if(src==PARSERR) { print("%E%s", "CDL format error\n"); reflect(src); } cf = *src; if ((c = *cf++) == '.') { /* * * command line starts with '.' * */ src++; switch (c = *cf++) { case 'p': /* page heading */ case 'v': case 'k': break; case 'f': case 'F': if(s=src[0]){ while (*s++); s--; if(*--s=='W' && *--s=='.') *s=0; print("NETWORK: \n"); print("CKTNAME: %s;\n", src[0]); } break; case 't': /* chip type definition */ if (c = *cf++) { if(skiptype==0) swtype(src, c); } else nutype(src); break; case 'c': /* chip */ if(*cf == 0) nuchip(src); else swchip(src, *cf); break; case 'l': case 'L': /* chip type signal pin */ L(src); break; case 'H': Ltype(src); break; case 'm': if(lslflg) { Lpin(src); } else{ nudefn(src); } break; case 'G': case 'g': Ldefn(src); L2++; /* 2nd -L pass */ break; case 'e': case 'E': Ldefn(0); break; case 'i': case 'o': nuioc(src,c); break; case 'q': /* quit */ case 'Q': /* quit */ L(src); return; default: errmsg(*(src-1), "unknown command\n"); } } else nusig(src); } } exit(x) { _exit(x); }