Changeset 4819


Ignore:
Timestamp:
11/18/03 01:15:12 (18 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/trace.lisp

    r4803 r4819  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: trace.lisp,v 1.2 2003-11-17 15:22:50 piso Exp $
     4;;; $Id: trace.lisp,v 1.3 2003-11-18 01:15:12 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    3939    `',results))
    4040
     41(defparameter *trace-depth* 0)
     42
    4143(defun trace-1 (symbol)
    4244  (unless (fboundp symbol)
     
    4446  (when (member symbol *traced-functions*)
    4547    (format t "~S is already being traced." symbol))
    46   (let* ((depth 0)
    47          (untraced-function (symbol-function symbol))
     48  (let* ((untraced-function (symbol-function symbol))
    4849         (trace-function
    4950          (lambda (&rest args)
    50             (format t (indent "~D: ~S~%" depth) depth
     51            (format t (indent "~D: ~S~%") *trace-depth*
    5152                    (append (list symbol) args))
    52             (incf depth)
     53            (incf *trace-depth*)
    5354            (let ((r (multiple-value-list (apply untraced-function args))))
    54               (decf depth)
    55               (format t (indent "~D: ~A returned" depth) depth symbol)
     55              (decf *trace-depth*)
     56              (format t (indent "~D: ~A returned") *trace-depth* symbol)
    5657              (dolist (val r)
    5758                (format t " ~S" val))
     
    6364    symbol))
    6465
    65 (defun indent (string depth)
     66(defun indent (string)
    6667  (concatenate 'string
    67                (make-string (* (1+ depth) 2) :initial-element #\space)
     68               (make-string (* (1+ *trace-depth*) 2) :initial-element #\space)
    6869               string))
    6970
Note: See TracChangeset for help on using the changeset viewer.