I need to call some user init_proc before calling any Tcl or User Defined proc

From: gk (gopikn_at_rocketmail.com)
Date: 02/26/04


Date: 26 Feb 2004 13:28:51 -0800

Folks,

I got stuck & Need your help !!

In Tcl, is there a way to call some init_proc before calling any of
the tcl or user defined procedures.

(eg)
init.tcl
*********

proc init_proc { } {
   # Reset here all the global variable "
   puts " name of the current running proc: "
   puts " timestamp "
    ...
    ...
}

In xyz.tcl
-----------

proc xyz { } {
   puts " xyz "
}

In main.tcl
------------

puts " Execting the procedures ..."
source init.tcl
source xyz.tcl
xyz

In the above example (main.tcl), is there a way that when i call xyz (
proc) , first the init_proc should call automatically and do some
operation then the actually xyz proc should execute. I dont want to
call init_proc in every single procedure or calling init_proc before
calling any procedure ( want this operation should handle by tcl
itself ).

Also whether Is it possible to bind a event in such a way that
whenever the proc is called the event is genereated and i can handle
the event and execute some init_proc and return.

Thanks in advance any help is appreciated..
-gk



Relevant Pages

  • Re: is it possible to have two function with the same name?
    ... foo(). ... It it possible to create a proc foo } and ... a way to mask a C procedure with a Tcl procedure. ... puts "calling the C proc" ...
    (comp.lang.tcl)
  • Tcl_LimitTypeSet
    ... I have problems with the limit system (eg: Tcl_LimitTypeSet) in the Tcl lib. ... Tcl_LimitSetTime(interp, &timeLimit); ... then the limit's callback is called very often, no matter how long the limit was set. ... Convesely, when using a command limit, ie calling: ...
    (comp.lang.tcl)
  • Re: failure in: expr $a ne $b
    ... % set a abc ... % set b xyz ... Tcl 7.6 also rejected bare words, though the exact error message ...
    (comp.lang.tcl)
  • Re: Joysticks in windows with ActiveTCL 8.4
    ... >have used com ports, but nothing outside tcl. ... How do I go about calling ... >windows functions (like joyGetPos from your links)? ...
    (comp.lang.tcl)
  • Re: Odd error when closing a window.
    ... Dave wrote: ... calling from Tcl though. ... Darren New / San Diego, CA, USA ...
    (comp.lang.tcl)