Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Capturing trace output

From: SunandaDH::aol::com at: 17-Oct-2004 12:40

In an attempt to make trace even slightly useful, I doodled this code: captured-print: copy [] ;; all print gets saved here system-print: get in system/words 'print ;; copy original print function system-prin: get in system/words 'prin ;; copy original prin function print: func [item] [ ;; redefine print insert captured-print item captured-print: copy/part captured-print 500 ] prin: :print ;; redefine prin (I know there are subtle differences between the way 'system-print and 'print work, but they are not relevant here). So, in theory, I could run a script that has a trace in it, and then check captured-print for the last 500 items. Rather than spending 10 times as long watching bazillions of lines whizz past on the console. Not so, though. Trace seems to output to the console without using 'print -- looks like one of those few immutable things about REBOL. Any suggestions? Thanks, Sunanda.