guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add new print style for repl trace


From: Nala Ginrut
Subject: [PATCH] Add new print style for repl trace
Date: Tue, 28 Feb 2012 18:19:51 +0800

hi folks!
I got extremely painful when I's tracing a complicated procedure. So I decided to do something to alleviate this pain.
And I added a new print style for the REPL trace. It'll show level count number instead lots of "|  |  |......" which makes me drag my console window very very long. But this patch won't eliminate all the tracing pains as all guys think. 
And Andy Wingo encourage me to make this count style as default, so I did. Anyway, there's an option for old style I'll show you later.

here is a example for this patch:
------------------count style (default)--------------------
scheme@(guile-user)> ,trace (format #t "~a" 1) 
trace: 1: (#<procedure a2b94d0> #(#<directory (guile-user) a13a630> #f #f))
trace: 1: #(#<directory (guile-user) a13a630> format "~a")
trace: (#<procedure a30ff70 at <current input>:1:0 ()>)
trace: (#<procedure a291470 at ice-9/format.scm:1612:9 (destination format-string . args) | (deprecated-forma…> …)
trace: 1: (string? #t)
trace: 1: #f
trace: (format #t "~a" 1)
trace: 1: (string? "~a")
trace: 1: #t
trace: 1: (boolean? #t)
trace: 1: #t
trace: 1: (b #<autoload (ice-9 i18n) a29df78> current-output-port #f)
trace: 2: (memq current-output-port (%global-locale number->locale-string))
trace: 2: #f
...
trace: 3: (list-ref (1) 0)
trace: 3: 1
trace: 3: (format:out-obj-padded #f 1 #f ())
trace: 4: (with-output-to-string #<procedure a5d2cb0 at ice-9/format.scm:782:44 ()>)
trace: 4: (call-with-output-string #<procedure a5dccc0 at ice-9/r4rs.scm:238:3 (p)>)
trace: 5: (#<procedure a5dccc0 at ice-9/r4rs.scm:238:3 (p)> #<output: string a5ebe10>)
trace: 5: (with-output-to-port #<output: string a5ebe10> #<procedure a5d2cb0 at ice-9/format.sc…>)
trace: 6: (swaports)
trace: 7: (set-current-output-port #<output: string a5ebe10>)
trace: 7: #<output: file /dev/pts/12>
trace: 6: #<unspecified>
trace: 6: (#<procedure a607af0>)
...
-------------------end----------------------

But you may use the old style whose name is "graph":
-----------------graph style----------------
,trace (format #t "~a" 1) #:mode graph
trace: |  (#<procedure a693c60> #(#<directory (guile-user) a13a630> #f #f))
trace: |  #(#<directory (guile-user) a13a630> format "~a")
trace: (#<procedure a6988e0 at <current input>:1:0 ()>)
trace: (#<procedure a291470 at ice-9/format.scm:1612:9 (destination format-string . args) | (deprecated-forma…> …)
trace: |  (string? #t)
trace: |  #f
trace: (format #t "~a" 1)
trace: |  (string? "~a")
trace: |  #t
...
trace: |  (format:format-work "~a" (1))
trace: |  |  (string-length "~a")
trace: |  |  2
trace: |  |  (length (1))
trace: |  |  1
trace: |  |  (anychar-dispatch)
trace: |  |  |  (string-ref "~a" 0)
trace: |  |  |  #\~
trace: |  |  |  (char=? #\~ #\~)
trace: |  |  |  #t
trace: |  |  (tilde-dispatch)
trace: |  |  |  (string-ref "~a" 1)
trace: |  |  |  #\a
trace: |  |  |  (char-upcase #\a)
trace: |  |  |  #\A
trace: |  |  |  (memq #f (colon colon-at))
trace: |  |  |  #f
trace: |  |  |  (memq #f (at colon-at))
trace: |  |  |  #f
trace: |  |  |  (list-ref (1) 0)
trace: |  |  |  1
trace: |  |  |  (format:out-obj-padded #f 1 #f ())
trace: |  |  |  |  (with-output-to-string #<procedure a756850 at ice-9/format.scm:782:44 ()>)
trace: |  |  |  |  (call-with-output-string #<procedure a7609f0 at ice-9/r4rs.scm:238:3 (p)>)
trace: |  |  |  |  |  (#<procedure a7609f0 at ice-9/r4rs.scm:238:3 (p)> #<output: string a768708>)
trace: |  |  |  |  |  (with-output-to-port #<output: string a768708> #<procedure a756850 at ice…>)
trace: |  |  |  |  |  |  (swaports)
trace: |  |  |  |  |  |  |  (set-current-output-port #<output: string a768708>)
trace: |  |  |  |  |  |  |  #<output: file /dev/pts/12>
trace: |  |  |  |  |  |  #<unspecified>
trace: |  |  |  |  |  |  (#<procedure a77e380>)
trace: |  |  |  |  |  |  (() ((filename . "ice-9/r4rs.scm") (0 176 . 19) (3 176 . 41) (11 176 . 30)) ((2 13 …)) …)
trace: |  |  |  |  |  |  (#<procedure a7923a0>)
trace: |  |  |  |  |  |  (() ((filename . "ice-9/r4rs.scm") (0 176 . 19) (3 176 . 41) (11 176 . 30)) ((2 13 …)) …)
trace: |  |  |  |  |  |  (#<procedure a756850 at ice-9/format.scm:782:44 ()>)
trace: |  |  |  |  |  |  (display 1)
trace: |  |  |  |  |  |  #<unspecified>
trace: |  |  |  |  |  |  (swaports)
trace: |  |  |  |  |  |  |  (set-current-output-port #<output: file /dev/pts/12>)
trace: |  |  |  |  |  |  |  #<output: string a768708>
trace: |  |  |  |  |  |  #<unspecified>
trace: |  |  |  |  |  #<unspecified>
trace: |  |  |  |  "1"
trace: |  |  |  |  (display "1" #<output: file /dev/pts/12>)
1trace: |  |  |  |  #<unspecified>
trace: |  |  |  |  (string-length "1")
trace: |  |  |  |  1
trace: |  |  |  #<unspecified>
...
---------------end-----------------

What you guys think?

Attachment: 0001-Add-new-trace-print-style-show-level-count-number-in.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]