f



TCL C API: receiving command from a script or from tcl command line ?

Hello,

TCL allows to run commands from commandl line or from within a script
file thanks to the command "source filename".

I used TCL C API to embed my own commands. My question is : from my own
commands, how can I know whether it was called from the script or
directly from the shell ?

Thanks,

Fabrice

0
2/10/2006 9:32:07 AM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

3 Replies
899 Views

Similar Articles

[PageSpeed] 3

Hi Fabrice,


"fabrice" writes:
> I used TCL C API to embed my own commands. My question is : from my
> own commands, how can I know whether it was called from the script
> or directly from the shell ?

You can look at the variable tcl_interactive to distinguish the two
modes.

Note: It usually seems not a good idea to change the behaviour of your
functions between use in a program (production mode) and interactive
use (usually for experimentation and debugging).  It's confusing for
the users and it may make it difficult or impossible to reproduce some
kinds of problems interactively.  If you want to add more debug output
in interactive mode, you can always add additional commands and flags
for that purpose.


benny
0
2/10/2006 4:56:14 PM
fabrice wrote:
> Hello,
> 
> TCL allows to run commands from commandl line or from within a script
> file thanks to the command "source filename".
> 
> I used TCL C API to embed my own commands. My question is : from my own
> commands, how can I know whether it was called from the script or
> directly from the shell ?

You could look at how the 'tcl_interactive' variable is set up and used...

-- 
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/
0
davidw (997)
2/10/2006 6:32:24 PM
Thanks to both of you,

