Site Tools


set_output_rewrite

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

set_output_rewrite [2006/08/29 16:08] (current)
Line 1: Line 1:
 +# $EPIC: set_output_rewrite.txt,​v 1.2 2006/08/20 15:02:36 sthalik Exp $
 +======Synopsis:​======
 +[[set]] output_rewrite
 +
 +======Description:​======
 +If this /[[SET]] is defined (by default, it is un-set), then every
 +time a LOGICAL line of output is about to be sent to a window, the
 +/[[SET]] value is expanded, and the result of that expansion is substituted
 +for the original text.  The expansion is parsed in the context that:
 +
 +|  $0   | The window refnum the output is going to |
 +|  $1-  | The text itself ​                         |
 +
 +======Examples:​======
 +This would timestamp all output to all windows:
 + /SET OUTPUT_REWRITE $Z $1-
 +
 +This would timestamp all output to all windows with a custom timestamp
 +format:
 +  /SET OUTPUT_REWRITE $strftime(%X) $1-
 +
 +This would return proceed all output to all windows with the output of
 +the user defined function $myfunc() called with the window number.
 + /SET OUTPUT_REWRITE $myfunc($0) $1-
 +
 +======Notes:​======
 +When changing /[[set]] output_rewrite inside of an alias, please remember
 +that $'s are expanded before the /set is called, and so things like
 +$1- or $myfunc($0) would be expanded at the /set time and not at the
 +rewrite time.  Make sure to double up your $$'s in such cases!
 +
 +======Practical:​======
 +For every line of output that goes to the screen, /[[on window]] is
 +thrown. ​ However, /[[on window]] cannot be recursively called, so
 +there are some instances where output goes to the window without
 +/[[on window]] having been thrown. ​ This makes it hard to write
 +general purpose time stamp handlers. ​ Therefore, a general purpose
 +way of doing final-editing on window output is needed. ​ This set
 +provides that capability.
 +
 +======Performance Note:======
 +This is a very expensive operation, but is cheaper than using
 +an /[[on window]], and probably less of a hassle than redefining
 +a zillion other /​on'​s. ​ It also is pretty reliable, since it
 +will always be honored for all lines of output.
  
set_output_rewrite.txt ยท Last modified: 2006/08/29 16:08 (external edit)