f



Why is a C routine returned string not found by the Tcl interpreter ?

Here is my Tcl code for the manubutton and cascade creation:

  button $base.button_undo  -text "<<" -command undo_canvas
    button $base.button_redo  -text ">>" -command redo_canvas
    menubutton $base.button_rescale -text "RESCALE" -menu
$base.button_rescale.menu -relief raised  -state disabled
    set m [menu $base.button_rescale.menu  -tearoff 1]
    $m add command -label 1 -state disabled  -command {puts "1 incident
particle per sec."}
    $m  add separator
    $m add cascade -label AINT -state disabled -menu $m.sub1
    set m2 [menu  $m.sub1 -tearoff 0]
    $m2  add radio  -label  1.e10 -variable aint  -value 1.e10
-command change_RZ_hist_aint
    $m2  add separator
    $m2  add radio  -label  1.e12 -variable aint  -value  1.e12
-command change_RZ_hist_aint
    button $base.button_asrt  -text "1:1"

   grid $base.button_undo -in $base.frame_undoredo -row 1 -column 1
-sticky nesw
    grid $base.button_redo -in $base.frame_undoredo -row 1 -column 2
-sticky nesw
    grid $base.button_rescale -in $base.frame_undoredo -row 1 -column 3
-sticky nesw
    grid $base.button_asrt -in $base.frame_undoredo -row 1 -column 4
-sticky nesw

When a histogram get selected and loaded then the RESCALE manubutton
gets enabled  (this behaves fine).  So the Tcl interpreter  detects the
OK status returned by the C function "check_hist_aint_option". Howeer
it canot find the string returned by such a rouine.


proc pick_hist {} {
    global plot
    global hist_info
    global base
    global Ntype

    set idx [$hist_info(list) curselection]

    if { $idx != "" } {

	if { $hist_info(id,$idx) != $hist_info(hid) } {
	    set hist_info(hid) $hist_info(id,$idx)
	    set hist_info(binmin) -99
	    set hist_info(binmax) -99
	}

	read_hist $hist_info(hid)
	set_hist_active $hist_info(hid) 1

	set plot(histlbl) ON
	append plot(histlbl) ( $hist_info(hid) )

	set hist_info(min) [get_hist_min]
	set hist_info(max) [get_hist_max]

	set plot(mode) 1
	draw_canvas 0
    }
# MEM  05/26/06
# enable RESCALE menubutton if picked histogram can be rescaled
#
    if {[catch {check_hist_aint_option} results] != 0} {
        $base.button_rescale  configure -state disabled
      } else {
        $base.button_rescale  configure -state normal
      }
     set line [check_hist_aint_option $Ntype]
     scan $line {%s} rescale_type
     if { [string compare $rescale_type "N1"] == 0 } {
	 $base.button_rescale.menu.command  configure -state disabled
         $base.button_rescale.menu.cascade configure -state normal
..    }
     else {
         $base.button_rescale.menu.command  configure -state normal
         $base.button_rescale.menu.cascade configure -state disabled
     }
#    if { $hist_info(frame) != "" } {
#	destroy $hist_info(frame)
#	set hist_info(frame) ""
#    }

    return
}


/************************************************************************************/
/* verify the AINT rescaling option is available for the currently
active histogram */
/*
            */
static int
check_hist_aint_option_cb( ClientData clientData,
                           Tcl_Interp *interp,
                           int argc, char *argv[] ) {
  int i;

  if ( hg.active_ <= 0 ){
     Tcl_SetResult( interp,
                    "Histogram not active !",
                    TCL_STATIC );
     return TCL_ERROR;
  }

  if (((1 <= hg.hid_ <= 700)&&(hg.hid_!= 9)&&(hg.hid_!= 10)) ||
     ((1001 <= hg.hid_ <= 1700)&&(hg.hid_!= 1009)&&(hg.hid_!= 1010)) ||
     ((2001 <= hg.hid_ <= 2700)&&(hg.hid_!= 2009)&&(hg.hid_!=2010)))
      sprintf( tclres_buffer, "N1");
  else if ((701 <= hg.hid_ <= 1000)||(hg.hid_== 9)||(hg.hid_== 10) ||
                                     (hg.hid_== 1009)||(hg.hid_== 1010)
||
                                     (hg.hid_== 2009)||(hg.hid_==
2010))
      sprintf( tclres_buffer, "N2");
  else {
      printf ("\n Histogram Normalization ERROR.\n");
      return TCL_ERROR;
  }
  Tcl_SetResult( interp, tclres_buffer, TCL_VOLATILE );
  return TCL_OK;
}

Is there an error in passing back a value from C to Tcl ?
In addition, how can I name/identify the "command" and "cascade"
element of the menu in order to manipulate/change their status
dynamically ?
I tried the following syntax but I'm pretty sure that the interpreter
will reject it when it has a chance to get that far  ...

	 $base.button_rescale.menu.command  configure -state disabled
         $base.button_rescale.menu.cascade configure -state normal

Thank you in advance,
Maura

0
6/1/2006 11:11:30 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

5 Replies
432 Views

Similar Articles

[PageSpeed] 1

> Is there an error in passing back a value from C to Tcl ?

That is quite a bit of code to wade through, but it looks to me like
you're grabbing the return value but not using it.  The line

>     if {[catch {check_hist_aint_option} results] != 0} {

puts the return value into the variable $results, while [catch] returns
the status code.  You are using the call to [if] to deal with the
status code, but as far as I can tell you're not doing anything with
$results.

0
aric.bills (466)
6/2/2006 12:46:18 AM
You hit the nail on the head. Atually $results seems to contain the
data passed back from the C routine to the Tcl interpreter. I have
changed it to:


    if {[catch {check_hist_aint_option} results] != 0} {
        $base.button_rescale  configure -state disabled
      } else {
        $base.button_rescale  configure -state normal
      }
     scan $results {%s} rescale_type
     if { [string compare $rescale_type "N1"] == 0 } {
	 $base.button_rescale.menu.command  configure -state disabled
         $base.button_rescale.menu.cascade configure -state normal
..    }
     else {
         $base.button_rescale.menu.command  configure -state normal
         $base.button_rescale.menu.cascade configure -state disabled
     }

But now I'm stuck a little bit further on.
As I expected the Tcl interpreter cannot understand the following
commands:

         $base.button_rescale.menu.command  configure -state disabled
         $base.button_rescale.menu.cascade configure -state normal

What I'm trying to do is to manipulate the state of the two menu
elements created by:

 menubutton $base.button_rescale -text "RESCALE" -menu
$base.button_rescale.menu -relief raised  -state disabled
    set m [menu $base.button_rescale.menu  -tearoff 1]
    $m add command -label 1 -state disabled  -command {puts "1 incident
particle per sec."}
    $m  add separator
    $m add cascade -label AINT -state disabled -menu $m.sub1
    set m2 [menu  $m.sub1 -tearoff 0]
    $m2  add radio  -label  1.e10 -variable aint  -value 1.e10
-command change_RZ_hist_aint
    $m2  add separator
    $m2  add radio  -label  1.e12 -variable aint  -value  1.e12
-command change_RZ_hist_aint


How can I identity the  commnd and the cascade that make up the menu ?
They have no name  ....

Thanks,
Maura

0
6/2/2006 4:37:36 AM
Menu entries can be manipulated dynamically using the entryconfigure
subcommand.  You can identify a menu entry using the text of the label.
 There are a number of other ways to identify entries--for full
details, read the "Widget Command" section of the menu man page:

    http://www.tcl.tk/man/tcl/TkCmd/menu.htm#M24

You should be able to do something like this:

    $m entryconfigure AINT -state disabled

where $m contains the widget path name of the menu in question.

If for some reason you need *really* dynamic menus, you can use the
-command option on the menu in question to populate the menu just
before it gets posted.

0
aric.bills (466)
6/2/2006 5:05:52 AM
In article <1149223056.924529.77630@c74g2000cwc.googlegroups.com>,
maura.monville@gmail.com <maura.monville@gmail.com> wrote:
			.
			.
			.
>     scan $results {%s} rescale_type
			.
			.
			.
Do you expect this to have an effect different from

    set rescale_type $results
?
0
claird (2363)
6/2/2006 10:14:08 AM
claird@lairds.us (Cameron Laird) writes:

> In article <1149223056.924529.77630@c74g2000cwc.googlegroups.com>,
> maura.monville@gmail.com <maura.monville@gmail.com> wrote:
> 			.
> 			.
> 			.
> >     scan $results {%s} rescale_type
> 			.
> 			.
> 			.
> Do you expect this to have an effect different from
> 
>     set rescale_type $results
> ?

It depends on whether there are any whitespace characters in $results.

I can't vouch for this being the *reason* for scan in this case.



-- 
Donald Arseneau                          asnd@triumf.ca
0
asnd (4601)
6/2/2006 1:52:55 PM
Reply:

Similar Artilces:

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_ &...

return string vom tcl to c++
Hello! I have a program, which combines tcl and c++. At the moment I use the two functions Tcl_GetIntFromObj and Tcl_GetWideIntFromObj to return integers and longs from my tcl-script to c++. Now I also want to return strings. I have found the function Tcl_GetStringFromObj, but I do not think, that this is the right thing. Thanks for every help! Christian Galbavy Hi Christian, "Christian Galbavy" writes: > Now I also want to return strings. I have found the function > Tcl_GetStringFromObj, but I do not think, that this is the right > thing. It should be the one. Does it give you any problems? benny Christian Galbavy wrote: > Hello! > > I have a program, which combines tcl and c++. At the moment I use the two > functions Tcl_GetIntFromObj and Tcl_GetWideIntFromObj to return integers and > longs from my tcl-script to c++. > Now I also want to return strings. I have found the function > Tcl_GetStringFromObj, but I do not think, that this is the right thing. It is the right thing, but make sure to make a copy of the string if you need it for a longer period (as it gets invalid if the Tcl_Obj it was retrieved from reaches refcount zero) or want to write to it. Michael Hello! Thanks for your help. The problem is already solved. Havaniceday Christian "Christian Galbavy" <slate@sbox.tugraz.at> schrieb im Newsbeitrag news:cn77l9$lod$1@skirner.kfunigraz.ac.at... > Hello! > > I have a program, which com...

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 ...

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. ...

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 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...

Tcl to C or C++
Hi all, does anyone know some tool (free or not) capable to translate Tcl source code to C or C++? Of course I believe to translate only a subset of Tcl language (1), while statements like this: #...some code that algorithmically generate the string a, where a is # almost-arbitrary code eval $a cannot be translated at all, except with somewhat complex solutions! Thank you (1) I'm thinking to traslate Tcl source code written using a subset of Tcl keywords and by following some coding rules; for example I'd avoid this: #...some code that calculates a and b set $a$b 0 Stefano Chiappa Dear Stefano, Is there a reason for wanting this convertion? As I have tried to do such a project in the past, it turned out that the resulting C code was much more slower & memory wasting than the corrsponing tcl code, so I gave up :-) So, for such a tool a severe investment on optimisations has to be made, in order for the generated C code to be of use. I remember that there was at least one such commercial compiler in the past, but I don't know if it is still active. See for example: http://groups.google.com.gr/groups?q=aotto+compiler&hl=el&lr=&group=comp.lang.tcl.*&selm=pgpmoose.200101222138.11399%40non.non.net&rnum=1 I remember that I had tested the compiler and indeed it gave some speedup over the tclc code. However, I believe the speedup was due to the heavy optimisation that was done by the author, and not from the fact that it was converted i...

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-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 ...

how to initialize tcl interpreter in C
all: I want to create a GUI application: pTclInterp =Tcl_CreateInterp(); Tcl_Init(pTclInterp); after Tcl_Init function, I found the result of pTclInterp liked this: "+ result 0x03B80168 "Can't find a usable init.tcl in the following directories: This probably means that Tcl wasn't installed properly." but i installed TCL on my machine, Window XP, and I create a init.tcl file under the same directory as the exe file. where do i put init.tcl to, and what codes should i implement in init.tcl? thanks & regards David David wrote: > all: > I want to create a GUI application: > pTclInterp =Tcl_CreateInterp(); > Tcl_Init(pTclInterp); > after Tcl_Init function, I found the result of pTclInterp liked this: > "+ result 0x03B80168 "Can't find a usable init.tcl in the following > directories: > > > > > This probably means that Tcl wasn't installed properly." > > but i installed TCL on my machine, Window XP, and I create a init.tcl > file under the same directory as the exe file. > where do i put init.tcl to, and what codes should i implement in > init.tcl? Take a look at what the C code for tclsh does on its initialization. -- +------------------------------------------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +--------------...

how to debug tcl running under tcl interep in C++ exe
Hi: I have a C++ exe, which has a tcl interep and loads some tcl files. The exe throws a tcl shell to user where user enters tcl scripts. I want to debug the tcl files while these exe runs. Is there any way/debugger to do this? Regards --Sourav Sourav Sircar schrieb: > Hi: > I have a C++ exe, which has a tcl interep and loads some tcl files. > The exe throws a tcl shell to user where user enters tcl scripts. > I want to debug the tcl files while these exe runs. Is there any > way/debugger to do this? > Regards > --Sourav You could probably load the comm package from tcllib and attach tkcon, tkinspect or one of the other debuggers/consoles to the running interpreter. See http://wiki.tcl.tk/4003 for an overview whats available for debugging. Michael Hi Michael: Thanks for your help. I tried your suggestion in the following way 1. In a shell i started my exe and loaded comm package. It gave me a comm port number 2. In another shell i started tkcon 3. Now i try to attach my exe to tkcon, i use "tkcon attach <comm port>" inside tkcon but it says no interep found. Could you please suggest how should i attach my exe to tkcon? Regards --Sourav sourav.k.sircar@gmail.com schrieb: > Hi Michael: > Thanks for your help. > I tried your suggestion in the following way > > 1. In a shell i started my exe and loaded comm package. It gave me a > comm port number > 2. In another shell i started tk...

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 ...

returning C structure to tcl
Hi what is the possible way to return a C structure from a C file to tcl? I dont wanna use keyedlist or other TclX things. Anything available in tcl should work TIA Puja On Feb 22, 8:25 am, puja.ka...@gmail.com wrote: > Hi > > what is the possible way to return a C structure from a C file to tcl? > I dont wanna use keyedlist or other TclX things. Anything available in > tcl should work A technique that is often used is to simply create a hash entry that points at your C structure. An example of this is the file commands, where 'file1' points at the FILE pointer, as an example. Then your commands take the hash key, look up the real data structure, and operate on it. Unfortunately this means manual management of the object's lifetime. I don't know if it's an appropriate technique for your situation - another might be to fill a Tcl array from C with the different components of your structure, if it's relatively simple. O/H davidnwelton@gmail.com έγραψε: > On Feb 22, 8:25 am, puja.ka...@gmail.com wrote: >> Hi >> >> what is the possible way to return a C structure from a C file to tcl? >> I dont wanna use keyedlist or other TclX things. Anything available in >> tcl should work > > A technique that is often used is to simply create a hash entry that > points at your C structure. An example of this is the file commands, > where 'file1' points at the FILE pointer, as an example. T...

Remembering Tcl: Problems with C and Tcl communicated via pipelines
I am now remembering TCL and I have came across with a problem when doing something I used to do. My purpose is to implement a console-like GUI to present in a listbox outputs from another program written in c and allow to command orders via an entry. All the communication between both programs will be via pipeline As a first approximation, I tried several easy examples and I get stucked with these two programs (see below). When executing tclprogram2.tcl I get Done1 and Done2 and nothing more: i must end it with Ctrl-C. However, if I change Hello3 lines before for loop, the program run smoo...

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...

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...

Call Tcl interpreter from C programm
Quite sure this has been discussed a million times, therefore link to an answer would be gladly accepted. I have a simple program in C: smth. like. .... Tcl_CreateInterp(interp); Tcl_Eval(interp, ...., script); Tcl_DeleteInterp(interp); It works just fine if I set: script = "puts Hello"; but when I do: script = "source {C:/my.tcl}; puts Hello} I recieve unhandled exception (access violation). I traced that this has to do something with encoding (path "C:/my.tcl" is not decoded properly, because some decoding procedure is not set (equal to 0)). Q. How to get rid o...

returning updating c values from tcl
I am trying to write a simple front end front end for a C program. The idea is to update a variable and call a function each time a button is clicked. I am using mktclapp and Tcl_Linkvar and It works fine for the following script: #---------------- set linkedVar 6 button .b -text Go -command START_DRIVER button .e -text Quit -command exit pack .b .e -side left #---------------- But for this script, linkedVar is not updated: #---------------- button .b -text Go -command doIt button .e -text Quit -command exit pack .b .e -side left proc doIt {} { set linkedVar 6 START_DRIVER } #---------------- Where START_DRIVER is the C function being called and linkedVar is the test variable intended to be linked (and updated). Why doesn't this work? The problem occurs even when I make linkedVar global. Thanks. In article <1152428853.062401.310840@m79g2000cwm.googlegroups.com>, <unlikeablePorpoise@gmail.com> wrote: >I am trying to write a simple front end front end for a C program. The >idea is to update a variable and call a function each time a button is >clicked. I am using mktclapp and Tcl_Linkvar and It works fine for the >following script: > >#---------------- >set linkedVar 6 > >button .b -text Go -command START_DRIVER >button .e -text Quit -command exit >pack .b .e -side left >#---------------- > > >But for this script, linkedVar is not updated: >#---------------- >button .b -text Go -command doIt &...

Safe interpreters lose ::tcl::mathfunc::min, ::tcl::mathfunc::max
I've just noticed something odd: safe interpreters lose the min() and max() functions. These are the only ::tcl::mathfunc::* functions that are implemented as procs, and for some reason they are omitted in safe interps. Is this expected behavior, or a bug? Will Duquette wrote: > I've just noticed something odd: safe interpreters lose the min() and > max() functions. > These are the only ::tcl::mathfunc::* functions that are implemented > as procs, and > for some reason they are omitted in safe interps. Is this expected > behavior, or a bug? Tcl Bug 2...

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 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 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 u...

adding events to tcl queue, or using variables and traces (C and TCL)
I'm writing simple testing framework for embedded application. The application is written on C language and runs on microchip PIC microcontroller normally. To test application I made the following: * hardware depended code was picked out from main source and written to separate source files (module_hal.c for example); * two build mode for program: for microchip PIC, using *_hal.c files dealing with real hardware, or for PC, where *_hal.c files contain hardware simulation code and bindings to TCL-commands. Then program was build for PC, I can using TCL commands change input signal states for simulated hardware, for example, or view output signal states. But I need some method to call tcl callback procedure when output signal changes state. I see two methods to achieve this: * map signal state to variable, and then use 'trace' command to bind tcl-scripts to state change events; * add new events to tcl event queue, as described here: http://wiki.tcl.tk/17195 Which method can be more preferable and why? In case if signal state changes too fast, and if I use variable trace, my callback will be called on every state change -- I think it is serious drawback of first method. With second method I can add only one event to queue, and add second only if first event is processed. But as I see, second method requires more complex code in C (now I wrote this code and see it as serious drawback too). May be exists some other methods to call tcl-callbacks on even...

C++/Tcl/C++ Interface
Hi, I'm a newbie in Tcl and Tcl/C++ interfacing. I need to develop a prototype for one of our upcoming project. I've a shared library which provides Tcl procedures to traverse through some graph which is being created upon reading a file of specific format. If I load this shared library in Tcl shell and call those proc to read the specific file and traverse the graph. Graph traversal proc are like: * getting neighbor nodes of a given node * getting the node name and edge names to/from a node Let's name this Tcl library GL (graph lib). Now, in my C++ program I need create a duplicate graph since I don't have capability read that file directly. So from my C++ code, I need to create a Tcl channel, send commands through the Tcl channel for GL procs and get information from those GL procs to my C++ application to build a duplicate graph on my end. Could some one provide hints how to go about this? Any pointers to existing resource (doc/open source code) will be very helpful. Please redirect me to correct group if this is not the most appropriate one. Regards, ~ Soumen Soumen wrote: > Hi, > > I'm a newbie in Tcl and Tcl/C++ interfacing. I need to develop a > prototype for one > of our upcoming project. > > I've a shared library which provides Tcl procedures to traverse > through some graph > which is being created upon reading a file of specific format. If I > load this shared > library in Tcl shell and ca...

return string from c++ to c
Hi all, Not sure if this is OT? I have a function in a library written in C++ which returns a strdup(s.c_str()) to an application written i C. Running Valgrind on my C-application shows this results in memory leaks due to the c_str is never freed. Example: Foo.h #ifdef __cplusplus class Foo { public: std::string getString() { return s; } private: std::string s; }; #else typedef struct Foo Foo; #endif #ifdef __cplusplus extern "C" { #endif extern char *cplusplus_getString(Foo *); // C++ call-back extern char *get_string(Foo *); // C fun...

Web resources about - Why is a C routine returned string not found by the Tcl interpreter ? - comp.lang.tcl

The Interpreter - Wikipedia, the free encyclopedia
The Interpreter is a 2005 political thriller film starring Nicole Kidman , Sean Penn , and Catherine Keener . It was the final film to be directed ...

The Interpreter (@Interpreter_Mag) 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 ...

Contract Interpreter Information Center
... contractors across the nation who represent the backbone of the Language Services Industry. Popular Welcome to the official Contract Interpreter ...

Travel Interpreter - Multilingual Phrasebook on the App Store on iTunes
Get Travel Interpreter - Multilingual Phrasebook on the App Store. See screenshots and ratings, and read customer reviews.

Interpreters and Compilers (Bits and Bytes, Episode 6) - YouTube
This animation explains the difference between interpreters and compilers. It is from Episode 6 of the classic 1983 television series, Bits and ...

Swedish sign-language interpreter steals the show from Eurovision hopefuls
A Swedish sign-language interpreter whose emotional and at times salacious interpretation of a pop performance has stolen the show at the Scandinavian ...

Killing sparks fears for safety of 600 Afghan interpreters
An Afghan interpreter who worked for the Australian army in Afghanistan has been killed in a suspected Taliban revenge attack while he waited ...

All signs suggest Obama's interpreter for the deaf was fake
The international deaf community is up in arms as claims emerged the signed-language interpreter on stage at Nelson Mandela's memorial service ...

Mandela event interpreter was 'sick' but still a 'champion of sign language'
Sign language interpreter at Nelson Mandela's funeral says a schizophrenic episode was to blame for him gesticulating nonsense - but he is still ...

Future bleak for Afghan interpreters
Future bleak for Afghan interpreters

Resources last updated: 3/13/2016 3:51:38 PM