Changeset 8333


Ignore:
Timestamp:
01/10/05 15:42:52 (17 years ago)
Author:
piso
Message:

Work in progress: (trace foo :break t)

File:
1 edited

Legend:

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

    r7848 r8333  
    22;;;
    33;;; Copyright (C) 2003-2004 Peter Graves
    4 ;;; $Id: trace.lisp,v 1.7 2004-09-29 00:49:25 piso Exp $
     4;;; $Id: trace.lisp,v 1.8 2005-01-10 15:42:52 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    3636
    3737(defun expand-trace (args)
    38   (let ((results ()))
     38  (let ((results ())
     39        (breakp nil))
     40    (let ((index (position :break args)))
     41      (when index
     42        (setf breakp (nth (1+ index) args))
     43        (setf args (append (subseq args 0 index) (subseq args (+ index 2))))))
    3944    (dolist (arg args)
    40       (if (trace-1 arg)
     45      (if (trace-1 arg breakp)
    4146          (push arg results)))
    4247    `',results))
    4348
    44 (defun trace-1 (symbol)
     49(defun trace-1 (symbol breakp)
    4550  (unless (fboundp symbol)
    4651    (error "~S is not the name of a function" symbol))
     
    5156              (lambda (&rest args)
    5257                (with-standard-io-syntax
    53                   (%format t (indent "~D: ~S~%") *trace-depth*
    54                            (append (list symbol) args)))
     58                    (%format t (indent "~D: ~S~%") *trace-depth*
     59                             (append (list symbol) args)))
     60                (when breakp
     61                  (break))
    5562                (incf *trace-depth*)
    5663                (let ((r (multiple-value-list (apply untraced-function args))))
     
    5865                  (with-standard-io-syntax
    5966                    (%format t (indent "~D: ~A returned") *trace-depth* symbol)
    60                     (dolist (val r)
    61                       (%format t " ~S" val))
    62                     (%format t "~%"))
     67                      (dolist (val r)
     68                        (%format t " ~S" val))
     69                      (%format t "~%"))
    6370                  (values-list r)))))
    6471        (setf (symbol-function symbol) trace-function)
Note: See TracChangeset for help on using the changeset viewer.