#include "../cda.h" #include "../dl.h" #include "../libtk.h" #include "../libwe.h" #include "../pl.h" /* incorporate placement data into drawing files */ /* Standard input is the placement information in CDL. * * * flags are * -h make all soft assignments into hard assignments. * -s make all hard assignments into soft assignments. * The program only inserts assignment changes into the drawings. * -t Instead of updating the graphics file it is drawn on the 4014 */ INT file; /* work space file */ SYMTAB1 symbol; /* values for symbol->type */ #define T_HARD 1 #define T_SOFT 2 #define T_NOPLAC 4 INT fflag; /* set if soft placement allowed */ INT tflag; /* set if display result rather than update files */ INT page; main(argc, argv) int argc; char *argv[]; { int i; STRING c; textmode++; fflag = 0; tflag = 0; while (argc > 1 && *argv[1] == '-') { c = &argv[1][1]; while (*c) switch (*c++) { case 'h': fflag = T_HARD; continue; case 's': fflag = T_SOFT; continue; case 'r': tflag++; continue; default: print("%E%s: illegal flag\n", argv[1]); exit(1); } argc--; argv++; } openf(standin, "", "r"); file=maketmp(2); if (file < 0) { print("%Ecannot create temp file\n"); exit(1); } /* read placement data once */ rdplac(); for (i = 0; ++i < argc;) { ITEM fn; STRING ct; print("%s:\n", argv[1]); ct = movstr(argv[1], fn); if ((*--ct != 'g') || (*--ct != '.')) page = 0; else { *ct-- = 0; while(digit(*ct)) ct--; page = atoi(++ct); } putplac(argv[1]); if (tflag) { fixtty(1); dispfile(argv[1]); fixtty(0); } else { output(argv[1]); } argv++; } } rdplac() { int cset; REG CHAR c; REG CHAR *cf, *ct; REG CHAR **src; cset = 0; for (;;) { src=parse(1); if(src==nil(STRING*)) return; if(src==PARSERR) print("%Eline %d: bad CDL\n",linepos(standin)); cf = *src++; if (*cf++ != '.') { continue; } switch(*cf++) { case 'c': switch(c = *cf) { case 0: ct = symbol->nm; cf = *src; while(*cf && (ct < endof(symbol->nm))) *ct++ = *cf++; while(ct < endof(symbol->nm)) *ct++ = 0; cset = 1; continue; case 'h': case 's': case 'u': if (cset == 0) continue; cset = 0; if (fflag && c != 'u') symbol->type = fflag; else symbol->type = (c == 'h')? T_HARD : ((c == 'u')? T_NOPLAC: T_SOFT); symbol->value.v_int = geti(*src++); write(file,adr(symbol),sizeof symbol); continue; } default: continue; } } } /* sequence to update one drawing file */ putplac(s) STRING s; { REG DL cptr; STRING ct; ITEM sname; input(s); Lseek(file, 0L, 0); scansym(symbol) { if (cptr = findname('c',symbol->nm)) { itoa(symbol->value.v_int, sname); if (symbol->type & T_SOFT) { ct = sname; *ct++ = '('; ct = itoa(symbol->value.v_int, ct); *ct++ = ')'; *ct = 0; } elif (symbol->type & T_NOPLAC) { ct = sname; *ct++ = '-'; ct = itoa(symbol->value.v_int, ct); *ct = 0; } boardpos(cptr,sname); } } } error(s) STRING s; { if (tflag) { fixtty(1); textat(point(0,750),s); full(); fixtty(0); } print("%Edraw-u: %s\n", s); exit(1); } dispfile(f) char *f; { REG INT atx; erase(); atx = 512 - 4*upbstr(f); textat(point(atx, 750), f); redraw(nil(DL)); textat(point(0, 750), ""); full(); }