home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / TraceVar.3 < prev    next >
Encoding:
Text File  |  1995-07-26  |  28.7 KB  |  529 lines

  1.  
  2.  
  3.  
  4.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           Tcl_TraceVar,         Tcl_TraceVar2,         Tcl_UntraceVar,
  12.           Tcl_UntraceVar2,   Tcl_VarTraceInfo,   Tcl_VarTraceInfo2   -
  13.           monitor accesses to a variable
  14.  
  15.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  16.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  17.  
  18.           int
  19.           TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a))))
  20.  
  21.           int
  22.           TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr2222((((_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a))))
  23.  
  24.           TTTTccccllll____UUUUnnnnttttrrrraaaacccceeeeVVVVaaaarrrr((((_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a))))
  25.  
  26.           TTTTccccllll____UUUUnnnnttttrrrraaaacccceeeeVVVVaaaarrrr2222((((_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a))))
  27.  
  28.           ClientData
  29.           TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo((((_i_n_t_e_r_p, _v_a_r_N_a_m_e, _f_l_a_g_s, _p_r_o_c, _p_r_e_v_C_l_i_e_n_t_D_a_t_a))))
  30.  
  31.           ClientData
  32.           TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo2222((((_i_n_t_e_r_p, _n_a_m_e_1, _n_a_m_e_2, _f_l_a_g_s, _p_r_o_c, _p_r_e_v_C_l_i_e_n_t_D_a_t_a))))
  33.  
  34.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  35.           Tcl_Interp         *_i_n_t_e_r_p          (in)      Interpreter
  36.                                                         containing
  37.                                                         variable.
  38.  
  39.           char               *_v_a_r_N_a_m_e         (in)      Name        of
  40.                                                         variable.  May
  41.                                                         refer   to   a
  42.                                                         scalar
  43.                                                         variable,   to
  44.                                                         an       array
  45.                                                         variable  with
  46.                                                         no  index,  or
  47.                                                         to  an   array
  48.                                                         variable  with
  49.                                                         a
  50.                                                         parenthesized
  51.                                                         index.
  52.  
  53.           int                _f_l_a_g_s            (in)      OR-ed
  54.                                                         combination of
  55.                                                         the     values
  56.                                                         TCL_TRACE_READS,
  57.                                                         TCL_TRACE_WRITES,
  58.                                                         and
  59.                                                         TCL_TRACE_UNSETS,
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/10/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  71.  
  72.  
  73.  
  74.                                                         and
  75.                                                         TCL_GLOBAL_ONLY.
  76.                                                         Not  all flags
  77.                                                         are  used   by
  78.                                                         all
  79.                                                         procedures.
  80.                                                         See  below for
  81.                                                         more
  82.                                                         information.
  83.  
  84.           Tcl_VarTraceProc   *_p_r_o_c            (in)      Procedure   to
  85.                                                         invoke
  86.                                                         whenever   one
  87.                                                         of  the traced
  88.                                                         operations
  89.                                                         occurs.
  90.  
  91.           ClientData         _c_l_i_e_n_t_D_a_t_a       (in)      Arbitrary
  92.                                                         one-word value
  93.                                                         to   pass   to
  94.                                                         _p_r_o_c.
  95.  
  96.           char               *_n_a_m_e_1           (in)      Name of scalar
  97.                                                         or       array
  98.                                                         variable
  99.                                                         (without array
  100.                                                         index).
  101.  
  102.           char               *_n_a_m_e_2           (in)      For a trace on
  103.                                                         an  element of
  104.                                                         an      array,
  105.                                                         gives      the
  106.                                                         index  of  the
  107.                                                         element.   For
  108.                                                         traces      on
  109.                                                         scalar
  110.                                                         variables   or
  111.                                                         on       whole
  112.                                                         arrays,     is
  113.                                                         NULL.
  114.  
  115.           ClientData         _p_r_e_v_C_l_i_e_n_t_D_a_t_a   (in)      If   non-NULL,
  116.                                                         gives     last
  117.                                                         value returned
  118.                                                         by
  119.                                                         TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo
  120.                                                         or
  121.                                                         TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo2222,
  122.                                                         so  this  call
  123.                                                         will    return
  124.                                                         information
  125.                                                         about     next
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/10/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  137.  
  138.  
  139.  
  140.                                                         trace.      If
  141.                                                         NULL,     this
  142.                                                         call      will
  143.                                                         return
  144.                                                         information
  145.                                                         about    first
  146.                                                         trace.
  147.      _________________________________________________________________
  148.  
  149.  
  150.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  151.           TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr allows a C procedure  to  monitor  and  control
  152.           access to a Tcl variable, so that the C procedure is invoked
  153.           whenever the variable is read or written or unset.   If  the
  154.           trace  is  created  successfully  then  TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr returns
  155.           TCL_OK.  If an error occurred  (e.g.  _v_a_r_N_a_m_e  specifies  an
  156.           element of an array, but the actual variable isn't an array)
  157.           then TCL_ERROR is returned and an error message is  left  in
  158.           _i_n_t_e_r_p->_r_e_s_u_l_t.
  159.  
  160.           The _f_l_a_g_s argument to TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr indicates when the  trace
  161.           procedure  is  to  be  invoked  and provides information for
  162.           setting up the trace.  It consists of an  OR-ed  combination
  163.           of any of the following values:
  164.  
  165.           TTTTCCCCLLLL____GGGGLLLLOOOOBBBBAAAALLLL____OOOONNNNLLLLYYYY
  166.                Normally, the variable will be looked up at the current
  167.                level  of  procedure call;  if this bit is set then the
  168.                variable will be looked up at  global  level,  ignoring
  169.                any active procedures.
  170.  
  171.           TTTTCCCCLLLL____TTTTRRRRAAAACCCCEEEE____RRRREEEEAAAADDDDSSSS
  172.                Invoke _p_r_o_c whenever an attempt is  made  to  read  the
  173.                variable.
  174.  
  175.           TTTTCCCCLLLL____TTTTRRRRAAAACCCCEEEE____WWWWRRRRIIIITTTTEEEESSSS
  176.                Invoke _p_r_o_c whenever an attempt is made to  modify  the
  177.                variable.
  178.  
  179.           TTTTCCCCLLLL____TTTTRRRRAAAACCCCEEEE____UUUUNNNNSSSSEEEETTTTSSSS
  180.                Invoke _p_r_o_c whenever the variable is unset.  A variable
  181.                may  be unset either explicitly by an uuuunnnnsssseeeetttt command, or
  182.                implicitly  when  a  procedure   returns   (its   local
  183.                variables   are   automatically   unset)  or  when  the
  184.                interpreter is deleted (all variables are automatically
  185.                unset).
  186.  
  187.           Whenever one of  the  specified  operations  occurs  on  the
  188.           variable,  _p_r_o_c  will  be invoked.  It should have arguments
  189.           and result that match the type TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeePPPPrrrroooocccc:
  190.                typedef char *Tcl_VarTraceProc(
  191.                     ClientData _c_l_i_e_n_t_D_a_t_a,
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 7/10/95)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  203.  
  204.  
  205.  
  206.                     Tcl_Interp *_i_n_t_e_r_p,
  207.                     char *_n_a_m_e_1,
  208.                     char *_n_a_m_e_2,
  209.                     int _f_l_a_g_s);
  210.           The _c_l_i_e_n_t_D_a_t_a and _i_n_t_e_r_p  parameters  will  have  the  same
  211.           values  as  those  passed to TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr when the trace was
  212.           created.  _C_l_i_e_n_t_D_a_t_a typically  points  to  an  application-
  213.           specific  data structure that describes what to do when _p_r_o_c
  214.           is invoked.  _N_a_m_e_1 and _n_a_m_e_2 give the  name  of  the  traced
  215.           variable in the normal two-part form (see the description of
  216.           TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr2222  below  for  details).   _F_l_a_g_s  is  an   OR-ed
  217.           combination of bits providing several pieces of information.
  218.           One  of  the  bits  TCL_TRACE_READS,  TCL_TRACE_WRITES,   or
  219.           TCL_TRACE_UNSETS  will  be  set  in  _f_l_a_g_s to indicate which
  220.           operation is being  performed  on  the  variable.   The  bit
  221.           TCL_GLOBAL_ONLY  will  be  set  whenever  the variable being
  222.           accessed is a global one not  accessible  from  the  current
  223.           level  of  procedure call:  the trace procedure will need to
  224.           pass this flag  back  to  variable-related  procedures  like
  225.           TTTTccccllll____GGGGeeeettttVVVVaaaarrrr  if  it attempts to access the variable.  The bit
  226.           TCL_TRACE_DESTROYED will be set in _f_l_a_g_s  if  the  trace  is
  227.           about  to  be  destroyed;  this information may be useful to
  228.           _p_r_o_c  so  that  it  can  clean  up  its  own  internal  data
  229.           structures  (see  the  section TCL_TRACE_DESTROYED below for
  230.           more details).  Lastly, the bit TCL_INTERP_DESTROYED will be
  231.           set if the entire interpreter is being destroyed.  When this
  232.           bit is set, _p_r_o_c must be especially careful in the things it
  233.           does  (see  the  section  TCL_INTERP_DESTROYED  below).  The
  234.           trace procedure's return value should normally be NULL;  see
  235.           ERROR RETURNS below for information on other possibilities.
  236.  
  237.           TTTTccccllll____UUUUnnnnttttrrrraaaacccceeeeVVVVaaaarrrr may be  used  to  remove  a  trace.   If  the
  238.           variable specified by _i_n_t_e_r_p, _v_a_r_N_a_m_e, and _f_l_a_g_s has a trace
  239.           set with _f_l_a_g_s, _p_r_o_c, and _c_l_i_e_n_t_D_a_t_a, then the corresponding
  240.           trace is removed.  If no such trace exists, then the call to
  241.           TTTTccccllll____UUUUnnnnttttrrrraaaacccceeeeVVVVaaaarrrr has no effect.  The same bits are  valid  for
  242.           _f_l_a_g_s as for calls to TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrrssss.
  243.  
  244.           TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo may be used to retrieve  information  about
  245.           traces  set  on  a  given  variable.   The return value from
  246.           TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo  is  the  _c_l_i_e_n_t_D_a_t_a  associated   with   a
  247.           particular  trace.   The  trace  must  be  on  the  variable
  248.           specified by the _i_n_t_e_r_p, _v_a_r_N_a_m_e, and _f_l_a_g_s arguments  (only
  249.           the  TCL_GLOBAL_ONLY bit from _f_l_a_g_s is used;  other bits are
  250.           ignored) and its trace procedure must the same as  the  _p_r_o_c
  251.           argument.   If  the _p_r_e_v_C_l_i_e_n_t_D_a_t_a argument is NULL then the
  252.           return  value  corresponds  to  the  first  (most   recently
  253.           created)  matching  trace,  or NULL if there are no matching
  254.           traces.  If the _p_r_e_v_C_l_i_e_n_t_D_a_t_a argument isn't NULL, then  it
  255.           should   be  the  return  value  from  a  previous  call  to
  256.           TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo.  In this case, the new return  value  will
  257.           correspond  to  the  next matching trace after the one whose
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 7/10/95)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  269.  
  270.  
  271.  
  272.           _c_l_i_e_n_t_D_a_t_a matches  _p_r_e_v_C_l_i_e_n_t_D_a_t_a,  or  NULL  if  no  trace
  273.           matches  _p_r_e_v_C_l_i_e_n_t_D_a_t_a  or  if  there  are no more matching
  274.           traces after it.  This mechanism makes it possible  to  step
  275.           through all of the traces for a given variable that have the
  276.           same _p_r_o_c.
  277.  
  278.  
  279.      TTTTWWWWOOOO----PPPPAAAARRRRTTTT NNNNAAAAMMMMEEEESSSS
  280.           The   procedures   TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr2222,    TTTTccccllll____UUUUnnnnttttrrrraaaacccceeeeVVVVaaaarrrr2222,    and
  281.           TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo2222    are    identical    to    TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr,
  282.           TTTTccccllll____UUUUnnnnttttrrrraaaacccceeeeVVVVaaaarrrr, and TTTTccccllll____VVVVaaaarrrrTTTTrrrraaaacccceeeeIIIInnnnffffoooo,  respectively,  except
  283.           that  the name of the variable has already been separated by
  284.           the caller into two parts.  _N_a_m_e_1 gives the name of a scalar
  285.           variable  or  array,  and _n_a_m_e_2 gives the name of an element
  286.           within an array.  If _n_a_m_e_2 is NULL it means that either  the
  287.           variable is a scalar or the trace is to be set on the entire
  288.           array rather than an  individual  element  (see  WHOLE-ARRAY
  289.           TRACES below for more information).
  290.  
  291.  
  292.      AAAACCCCCCCCEEEESSSSSSSSIIIINNNNGGGG VVVVAAAARRRRIIIIAAAABBBBLLLLEEEESSSS DDDDUUUURRRRIIIINNNNGGGG TTTTRRRRAAAACCCCEEEESSSS
  293.           During read and write traces, the trace procedure can  read,
  294.           write,  or  unset  the  traced  variable  using TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222,
  295.           TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222, and other procedures.  While _p_r_o_c is executing,
  296.           traces  are  temporarily  disabled for the variable, so that
  297.           calls to TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222 and TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222 will not cause _p_r_o_c  or
  298.           other  trace procedures to be invoked again.  Disabling only
  299.           occurs for the variable whose  trace  procedure  is  active;
  300.           accesses  to other variables will still be traced.  However,  |
  301.           if a variable is unset during a read  or  write  trace  then  |
  302.           unset traces will be invoked.
  303.  
  304.           During unset traces the variable has already been completely
  305.           expunged.  It is possible for the trace procedure to read or
  306.           write the variable, but this will be a new  version  of  the
  307.           variable.   Traces  are  not disabled during unset traces as
  308.           they are for read and write traces, but existing traces have
  309.           been  removed  from the variable before any trace procedures
  310.           are  invoked.   If  new  traces  are  set  by  unset   trace
  311.           procedures,  these traces will be invoked on accesses to the
  312.           variable by the trace procedures.
  313.  
  314.  
  315.      CCCCAAAALLLLLLLLBBBBAAAACCCCKKKK TTTTIIIIMMMMIIIINNNNGGGG
  316.           When read tracing has been specified  for  a  variable,  the
  317.           trace  procedure  will  be  invoked  whenever the variable's
  318.           value is read.  This includes sssseeeetttt Tcl  commands,  $$$$-notation
  319.           in  Tcl  commands,  and  invocations  of  the TTTTccccllll____GGGGeeeettttVVVVaaaarrrr and
  320.           TTTTccccllll____GGGGeeeettttVVVVaaaarrrr2222 procedures.  _P_r_o_c is  invoked  just  before  the
  321.           variable's  value  is  returned.  It may modify the value of
  322.           the variable to  affect  what  is  returned  by  the  traced
  323.           access.   If  it  unsets  the  variable then the access will  |
  324.  
  325.  
  326.  
  327.      Page 5                                          (printed 7/10/95)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  335.  
  336.  
  337.  
  338.           return an error just as if the variable never existed.
  339.  
  340.           When write tracing has been specified for  a  variable,  the
  341.           trace  procedure  will  be  invoked  whenever the variable's
  342.           value is modified.  This  includes  sssseeeetttt  commands,  commands
  343.           that  modify  variables  as  side effects (such as ccccaaaattttcccchhhh and
  344.           ssssccccaaaannnn),  and  calls  to  the   TTTTccccllll____SSSSeeeettttVVVVaaaarrrr   and   TTTTccccllll____SSSSeeeettttVVVVaaaarrrr2222
  345.           procedures).   _P_r_o_c  will  be  invoked  after the variable's
  346.           value has been modified, but before the  new  value  of  the
  347.           variable  has been returned.  It may modify the value of the
  348.           variable to override the change and to determine  the  value
  349.           actually  returned  by the traced access.  If it deletes the  |
  350.           variable then the traced access will return an empty string.
  351.  
  352.           When unset tracing has been specified, the  trace  procedure
  353.           will  be  invoked  whenever  the variable is destroyed.  The
  354.           traces will be called after the variable has been completely
  355.           unset.
  356.  
  357.  
  358.      WWWWHHHHOOOOLLLLEEEE----AAAARRRRRRRRAAAAYYYY TTTTRRRRAAAACCCCEEEESSSS
  359.           If a call to TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr  or  TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr2222  specifies  the
  360.           name  of  an array variable without an index into the array,
  361.           then the trace will be set on the array as  a  whole.   This
  362.           means  that _p_r_o_c will be invoked whenever any element of the
  363.           array is accessed in the ways specified by _f_l_a_g_s.   When  an
  364.           array  is  unset,  a  whole-array trace will be invoked just
  365.           once, with _n_a_m_e_1 equal to the name of the  array  and  _n_a_m_e_2
  366.           NULL;  it will not be invoked once for each element.
  367.  
  368.  
  369.      MMMMUUUULLLLTTTTIIIIPPPPLLLLEEEE TTTTRRRRAAAACCCCEEEESSSS
  370.           It is possible for multiple traces  to  exist  on  the  same
  371.           variable.   When  this  happens, all of the trace procedures
  372.           will  be  invoked  on  each  access,  in  order  from  most-
  373.           recently-created   to  least-recently-created.   When  there
  374.           exist whole-array traces for an array as well as  traces  on
  375.           individual  elements,  the  whole-array  traces  are invoked
  376.           before the individual-element traces.  If a  read  or  write  |
  377.           trace  unsets the variable then all of the unset traces will  |
  378.           be invoked but the remainder of the read  and  write  traces  |
  379.           will be skipped.
  380.  
  381.  
  382.      EEEERRRRRRRROOOORRRR RRRREEEETTTTUUUURRRRNNNNSSSS
  383.           Under normal conditions trace procedures should return NULL,
  384.           indicating  successful  completion.   If _p_r_o_c returns a non-
  385.           NULL value it signifies that an error occurred.  The  return
  386.           value  must  be  a  pointer  to  a  static  character string
  387.           containing an error message.  If a trace  procedure  returns
  388.           an  error,  no further traces are invoked for the access and
  389.           the traced access aborts  with  the  given  message.   Trace
  390.  
  391.  
  392.  
  393.      Page 6                                          (printed 7/10/95)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  401.  
  402.  
  403.  
  404.           procedures  can  use  this  facility to make variables read-
  405.           only, for example (but note that the value of  the  variable
  406.           will  already  have been modified before the trace procedure
  407.           is called, so the trace procedure will have to  restore  the
  408.           correct value).
  409.  
  410.           The return value from _p_r_o_c is  only  used  during  read  and
  411.           write  tracing.   During  unset  traces, the return value is
  412.           ignored and all relevant trace  procedures  will  always  be
  413.           invoked.
  414.  
  415.  
  416.      RRRREEEESSSSTTTTRRRRIIIICCCCTTTTIIIIOOOONNNNSSSS
  417.           A trace procedure can be called at any time, even when there
  418.           is  a  partically-formed  result in the interpreter's result
  419.           area.  If the  trace  procedure  does  anything  that  could
  420.           damage  this  result (such as calling TTTTccccllll____EEEEvvvvaaaallll) then it must
  421.           save the original values of  the  interpreter's  rrrreeeessssuuuulllltttt  and
  422.           ffffrrrreeeeeeeePPPPrrrroooocccc fields and restore them before it returns.
  423.  
  424.  
  425.      UUUUNNNNDDDDEEEEFFFFIIIINNNNEEEEDDDD VVVVAAAARRRRIIIIAAAABBBBLLLLEEEESSSS
  426.           It is legal to set a trace on an  undefined  variable.   The
  427.           variable  will  still appear to be undefined until the first
  428.           time its value is set.  If an undefined variable  is  traced
  429.           and then unset, the unset will fail with an error (``no such
  430.           variable''), but the trace procedure will still be invoked.
  431.  
  432.  
  433.      TTTTCCCCLLLL____TTTTRRRRAAAACCCCEEEE____DDDDEEEELLLLEEEETTTTEEEEDDDD FFFFLLLLAAAAGGGG
  434.           In an unset callback to _p_r_o_c, the TCL_TRACE_DELETED  bit  is
  435.           set  in  _f_l_a_g_s  if the trace is being removed as part of the
  436.           deletion.  Traces on a variable are always removed  whenever
  437.           the  variable  is  deleted;  the only time TCL_TRACE_DELETED
  438.           isn't set is for a whole-array trace  invoked  when  only  a
  439.           single element of an array is unset.
  440.  
  441.  
  442.      TTTTCCCCLLLL____IIIINNNNTTTTEEEERRRRPPPP____DDDDEEEESSSSTTTTRRRROOOOYYYYEEEEDDDD
  443.           When an interpreter is destroyed, unset  traces  are  called
  444.           for all of its variables.  The TCL_INTERP_DESTROYED bit will
  445.           be set in the _f_l_a_g_s argument passed to the trace procedures.
  446.           Trace  procedures  must be extremely careful in what they do
  447.           if the TCL_INTERP_DESTROYED bit is set.  It is not safe  for
  448.           the   procedures   to  invoke  any  Tcl  procedures  on  the
  449.           interpreter, since its state is partially deleted.  All that
  450.           trace  procedures  should do under these circumstances is to
  451.           clean up and free their own internal data structures.
  452.  
  453.  
  454.      BBBBUUUUGGGGSSSS
  455.           Tcl  doesn't  do  any  error  checking  to   prevent   trace
  456.  
  457.  
  458.  
  459.      Page 7                                          (printed 7/10/95)
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.      TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))              TTTTccccllll (((( ))))              TTTTccccllll____TTTTrrrraaaacccceeeeVVVVaaaarrrr((((3333))))
  467.  
  468.  
  469.  
  470.           procedures  from misusing the interpreter during traces with
  471.           TCL_INTERP_DESTROYED set.
  472.  
  473.  
  474.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  475.           clientData, trace, variable
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.      Page 8                                          (printed 7/10/95)
  526.  
  527.  
  528.  
  529.