#include "defs.h" /* * change names of 'un-named' chips to be drawing page no. and coords * change names of 'un-named' wires to page no. and serial no. */ CHAR xvec[] ="abcdefghijklm"; CHAR yvec[]= "pqrstuvwx"; namgen() { REG DL p, q; STRING cf, ct; ITEM page; ITEM nstr; INT x, y, upd, wno; wno = upd = 0; p=dstart; itoa(pagnum(), page); while(p=nexta('Z',p)) { if (p->type != 'w' && p->type != 'c') continue; cf = dln(p)->name; if (*cf != '$') continue; upd = 1; ct = nstr; *ct++ = '$'; cf = page; while (*cf) *ct++ = *cf++; switch(p->type) { case 'c': /* what if no 'a' entry */ q = succa(p); x = q->x >> GSCALE; y = q->y >> GSCALE; q = succa(q); x += q->x >> GSCALE; y += q->y >> GSCALE; x = (x < 64)? 0 : ((x >= 1984)? 119 : ((x - 64) / 16)); y = (y >= 1440)? 89 : (y / 16); *ct++ = xvec[x / 10]; *ct++ = (x % 10) | '0'; *ct++ = yvec[y / 10]; *ct++ = (y % 10) | '0'; break; case 'w': *ct++ = '-'; ct=itoa(wno++, ct); } *ct++ = 0; ct = ctype(p); fixname(p, nstr, ct); } return(upd); }