I heard of 'tcl_interactive' variable one day, but I am new to tcl and
I completly forget it :(

Benny, the purpose is just to display my commands that are used within
the script and thus not displayed in tclsh. The commands behaviour stay
exactly the same, so the tests are exactly the same.

Thanks a lot.

Fabrice

0
2/10/2006 8:22:32 PM
Reply:

Similar Artilces:

Tcl command to evaluate a tcl script?
Hi all, I need to evaluate a separate tcl file within a tcl file. Is there any tcl command to evaluate a tcl file ? Regards, Prabu.K prabu wrote: > Hi all, > > I need to evaluate a separate tcl file within a tcl file. Is there any > tcl command to evaluate a tcl file ? > > Regards, > Prabu.K > hi, try: source your_other_tcl_file.tcl cheers, Tobi ...

following tcl command execution from C/C++ code to tcl in gdb
Hi, We have a C/C++ huge application that makes heavy use of tcl C bindings. We frequently have very long stack traces from within gdb/dbx that look like this: #7 0x0d0aac7d in TclObjInterpProc (clientData=0x12857160, interp=0x10924df8, objc=6, objv=0x15138a40) at ../generic/tclProc.c:1146 #8 0x0d043dc6 in TclEvalObjvInternal (interp=0x10924df8, objc=6, objv=0x15138a40, command=0xe0c1382 "", length=0, flags=262144) at ../generic/tclBasic.c:3087 #9 0x0d044045 in Tcl_EvalObjv (interp=0x10924df8, objc=6, objv=0x15138a40, flags=262144) at ../generic/tclBasic.c:3203 This is just a very small part of what can be a very long stack trace. Now by poking around I can see that in gdb I can print *objv[0] to see the first word of a command but this is painful. What we really want is a way to see what Tcl commands are being executed either while the program is running or easily from the stack trace. Can you run gdb as well as a Tcl debugger at the same time? Seems unlikely. How are people systematically tracing the execution of Tcl commands that are called from C/++ bindings? Thanks. foobarbaz99@hotmail.com wrote: > How are people systematically tracing the execution of Tcl commands > that are called from C/++ bindings? Are you familiar with Tcl_CreateObjTrace() ? Does it accomplish what you need? -- | Don Porter Mathematical and Computational Sciences Division | | donald.porter@nist.gov Information Technology Laboratory | | http://mat...

Tcl command to evaluate a tcl script? #2
Hi all, I need to evaluate a separate tcl file within a tcl file. Is there any tcl command to evaluate a tcl file ? Regards, Prabu.K prabu wrote: > I need to evaluate a separate tcl file within a tcl file. Is there any > tcl command to evaluate a tcl file ? You're probably looking for the "source" command. Other commands of interest would be "package require" or "eval". The command "load" is for binary shared libraries. -- Darren New / San Diego, CA, USA (PST) Scruffitarianism - Where T-shirt, jeans, and a three-day beard are "Sunday Best." Thanks Darren. But what my need is that I am writing a tcl script which is going to take any tcl script as input and should return the output of the file. How can I do that? Regards, Prabu Darren New wrote: > prabu wrote: > > I need to evaluate a separate tcl file within a tcl file. Is there any > > tcl command to evaluate a tcl file ? > > You're probably looking for the "source" command. > > Other commands of interest would be "package require" or "eval". The > command "load" is for binary shared libraries. > > -- > Darren New / San Diego, CA, USA (PST) > Scruffitarianism - Where T-shirt, jeans, > and a three-day beard are "Sunday Best." On 17 Dec 2006 21:16:16 -0800, "prabu" <catchme.prabu@gmail.com> wrote: > Thanks Dar...

l'C program executing from a tcl script with pipe opened using open command in Tcl
Hi all, I wanted to communicate with a C program from a Tcl script.. The test code i have written is below Both the 'C' program and Tcl script are located in the same directory. The 'C' program is below. I have named it CTCL.C #include<stdio.h> #include<string.h> int main() { int i; char c[30]; printf("Reading..."); scanf("%s",c); printf("String read is :%s\n",c); fflush(stdout); return 0; } I have compiled the program with the command cc CTCL.C -o ctcl So the executable was generated with the name 'ctcl' The Tcl script I have written is. I have named it TCLPIPETEST.tcl #!/usr/add-on/exptools/bin/tclsh set fd [open "|./ctcl" r+] gets $fd tmp1 puts "tmp1 = $tmp1" set stat 0 set tmp2 "Default value... " if { ![catch { puts $fd "abcdef" } res]} { if { ![catch { flush $fd } res] } { if { ![catch { gets $fd tmp2} res ] } { set stat 1 } else { puts "Error 'gets' from pipe : $res" } } else { puts "Error 'flush' from pipe:$res " } } else { puts "Error 'puts' from pipe:$res " } if { $stat == 1 } { puts "Success......:$tmp2 :)" } else { puts "Failure......:$tmp2 :(" } I have given all permissions for both the files above. When i execute the Tcl script My aim is to open a pipe with the 'C' executable 'ctcl', initially read so...

In Tcl and C++ code, how to use Tcl Command, such as exit?
In my code, i used Tcl_SetStdChannel(0, STDIN) and a thread to control all input and output from Tcl, but i want to use some of Tcl' Commands, such as, exit. I used Tcl_Eval() then, but the Tcl command seem invisible in my code, I typed a string in command prompt, such as "AAAAA", and Enter, got nothing feedback. How can i do to get these Tcl Commands work? Thanx! vian1381@china.com.cn wrote: > In my code, i used Tcl_SetStdChannel(0, STDIN) and a thread to control > all input and output from Tcl, but i want to use some of Tcl' Commands, > such as, exit. > > I used Tcl_Eval() then, but the Tcl command seem invisible in my code, > I typed a string in command prompt, such as "AAAAA", and Enter, got > nothing feedback. Your questions are hard to understand, but they suggest that you believe that setting a custom stdin channel will do some magic to establsh a prompt/read/eval loop. That is not the case. > How can i do to get these Tcl Commands work? Start with something that works, like the source code for tclsh, and adapt to your needs. Or post a followup and include more code examples to explain what you're doing and how it doesn't do what you expect. -- | Don Porter Mathematical and Computational Sciences Division | | donald.porter@nist.gov Information Technology Laboratory | | http://math.nist.gov/~DPorter/ NIST | |_____________________________________...

Tcl+incr Tcl debuggers to use on command line?
Hi, Does anyone know of incr Tcl supported debuggers that work on command line? That is, without needing bundling with IDEs? Thanks On 10/11/14, 9:46 PM, kenneth.bull@gmail.com wrote: > Hi, > > Does anyone know of incr Tcl supported debuggers that work on command line? > That is, without needing bundling with IDEs? Well, the debugger in ActiveState's TDK does not need a bundled IDE and it works with [incr Tcl] -- but it is a GUI application not a command line one. -- +------------------------------------------------------------------------+ | Gerald W. L...

How does the Tcl interpret handle results returned from C-created Tcl commands ?
I've ventured on creating a Tcl command trough a C routine. I've followed the manual guidelines. My C routine checks the validity of a selected option for the currently displayed histogram. Therefore it returns a Boolean value that, according to the C <-> Tcl communucation protocol, I have encoded as TCL_ERROR (= FALSE) and TCL_OK (TRUE). WHenthis command is called in a Tcl proc, the interpreter is supposed to perform two different actions according to the returned Boolean value. How can I fetch this returned Boolean result (TCL_ERROR/ TCL_OK) from the Tcl proc that executes the C-created command ? What if I wrote 1 (FALSE) or 0 (TRUE) in a string and have the C routine return this 1-character string ? Would it be easier to get the result of the teest from the caling TCL proc ? Please, find in the following the code that implements (according to my best resolution) the C-created command and the callind Tcl proc. Thank you, Maura ************************************************************************************************************* * C routine * ************************************************************************************************************* static int check_hist_aint_option_cb( ClientData clientData, Tcl_Interp *interp, int argc, char *argv[] ) { int i; if ( hg.active_ &...

Tcl Book that explains tcl C API?
Hi! I am looking for material that explains the tcl C API in order to: - Embed Tcl into a C application. - Extend Tcl to add new commands in C. Does Tcl and Tk Toolkit (2nd Edition) by Ken Jones and John Ousterhout do a good job explain these topics in depth? Thanks! Asif wrote: > Hi! > > I am looking for material that explains the tcl C API in order to: > > - Embed Tcl into a C application. > - Extend Tcl to add new commands in C. > > Does Tcl and Tk Toolkit (2nd Edition) by Ken Jones and John Ousterhout do > a good job explain these topics in depth? > > Thanks! can help you cheap:; http://freecomputerbooks.com/langTclBooks.html -- -- -- What's on Shortwave guide: choose an hour, go! http://shortwave.tk 700+ Radio Stations on SW http://swstations.tk 300+ languages on SW http://radiolanguages.tk marc wrote: > Asif wrote: > >> Hi! >> >> I am looking for material that explains the tcl C API in order to: >> >> - Embed Tcl into a C application. >> - Extend Tcl to add new commands in C. >> >> Does Tcl and Tk Toolkit (2nd Edition) by Ken Jones and John Ousterhout do >> a good job explain these topics in depth? >> >> Thanks! > > > can help you cheap:; > http://freecomputerbooks.com/langTclBooks.html Would you really trust a site which *PRESUMES* the whole world uses their preferred settings and the heck with the visually imperfect. The resu...

Pass an array as a command line argument to a tcl script
Hi, I have perl program which internally calls an expect script to download some files from an ftp server. Is it possible to pass an array as a command line option to the expect script? Pls help me. On Dec 8, 9:21=A0am, Sooraj S <soorajspadmanab...@gmail.com> wrote: > I have perl program which internally calls an expect script to > download some files from an ftp server. > > Is it possible to pass an array as a command line option to the expect > script? Values can normally[*] only be passed between programs as strings, so you'll need to convert your array to a sequence of one or more argument strings that are parsed by expect script. There are many tools in Tcl (and hence in Expect) for parsing strings; argument strings are kept in the global $argv variable (as a Tcl list; use [lindex] to get a particular one or [foreach] to iterate over all of them). The only character that can't be passed that way is a NUL byte, as that's reserved for use by the OS (as a string terminator). Without knowing exactly how you're converting the array to a string on the Perl side, it's hard to advise how to unpack things on the Tcl/ Expect side. Show some code and/or an example of the sort of string that gets passed, and we'll be able to tell you exactly what to do. Donal. [* In the non-normal case, there's serialization libraries. This is a complex area, and possibly overkill for this case. ] At 2010-12-08...

TCL open new command line within script
Is there a way to open a new command line window from a TCL gui that is not getting started in an existing command line? I've created a gui using VTCL and would like to just open the file by double clicking it rather than using the command line to start the script. Once the TCL script is running I then want to use Expect to do some things such a telnet and sending some commands to a remote computer. I'm having no trouble with doing this when i start the initial script in the command line, but when i try to open the file by just double clicking on it, none of the commands work. Any help would be great. Thanks! maleone41@gmail.com wrote: > Is there a way to open a new command line window from a TCL gui that is > not getting started in an existing command line? What OS? > I've created a gui using VTCL and would like to just open the file by > double clicking it rather than using the command line to start the > script. Once the TCL script is running I then want to use Expect to do > some things such a telnet and sending some commands to a remote > computer. > > I'm having no trouble with doing this when i start the initial script > in the command line, but when i try to open the file by just double > clicking on it, none of the commands work. > > Any help would be great. Thanks! > -- +--------------------------------+---------------------------------------+ | Gerald W. Lester ...

in TCL command == catch , but in per command == ??
In tcl, we can use a catch command such as ... if { [catch {`ls *.txt`}] == 0 } { puts "file not exist" set failure 1 } Can Perl do this? or is there any simultanous command? kiangleng@hotmail.com (Lim kiang Leng) wrote: # In tcl, we can use a catch command such as ... # # if { [catch {`ls *.txt`}] == 0 } { You might get better performance with [catch {glob *.txt}]==0 or [llength [glob -nocomplain *.txt]]==0 # puts "file not exist" # set failure 1 # } # # Can Perl do this? or is there any simultanous command? perl -e 'print "...

Extending TCL in C with tcl.h - Disabliing [<tcl-cmd>] feature
Hi, TCL has a command execution syntax like this: [<tcl cmd>] Anything inside the 3rd bracket will be executed as a Tcl command by the Tcl interprater. Is there any way I can disable/delete this Tcl construct [ <tcl-cmd>]? In other words, my Tcl interprator should print "[32]" for tcl command puts "[32]" It should not try to treat [] as a special character. Is this any way possible while extending Tcl in C with tcl.h? Thank you, Arijit * arijit79@gmail.com | puts "[32]" | | It should not try to treat [] as a special character. Check out the TCL quoting rules. http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M10 http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M15 Any of puts {[32]} puts "\[32\]" will do the trick. R' On May 8, 3:14 am, ariji...@gmail.com wrote: > Is there any way I can disable/delete this Tcl construct [ <tcl-cmd>]? By doing this, you would disable the primary functionality of Tcl. I'm certain you could go into the tcl source and stop it - but why not talk about what you are really trying to do. Perhaps someone can give you a better way of doing what you are wanting to do. ...

TCL/TCL combined with Java/C/C++, Any Recommendations?
Hi, I have an application that I wrote in TCL/TK. It has to work with big files +5GB. The parsing performace is not where I would like and some of the data manipulations are taking considerable amount of time due to the data size. Therefore I am considering switching these parts of the code to Java, C or C++. While keepting the GUI and GUI supporting code in TCL/TK at this time. I am trying to figure out which language will be easier to merge with TCL in an application. For C I know that I can compile and generate a .so or .dll and create a TCL package and load it. I believe this is done with SWIG but I have not done it. In Java I saw some info on Jacl and TclBlend. The application will be "compiled" into a TCL "executable". I know I can compile my TCL code into Byte code to protect the IP. I am not sure about Java. Any recommendations or pointers will be greatly appreciated. Thanks in advance, Frank Frank <kranfg@gmail.com> writes: > Hi, > > I have an application that I wrote in TCL/TK. It has to work with big files +5GB. > > The parsing performace is not where I would like and some of the data manipulations are taking considerable amount of time due to the data size. > > Therefore I am considering switching these parts of the code to Java, C or C++. While keepting the GUI and GUI supporting code in TCL/TK at this time. > > I am trying to figure out which language will be easier to ...

Writing new tcl command using c or c++?
Can anyone help me to write new command that can be used in tcl shell using c or c++ code. Himanshu Gupta <himanshulkce@gmail.com> wrote: > Can anyone help me to write new command that can be used in tcl shell > using c or c++ code. Start here: http://wiki.tcl.tk/9849 and here: http://wiki.tcl.tk/21007, read these and then follow and read the links to the other pages from the above two. On Monday, 5 January 2015 14:12:44 UTC+5:30, Himanshu Gupta wrote: > Can anyone help me to write new command that can be used in tcl shell using c or c++ code. Thankyou... On M...

tcl-pam: PAM authentication for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-pam Tcl-pam is a Tcl interface to the PAM* service of Linux. It provides a Tcl package that allows Tcl scripts to use PAM to authenticate users and programs. It relies on linux-pam library: http://www.kernel.org/pub/linux/libs/pam/ * PAM (Pluggable Authentication Modules): A mechanism to integrate multiple low−level authentication schemes into a high−level application programming interface (API). This enables programs that rely on authentication to be written independently of the underlying authentication scheme. Platform: Linux Home page: http://sourceforge.net/projects/tcl-pam/ Man page: http://tcl-pam.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-gaul: Genetic Algorithms for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-gaul Tcl-gaul is a Tcl extension for genetic/evolutionary algorithm processing.It relies on the GAUL library: http://gaul.sourceforge.net/ * A genetic algorithm (GA) is a search technique used in computing to find exact or approximate solutions to optimization and search problems. Genetic algorithms are categorized as global search heuristics. They are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover. For an introduction to genetic algorithms visit: http://gaul.sourceforge.net/intro.html Platform: Linux (GAUL library dependency) Home page: http://sourceforge.net/projects/tcl-gaul/ Man page: http://tcl-gaul.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-mmap: A POSIX mmap interface for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mmap Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides a Tcl package that allows Tcl scripts to: 1) Memory map files for improved access efficiency; 2) Share memory between related processes; 3) Easily implement cyclic persistent log files. * See the mmap(2) man page. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-mmap/ Man page: http://tcl-mmap.sourceforge.net/ Author: Alexandros Stergiakis On Sep 3, 11:48=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl project: tcl-mmap > > Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides > a Tcl package that allows Tcl scripts to: 1) Memory map files for > improved access efficiency; 2) Share memory between related processes; > 3) Easily implement cyclic persistent log files. > > * See the mmap(2) man page. > Great to see this and the other packages you made. Looking at the manpage it looks a bit misformatted before the usage example. Any specific reason to use GPL for this instead the usual Tcl/MIT/BSD style license used? Michael schlenk wrote: > On Sep 3, 11:48 am, Alexandros Stergiakis <alst...@gmail.com> wrote: >> This is an announcement for a relatively new Tcl project: tcl-mmap >> >> Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides >> a Tcl package that...

tcl-syslog: Unix system logging for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-syslog Tcl-syslog is a Tcl interface to the *nix syslog service. It provides a Tcl package that allows Tcl scripts to log messages to syslog. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-syslog/ Man page: http://tcl-syslog.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-mq: POSIX Message Queues for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mp Tcl-mp is a Tcl interface to POSIX Message Queues*. It provides a Tcl package that allows scripts to create/open/close/unlink multiple parallel message queues, and to send/receive messages synchronously and asynchronously to/from them. * A POSIX message queue is an Inter-Process Communication mechanism available on Linux and some other POSIX-compliant operating systems. It allows to or more processes (or threads) to communicate under the same OS. The messages are buffered by the kernel, which gives them kernel persistency. A message queue can be thought of as a linked list of messages. Threads with adequate permission can put messages onto the queue, and threads with adequuate permission can remove messages from the queue. Each message is assigned a priority by the sender, and the oldest message of highest priority is always retrieved first. Unlike PIPES and FIFOS, no requirement exists that someone be waiting for a message to arrive on a queue, before some process writes a message to that queue. It's not even a requirement for both processes to exist at the same time. Read mq_overview(7) for more details Platform: Linux Home page: http://sourceforge.net/projects/tcl-mp/ Man page: http://tcl-mp.sourceforge.net/ Author: Alexandros Stergiakis alsterg On Sep 3, 11:37=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl pro...

Quartus II TCL or Command line
hi all, How can I add VHDL files to Quartus II project using TCL or command line??? Thank you, AA <ahmedablak0@gmail.com> wrote: > hi all, > How can I add VHDL files to Quartus II project using TCL or command line??? I can't see anything in the TCL packages: http://quartushelp.altera.com/current/mergedProjects/tafs/tafs/tcl_list_of_packages.htm but look at your existing .qsf file - the command should be in there for files already in your project. Quartus TCL reference if you haven't already seen it. http://www.altera.co.uk/literature/hb/qts/qts_qii52003....

TCL commands across multiple lines
Hey folks, I'm using incremented tcl and have been running into problems lately. With many of my procedure calls I was finding that, given long variable names, I was having lines far exceeding 70 characters. For example: set l_danglingRange [generate_expected_key_event_ranges -dangling $i_keyType $i_confHT $i_pressTime $i_releaseTime ] Which I try to clean up as: set l_danglingRange [generate_expected_key_event_ranges -dangling \ $i_keyType \ $i_confHT \ $i_pressTime \ $i_releaseTime ] In some cases I have problems with the '\' version while the other is fine. But it seems that the following is OK: set l_stops [ list \ [ expr { $CLASS_PTI_OFFSET + 1 } ] \ [ expr { $CLASS_EVENT_CODE_OFFSET + 3 } ] \ [ expr { $CLASS_KEY_CODE_OFFSET + 1 } ] ] Can someone explain or point me to a good reference that can explain when I can and when I can not escape the end of a line in this way? Thanks alot, Steve steve_blah wrote: > set l_danglingRange [generate_expected_key_event_ranges -dangling \ > $i_keyType \ > $i_confHT \ > $i_pressTime \ > $i_releaseTime ] > > In some cases I have problems ...

Using tcl as command / scripting language
I have been using an alternative to cmd.exe (windows) (now) call tcc for ye= ars. Its published by jpsoft.com They recently added embedded support for m= any scripting languages, ie perl, ruby, python and tcl ( they supported rex= x for years)=20 The way it works is that when tcc starts and tcl support in enabled it load= the tcl dll. I found this support interesting. I was testing how it works= and came up with some observations =96 so if I had a file foo.tcl and typed=20 foo=20 (depending on the ways the search order was set up) tcc would pass foo.tcc = to the load tcl code.=20 Since tcl was loaded as a dll, it was running in the same process as tcc so= cmds like=20 set ::env(foo) =93bar=94=20 would set foo to bar in the cmd shell. What did not make sense is that when= in the foo.tcl=20 the standard tcl variables argv argv0 and argc were not set =96 I also dis= covered that when I=20 issue the tcl command =93info vars=94 nothing comes back, ie no variable ex= ist =20 So, my question is =96 is it =93best practice=94 when loading/including tc= l as part of your own =93exe=94 is the task of the caller of the =93start i= nterpreter=94 code to also set argv argc ( and maybe argv0 ) variables?=20 ...

How to write command line interface using TCL ?
I'm planning to write a command line interface, where i can accept the command and needs to process that command(function) in the background. But needs to get the prompt immediatley with out waiting for the function to return, so that i can execute the other command in sequence to stop that process ( command ). Also i was looking into eventLoops, it seems that didnt help much it waits for the function to return.. Any help is really appreciated, Got stuck here for a day.. "NEED HELP " thanks, -GK In article <f9c9dd5a.0401060144.182590b5@posting.google.com>, gk <gopik...

Running different versions on a command from C and Tcl
Hi all, I have written an application which is a mixture of Tcl, and C. One of the C commands I have defined takes a block of Tcl code as a string, substitutes any %? strings it finds with local information, and then evaluates it using Tcl_Eval. Now suppose that in the Tcl I have defined a procedure, which I'll call X. When the user interacts with the application through the command line, and they call X, then the Tcl procedure will be called directly. However, if the user passes a command to the C function which contains a call to X, then I want that call to X to do something slightly different. How can I effectively define two different versions of a procedure with the same name, such that a direct call to the procedure calls one version, and a call to the procedure in the context of a Tcl_Eval does something different? I want the user to believe that they are always calling procedure X, so using a different name in different contexts is not a feasible solution. I did consider simply arranging for the C function to do a search for the string X, and replace any occurrences with the name of my replacement procedure. However, there is a possibility that the name of the procedure might appear elsewhere, such as in quoted strings, in which case search and replace wouldn't really work. How else might I achieve this effect? Performance is important, so I'd like a method which was reasonably fast. thanks, dan. ...

Web resources about - TCL C API: receiving command from a script or from tcl command line ? - comp.lang.tcl

Commercial mail receiving agency - Wikipedia, the free encyclopedia
A commercial mail receiving agency ("CMRA"), also known as a mail drop, typically operates as a Private Mail Box Operator. A customer of a CMRA ...

Underwriters Begin Receiving Their Shares Of Facebook IPO Profits
Lead underwriter Morgan Stanley began doling out the $100 million or so in profit earned by banks as a result of Facebook’s initial public offering ...

Texas Tribune - To stop Planned Parenthood from receiving... - Facebook
To stop Planned Parenthood from receiving public financing, Texas’ Republican leaders gambled that the state could operate the Women's Health ...

Receiving Money (@richardatdell) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Giving and receiving thanks
That most American holiday, Thanksgiving, is upon us. Lots of you are turning to Twitter to express gratitude for the things you feel most grateful ...

Shipping & Receiving - Flickr - Photo Sharing!
Some cargo containers at the International Marine Terminal on Commercial Street. Corey Templeton Photography - Portland Daily Photo - Facebook ...

Nicholas Merrill Speaks Out About Receiving a National Security Letter - YouTube
The first rule of national security letters? You can't talk about national security letters. THUMBS UP for protecting the freedom of speech and ...

More children receiving psychological care at Dubai hospital
... counselling department at Latifa Hospital in Dubai since the beginning of this year, 157 cases were new. DUBAI // The number of children receiving ...

'Napalm girl' Kim Phuc receiving laser treatment for Vietnam War scars
In the photograph that made Kim Phuc a living symbol of the Vietnam War, her burns aren't visible &mdash; only her agony as she runs wailing ...

Facebook Email Addresses - Users Not Receiving Mail Issue
Facebook: we're fixing email and address book issues

Resources last updated: 3/13/2016 4:28:02 PM