diff --git a/include/graphics/mylib.h b/include/graphics/mylib.h index 8b81559f5a1dd9b7aa9e36959843b56a57785b60..f15b2864a523732eb198f12e6503a4ea2950ba76 100644 --- a/include/graphics/mylib.h +++ b/include/graphics/mylib.h @@ -98,7 +98,6 @@ int m_autoraise; void m_init_screen (); void m_init_colors (); -void m_init_pen (int); void m_init_graphics (); void m_clear (); void m_clip (int, int, int, int); diff --git a/include/logglobals.h b/include/logglobals.h index 00a5dc361285639435f72e809c279722fea89de9..b5810ed994b6ac2cbafa02aea8da94b927a37b3c 100644 --- a/include/logglobals.h +++ b/include/logglobals.h @@ -142,8 +142,6 @@ extern char *librgroupnames[9]; extern short refrtimer, refrtimer0; /* Time until screen is refreshed */ -extern long tabletaddr; - extern char *dumpfname, *tracefname; extern FILE *tracefile; diff --git a/src/configreader.c b/src/configreader.c index 3cce8bcfe2a03f3cd515716ab8ab277fe63e5bfd..fb0d2b9219d247e65029fc0fc9d15f16d24ccdf8 100644 --- a/src/configreader.c +++ b/src/configreader.c @@ -230,11 +230,6 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) continue; } - if (!strcmp(LINK->cmdbuf, "TABLET")) - { - tabletaddr = getint(txbuf, tabletaddr); - continue; - } if (!strcmp(LINK->cmdbuf, "MENU")) { getword(txbuf, txarg); diff --git a/src/graphics/mylib.c b/src/graphics/mylib.c index 70258df8bab5d49e847ebe8d4b15e724ff31023f..bb30287b23cb66f2ecaa1f63ab96bea64fa3fd1d 100644 --- a/src/graphics/mylib.c +++ b/src/graphics/mylib.c @@ -1369,13 +1369,6 @@ void m_init_colors() m_choosecolors(0); } -void m_init_pen(hpib_address) -int hpib_address; -{ - Mfprintf(stderr, "m_init_pen(%d)\n", hpib_address); -} - - /// These are internal routines to do better buffering #ifdef EXTRA_BUFFERING #define BUF_SIZE 1024 diff --git a/src/log.c b/src/log.c index ce6720b1089e66801ede3636f52fe5bf800da7f5..290ea1104843524904087d878a0d8650ec80d9e0 100644 --- a/src/log.c +++ b/src/log.c @@ -222,8 +222,6 @@ char *librgroupnames[9]; short refrtimer; ///< Time until screen is refreshed short refrtimer0; ///< Time until screen is refreshed -long tabletaddr; - char *dumpfname; char *tracefname; FILE *dumpfile; @@ -366,8 +364,8 @@ static log_krec *peninkind(short xx, short yy) } /** @brief Find which wire, pin, or gate the Probe is touching - and set PROBENODE or PROBEGATE to its address. -*/ + and set PROBENODE or PROBEGATE to its address. + */ void testprobe(short xx, short yy) { log_grec *g; @@ -628,26 +626,26 @@ void resetmessages() } /** @brief Debug function to show current number of events received - and current simulation time. -*/ + and current simulation time. + */ void show_events() { /*zEMBED - char buf[30]; - int m_events_received; - static int old_events, old_serial, old_time; - int serial, time = timers_sysclock() / 200; - sprintf(buf, "%d", m_events_received); - m_color(log_red); - if (m_events_received > old_events) - drawstr2(5, 20, buf); - old_events = m_events_received; - sprintf(buf, "%d", serial = XNextRequest(m_display)); - if (serial > old_serial && time != old_time) - drawstr2(5, 29, buf), - old_serial = serial + 2, - old_time = time; - */ + char buf[30]; + int m_events_received; + static int old_events, old_serial, old_time; + int serial, time = timers_sysclock() / 200; + sprintf(buf, "%d", m_events_received); + m_color(log_red); + if (m_events_received > old_events) + drawstr2(5, 20, buf); + old_events = m_events_received; + sprintf(buf, "%d", serial = XNextRequest(m_display)); + if (serial > old_serial && time != old_time) + drawstr2(5, 29, buf), + old_serial = serial + 2, + old_time = time; + */ } #define spacing 10 @@ -728,7 +726,7 @@ void tracemessage(char *msg) do { sprintf(tracefname, "/tmp/%.10s%03ld", - cuserid(NULL), rand() % 1000L); + cuserid(NULL), rand() % 1000L); } while (access(tracefname, F_OK) == 0); } @@ -907,8 +905,8 @@ static void historypointy(log_hnrec *hn, log_htrec *ht, short *y) /** @brief Make one simulation pass through the circuit. - For each page, call the simulator(s) and do other simulation-related chores. -*/ + For each page, call the simulator(s) and do other simulation-related chores. + */ void pass() { log_grec *g, *g1, *g2; @@ -1653,10 +1651,10 @@ void garbagecoll() /** @brief Find the number associated with a signal name. - If it doesn't exist, create it. - If not enough room, issue an error and - return zero. -*/ + If it doesn't exist, create it. + If not enough room, issue an error and + return zero. + */ short getsignal(int d, char *n_) { char n[256]; @@ -2544,8 +2542,8 @@ static int bufissmall(baseptrs *bases) /** @brief Cut or Copy all gates/wires/solder points in a rectangular area. - Previous contents of Copy buffer are lost. -*/ + Previous contents of Copy buffer are lost. + */ static void cutcopy(baseptrs *bases, short x1, short y1, short x2, short y2, int cut, int tap) { log_grec *g, *g1, *g2; @@ -3261,10 +3259,10 @@ static void xororiginal() /** @brief Enter Paste mode. - When cursor is pressed,a dd a copy of all gates/wires in Copy buffer at the pen position. + When cursor is pressed,a dd a copy of all gates/wires in Copy buffer at the pen position. - If the pen is held still, XOR a picture of what would be added if pen is pressed. -*/ + If the pen is held still, XOR a picture of what would be added if pen is pressed. + */ static void pastecommand(long movemode) { short thepage; @@ -3423,8 +3421,8 @@ static void copycommand() /** @brief Enter Move mode. - Sweep out an area, then move all objects in that area to a new position. -*/ + Sweep out an area, then move all objects in that area to a new position. + */ static void movecommand(int waitflag) { short x1, y1, x2, y2; @@ -4030,8 +4028,8 @@ static void xorrect(short x1, short y1, short x2, short y2) /// Open space horizontally. /** - This means "put everything aside horizontally." -*/ + This means "put everything aside horizontally." + */ static void openhoriz() { log_grec *g; @@ -4198,8 +4196,8 @@ static void xorrect_(short x1, short y1, short x2, short y2) /// Open space vertically. /** - This means "put everything aside vertically." -*/ + This means "put everything aside vertically." + */ static void openvert() { log_grec *g; @@ -5288,10 +5286,10 @@ static short kfunc(short *i, short *j, struct LOC_listlibrary *LINK) /** @brief List the gates available in the library. - - + or space bar displays next page; - - - displays previous page; - - anything else returns to Instructions. -*/ + - + or space bar displays next page; + - - displays previous page; + - anything else returns to Instructions. + */ static void listlibrary() { struct LOC_listlibrary V; @@ -7432,7 +7430,6 @@ static void recov(struct LOC_doshellescape *LINK) if (m_maxcolor != LINK->oldc) initcolormap(); - m_init_pen(tabletaddr); initcolors(); refrwindow(); } @@ -10043,9 +10040,9 @@ static void statusdisplay(char *name_) /** @brief Process a pop-up menu selection. - Menu items are named in MENU. - Use result to look up in table S to find a char. -*/ + Menu items are named in MENU. + Use result to look up in table S to find a char. + */ static void popupmenu(short num) { short i, j, x, y, xx, x0, y0, x1, y1, x00, y00; @@ -10220,7 +10217,7 @@ static void setcmap(short n, short r, short g, short b) } -static void getcolor(char *name_, short *val, short def) +static void getcolor(char *name_, short *val, short default_color) { char name[256]; strlist_t *cp; @@ -10233,7 +10230,7 @@ static void getcolor(char *name_, short *val, short def) if (cp != NULL) *val = (long)cp->value; else - *val = reducecolor8(def); + *val = reducecolor8(default_color); } static void initcolors() @@ -10364,31 +10361,34 @@ static void echomacro(char key) static void definemacro(char key, char *name) { - macrorec *mp, *mp2, *mp3; + macrorec *current, *last, *new; - mp2 = NULL; - mp = macrobase; - while (mp != NULL && mp->key < key) + last = NULL; + current = macrobase; + while (current != NULL && current->key < key) { - mp2 = mp; - mp = mp->next; + last = current; + current = current->next; } - mp3 = (macrorec *)Malloc(sizeof(macrorec)); - if (mp != NULL && mp->key == key) + + new = (macrorec *)Malloc(sizeof(macrorec)); + new->key = key; + strcpy(new->name, name); + + if (current != NULL && current->key == key) { - mp3->next = mp->next; - Free(mp); - } else + new->next = current->next; + Free(current); + } + else { - mp3->next = mp; + new->next = current; } - if (mp2 == NULL) - macrobase = mp3; + if (last == NULL) + macrobase = new; else - mp2->next = mp3; - mp3->key = key; - strcpy(mp3->name, name); + last->next = new; } @@ -10444,10 +10444,8 @@ static void definemenu(short num, short part, char *name, char *cmd, short bool_ } } - typedef char cnamearray[16][8]; - const cnamearray cnames = { "GRAY", "RED", "GREEN", "YELLOW", "MRED", "ORANGE", "CYAN", "WHITE", @@ -11227,10 +11225,10 @@ static void inithooks() #define rtn "INITIALIZE" /** @brief Initialize all variables. - Read basic gates from library. - Clear catalog window. - Initialize global data structures. -*/ + Read basic gates from library. + Clear catalog window. + Initialize global data structures. + */ static void initialize() { struct LOC_initialize V; @@ -11238,7 +11236,7 @@ static void initialize() short i, k, curgate; short gptr[maxgatesfiles], ggroup[maxgatesfiles], gsize[maxgatesfiles]; char gname[maxgatesfiles][9]; - strlist_t *l1, *l2; + strlist_t *l1; char s[256]; int flag; char cnfname[256]; @@ -11280,7 +11278,6 @@ static void initialize() m_set_display_name(swtab[7].UU.s); } - tabletaddr = 0; gg.curstamp = 0; initwindow2(); initcolormap(); @@ -11315,28 +11312,26 @@ static void initialize() *gg.actstr = '\0'; gg.maxsignal = defmaxsignal; strlist_init(&histlbl); - l2 = strlist_append(&histlbl, "Scope mode"); - l2 = strlist_append(&histlbl, ""); - l2 = strlist_append(&histlbl, - "VContinuous,On Reset,Triggered,Manual:Type of trigger:"); - l2 = strlist_append(&histlbl, "Triggered;C(none):Trigger signal:"); - l2 = strlist_append(&histlbl, "On Reset;OUs:Time to start trigger:"); - l2 = strlist_append(&histlbl, "On Reset;OUs:Time to stop trigger:"); - l2 = strlist_append(&histlbl, - "VTrigger off,Simulation off:Action when memory full:"); - l2 = strlist_append(&histlbl, ""); - l2 = strlist_append(&histlbl, "Us:Minimum timestep:"); - l2 = strlist_append(&histlbl, "Us:Maximum timestep:"); - l2 = strlist_append(&histlbl, "I100000:Timestep memory limit:"); - l2 = strlist_append(&histlbl, "I:Timestep memory size:"); - l2 = strlist_append(&histlbl, ""); - l2 = strlist_append(&histlbl, "BY:Align signal names?"); - l2 = strlist_append(&histlbl, ""); - l2 = strlist_append(&histlbl, "Us,0:Time at left edge:"); - l2 = strlist_append(&histlbl, "Us:Current time:"); - l2 = strlist_append(&histlbl, ""); - l2 = strlist_append(&histlbl, "Us,100us:Seconds per division:"); - l2 = strlist_append(&histlbl, "Us:Current timestep:"); + strlist_append(&histlbl, "Scope mode"); + strlist_append(&histlbl, ""); + strlist_append(&histlbl, "VContinuous,On Reset,Triggered,Manual:Type of trigger:"); + strlist_append(&histlbl, "Triggered;C(none):Trigger signal:"); + strlist_append(&histlbl, "On Reset;OUs:Time to start trigger:"); + strlist_append(&histlbl, "On Reset;OUs:Time to stop trigger:"); + strlist_append(&histlbl, "VTrigger off,Simulation off:Action when memory full:"); + strlist_append(&histlbl, ""); + strlist_append(&histlbl, "Us:Minimum timestep:"); + strlist_append(&histlbl, "Us:Maximum timestep:"); + strlist_append(&histlbl, "I100000:Timestep memory limit:"); + strlist_append(&histlbl, "I:Timestep memory size:"); + strlist_append(&histlbl, ""); + strlist_append(&histlbl, "BY:Align signal names?"); + strlist_append(&histlbl, ""); + strlist_append(&histlbl, "Us,0:Time at left edge:"); + strlist_append(&histlbl, "Us:Current time:"); + strlist_append(&histlbl, ""); + strlist_append(&histlbl, "Us,100us:Seconds per division:"); + strlist_append(&histlbl, "Us:Current timestep:"); parselabel(&histlbl, &histnumattrs, &histkattr); newattrs(&histgattr, histnumattrs, histkattr); gg.singlestepcount = 0; @@ -11435,21 +11430,21 @@ static void initialize() if (P_argc > 1) { sprintf(STR2, "LOAD %s", P_argv[1]); - l2 = strlist_append(&thingstodo, STR2); + strlist_append(&thingstodo, STR2); FORLIM = P_argc; for (i = 2; i < FORLIM; i++) { sprintf(STR3, "PAGE %d", i); - l2 = strlist_append(&thingstodo, STR3); + strlist_append(&thingstodo, STR3); sprintf(STR3, "LOAD %s", P_argv[i]); - l2 = strlist_append(&thingstodo, STR3); + strlist_append(&thingstodo, STR3); } displaynews = false; } if (swtab[6].used > 0 && *swtab[6].UU.s != '\0') { sprintf(STR3, "TOOL %s", swtab[6].UU.s); - l2 = strlist_append(&thingstodo, STR3); + strlist_append(&thingstodo, STR3); displaynews = false; justonecommand = true; } @@ -11457,15 +11452,6 @@ static void initialize() { justonecommand = false; } - TRY(try34); - m_init_pen(tabletaddr); - RECOVER(try34); - if (P_escapecode == -20) - _Escape(P_escapecode); - beginfatal(); - nc_printf("Can't find graphics tablet!\n"); - endfatal(); - ENDTRY(try34); if (gatefilenames == NULL) addgatesfile("log", &V); idxsize = 0; @@ -11755,6 +11741,8 @@ static void cleanlog() { for(int i = 0; i < log_maxpages; ++i) pageFree(&gg.pages[i]); + free(lognewsname); + free(loghelpname); } @@ -11797,10 +11785,10 @@ static void shownews() /** @brief Initialize. - Then Process pen: Add gates. Add wires and solder them. - Refresh window when necessary. - Process keyboard and menu areas. -*/ + Then Process pen: Add gates. Add wires and solder them. + Refresh window when necessary. + Process keyboard and menu areas. + */ int main(int argc, char * argv[]) { char str1[81]; @@ -11818,8 +11806,8 @@ int main(int argc, char * argv[]) gg.dumpopen = false; excpline = -1; - for (long i = 1; i <= maxgatesfiles; i++) - libf1[i - 1] = NULL; + for (long i = 0; i < maxgatesfiles; i++) + libf1[i] = NULL; TRY(try40); initialize(); diff --git a/src/pen.c b/src/pen.c index 71302589b7182f326284c8910da610c5c0ab7e83..9540815033541b7cad003baa8392f508be1dc4a3 100644 --- a/src/pen.c +++ b/src/pen.c @@ -62,7 +62,6 @@ void pen() if (P_escapecode == -20) _Escape(P_escapecode); nc_printf("Graphics tablet error\n"); - m_init_pen(tabletaddr); m_alpha_on(); ENDTRY(try3); if (snapflag && gg.incircuit) diff --git a/src/utils/p2c.c b/src/utils/p2c.c index 6d6cef2fe145b4ba866b2922674e9e7fd2fe5780..ff4af81243cdb86698c91013aaff578bfb70aada 100644 --- a/src/utils/p2c.c +++ b/src/utils/p2c.c @@ -22,8 +22,6 @@ int bigendian; long EXCP_LINE; /* Used by Pascal workstation system */ -void* __MallocTemp__; - __p2c_jmp_buf *__top_jb;