leres@surf.ee.lbl.gov (Craig Leres) (12/22/89)
I recently tried Mike Rendell's tag stack code on a sparc and it core dumped pretty quickly. The problem is that a word alignment calculation is broken. Appended are context diffs that fix this problem and also implements a new "stack" command that displays what's on the tags stack (crude but effective). Craig ------ RCS file: RCS/ex_tagio.c,v retrieving revision 1.3 diff -c -r1.3 ex_tagio.c *** /tmp/,RCSt1a03612 Thu Dec 21 22:18:42 1989 --- ex_tagio.c Thu Dec 21 22:17:18 1989 *************** *** 143,149 **** /* See how much space we will need */ len = sizeof(Tstack) + strlen(fname) + 1; /* keep things word aligned */ ! len += len & 3; if (tstack_ptr + len >= &tstack_mem[TSTACKMEMSIZE]) { lprintf("[Tag stack full] "); return; --- 143,149 ---- /* See how much space we will need */ len = sizeof(Tstack) + strlen(fname) + 1; /* keep things word aligned */ ! len += (~len + 1) & 3; if (tstack_ptr + len >= &tstack_mem[TSTACKMEMSIZE]) { lprintf("[Tag stack full] "); return; *************** *** 241,246 **** --- 241,264 ---- if (ospeed > B300) hold |= HOLDWIG; return; + } + + tag_list() + { + Tstack *ts; + int multiple; + + if (tstack == 0) + return; + eol(); + multiple = (tstack->t_prev != 0); + if (inopen && multiple) + pofix(); + for (ts = tstack; ts; ts = ts->t_prev) { + ex_printf("%-7d %s", ts->t_dot, ts->t_file); + if (!inopen || multiple) + putNFL(); + } } #endif #endif RCS file: RCS/ex_cmds.c,v retrieving revision 1.2 diff -c -r1.2 ex_cmds.c *** /tmp/,RCSt1a03428 Thu Dec 21 21:38:49 1989 --- ex_cmds.c Thu Dec 21 00:13:42 1989 *************** *** 410,416 **** switch (peekchar()) { case 'u': ! #ifdef TAGSTACK /* push */ ignchar(); if (peekchar() == 's') { --- 410,416 ---- switch (peekchar()) { case 'u': ! #ifdef TAGSTACK /* push */ ignchar(); if (peekchar() == 's') { *************** *** 429,438 **** } /* put */ tail2of("put"); ! #else /* TAGSTACK */ /* put */ tail("put"); ! #endif /* TAGSTACK */ setdot(); c = cmdreg(); eol(); --- 429,438 ---- } /* put */ tail2of("put"); ! #else /* put */ tail("put"); ! #endif setdot(); c = cmdreg(); eol(); *************** *** 457,463 **** tail2of("print"); break; ! #ifdef TAGSTACK case 'o': /* pop */ { --- 457,463 ---- tail2of("print"); break; ! #ifdef TAGSTACK case 'o': /* pop */ { *************** *** 474,480 **** nochng(); continue; } ! #endif TAGSTACK default: tail("print"); --- 474,480 ---- nochng(); continue; } ! #endif default: tail("print"); *************** *** 628,634 **** --- 628,645 ---- #ifdef SIGTSTP /* stop, suspend */ case 't': + #ifdef TAGSTACK + ignchar(); + if (peekchar() == 'a') { + tail2of("stack"); + setnoaddr(); + tag_list(); + continue; + } + tail2of("stop"); + #else tail("stop"); + #endif goto suspend; case 'u': tail("suspend");