1: #include "../h/rt.h" 2: 3: /* 4: * ctrace - procedure *bp is being called with nargs arguments, the first 5: * of which is at arg; produce a trace message. 6: */ 7: ctrace(bp, nargs, arg) 8: struct b_proc *bp; 9: int nargs; 10: struct descrip *arg; 11: { 12: register int n; 13: 14: if (k_trace > 0) 15: k_trace--; 16: showline(file, line); 17: showlevel(k_level); 18: putstr(stderr, STRLOC(bp->pname), STRLEN(bp->pname)); 19: putc('(', stderr); 20: while (nargs--) { 21: outimage(stderr, arg--, 0); 22: if (nargs) 23: putc(',', stderr); 24: } 25: putc(')', stderr); 26: putc('\n', stderr); 27: fflush(stderr); 28: } 29: 30: /* 31: * rtrace - procedure *bp is returning *rval; produce a trace message. 32: */ 33: 34: rtrace(bp, rval) 35: register struct b_proc *bp; 36: struct descrip *rval; 37: { 38: register int n; 39: 40: if (k_trace > 0) 41: k_trace--; 42: showline(file, line); 43: showlevel(k_level); 44: putstr(stderr, STRLOC(bp->pname), STRLEN(bp->pname)); 45: fprintf(stderr, " returned "); 46: outimage(stderr, rval, 0); 47: putc('\n', stderr); 48: fflush(stderr); 49: } 50: 51: /* 52: * ftrace - procedure *bp is failing; produce a trace message. 53: */ 54: 55: ftrace(bp) 56: register struct b_proc *bp; 57: { 58: register int n; 59: 60: if (k_trace > 0) 61: k_trace--; 62: showline(file, line); 63: showlevel(k_level); 64: putstr(stderr, STRLOC(bp->pname), STRLEN(bp->pname)); 65: fprintf(stderr, " failed"); 66: putc('\n', stderr); 67: fflush(stderr); 68: } 69: 70: /* 71: * strace - procedure *bp is suspending *rval; produce a trace message. 72: */ 73: 74: strace(bp, rval) 75: register struct b_proc *bp; 76: struct descrip *rval; 77: { 78: register int n; 79: 80: if (k_trace > 0) 81: k_trace--; 82: showline(file, line); 83: showlevel(k_level); 84: putstr(stderr, STRLOC(bp->pname), STRLEN(bp->pname)); 85: fprintf(stderr, " suspended "); 86: outimage(stderr, rval, 0); 87: putc('\n', stderr); 88: fflush(stderr); 89: } 90: 91: /* 92: * atrace - procedure *bp is being resumed; produce a trace message. 93: */ 94: 95: atrace(bp) 96: register struct b_proc *bp; 97: { 98: register int n; 99: 100: if (k_trace > 0) 101: k_trace--; 102: showline(file, line); 103: showlevel(k_level); 104: putstr(stderr, STRLOC(bp->pname), STRLEN(bp->pname)); 105: fprintf(stderr, " resumed"); 106: putc('\n', stderr); 107: fflush(stderr); 108: } 109: 110: /* 111: * showline - print file and line number information. 112: */ 113: static showline(f, l) 114: char *f; 115: int l; 116: { 117: if (l > 0) 118: fprintf(stderr, "%.10s: %d\t", f, l); 119: else 120: fprintf(stderr, "\t\t"); 121: } 122: 123: /* 124: * showlevel - print "| " n times. 125: */ 126: static showlevel(n) 127: register int n; 128: { 129: while (n-- > 0) { 130: putc('|', stderr); 131: putc(' ', stderr); 132: } 133: }