from comp.lang.tcl

an *uplevel-proc* is an *proc* which evaluate the entire content *uplevel* → example:

  proc Format_Return_Error_Check {hdl err} {
    uplevel "Format_Error_Check $hdl $err ; set retM void"
  }

This simulate a *CPP*-Macro like behavior in *TCL*.

The easy solution to just lice a normal *proc*-body like:

  proc Format_Return_Error_Check {hdl err} {
    upvar retM retM
    Format_Error_Check $hdl $err
    set retM void
  }

is not really a solution because the "upvar" in a sub-*proc* like *Format_Error_Check* is broken because *Format_Return_Error_Check* return an extra call-frame.

solution:

It should be possible to create a *proc* witch *not* add an extra *level* to the call-frame, a good name would be *macro* :

  macro Format_Return_Error_Check {hdl err} {
    Format_Error_Check $hdl $err
    set retM void
  }

The following features should be present:

1) A *macro* argument variable (hdl err) is *only* visible in the macro-body 2) A other variable (retM) is from the calling-call-frame 3) A *macro* deos NOT add a call-frame → an *upvar* in *Format_Error_Check* should call he calling-call-frame and not the macro-body-frame