; File: DEBUG.LSP (c) 08/15/85 Soft Warehouse, Inc. (LOOP (PRIN1 '*) (EVAL (READ)) ((NULL RDS)) ) (DEFUN TRACE LST (STUB 'TRACE LST) ) (DEFUN BRK LST (STUB 'BRK LST) ) (DEFUN CLEAR LST (UNSTUB LST) ) (DEFUN HISTORY ( LST) (SETQ! LST (CAR! HISTORY)) (LOOP! ((EQ! LST)) ( ((EQ! (CAR! LST))) (APPLY! (CAR! (CAR! LST)) (CDR! (CAR! LST))) ) (POP! LST) ) ) (SETQ HISTLEN 15) (DEFUN BACKTRACE ( LST) (SETQ! LST (REVERSE! BTRLIST)) (LOOP! ((EQ! LST)) (APPLY! PRTCALL! (LIST! (CAR! (CAR! LST)) (CDR! (POP! LST)))) ) ) (DEFUN STUB (FLAG LST NAM NAM$) (SET FLAG T) (SETQ NAM$ T) (LOOP ((ATOM LST) NAM$) (SETQ NAM (POP LST)) ( ((NOT (GETD NAM T)) (SETQ NAM$) (PRIN1 NAM) (WRITE-LINE " is undefined") ) (FLAG FLAG NAM) ((TRACED NAM)) (PUT NAM 'DEBUG (CONS! (PACK* NAM '!) (COND ((NUMBERP (GETD NAM)) NIL) ((CADR (GETD NAM))) ))) (MOVD NAM (CAR! (GET NAM 'DEBUG))) (PUTD NAM (LIST (IF (EQ (GETD NAM T) 'SPECIAL) 'NLAMBDA (GETD NAM T)) 'ARGLST! (LIST 'TRACE! NAM))) ) ) ) (DEFUN TRACED (NAM) (EQ (CAR (CADDR (GETD NAM))) 'TRACE!) ) (DEFUN UNSTUB (LST NAM) (SETQ LEVELCOUNT 0) (RPLACD 'LEVELCOUNT) (SETQ BTRLIST) (LOOP ((ATOM LST)) (SETQ NAM (POP LST)) ( ((GET NAM 'DEBUG) (REMFLAG 'BRK NAM) (REMFLAG 'TRACE NAM) (MOVD (CAR! (GET NAM 'DEBUG)) NAM) (REMPROP NAM 'DEBUG) ) ) ) ) (DEFUN TRACE! (NLAMBDA (NAM! LST!) ( ((AND! (EQ! LEVELCOUNT 0) RATOM) (SETQ! RATOM) (SETQ! HISTORY) (SETQ! CALLCOUNT 0) (RPLACD! 'CALLCOUNT) (SETQ! MAXLEVELCOUNT 0) (RPLACD! 'MAXLEVELCOUNT) ) ) (PUTADD! 'CALLCOUNT NAM!) (PUTADD! 'LEVELCOUNT NAM!) ( ((