f



Tcl 8.5 & Vim's Tcl interface

[Pardon the leading period, but I'm hoping the indenting is
preserved to make reading easier]

.. I wanted Vim on windows (x64) that was compiled with Vim's
.. Tcl interface. All went fairly well, I was able to build
.. Vim using window's SDK command line compiler for x64, and I
.. linked against ActiveState's Tcl 8.5.11.0 for x64 using
.. tclstub85.lib to allow dynamic loading of the Tcl DLL.
..
.. [As an aside, I'm hoping to convince Vim's maintainer to
.. build the release version of Vim containing support for all
.. the language interfaces since only an error message would
.. occur if the respective DLL was not found. It appears that
.. the Vim maintainer last checked building against 8.4]
..
.. The Tcl interface works for a simple ":tcl puts Hello" but
.. when I tried anything more I get the error:
..
..   wrong # args: should be "catch command ?varName?"
..
.. This is because Vim creates a replacement "catch" command
.. (I've attached the relevant code below. As the comments
.. state, Vim needs to prevent exit() being called by Tcl. Tcl
.. 8.5 has introduced a new "catch" command that takes an
.. additional argument, and somewhere -- either the Tcl
.. library or tcl85.dll -- uses catch with four arguments. I
.. don't have 8.5's source but I see that auto.tcl, clock.tcl,
.. init.tcl, (I stopped looking) all use the four-argument catch.
..
.. So here's my question: what's the best way this could be fixed?
..
.. I see several possibilities:
..
.. 1) Compile and link Vim against Tcl 8.5 (as I've done) and
..      update Vim's catch replacement.
..    Con: Breaks run-time compatibility with Tcl versions
.. 	prior to 8.5 (is this correct?) If true, this would
.. 	be a BIG problem since a binary Vim installer
.. 	containing the Tcl interface would not work against
.. 	Tcl 8.4 or earlier.
..    Pro: Should work (I don't see any problems here)
..
.. 2) Compile and link Vim against Tcl 8.3
..    Con: I don't have a 64-bit tclstub83.lib (I've got a
.. 	  copy of tcl-8.3.5 source but no 64-bit ActiveState installer)
.. 	Wouldn't the same problem occur? 8.5's library uses
.. 	  the four-argument catch and Vim's catch would fail
..
.. 3) Compile and link Vim against Tcl 8.3/4 but use a
..      run-time test after calling Tcl_InitStubs() to find
..      out what version of Tcl and then replace catch with a
..      version specific routine.
..    Con: Can one determine the version of Tcl after
.. 	  Tcl_InitStubs() has been called?
.. 	Compiling Vim against 8.3/4 but trying to back-port a
.. 	  four-argument catch would be pretty difficult
.. 	  since the dict stuff had not yet been invented,
.. 	  the Tcl header files would not contain any dict
.. 	  declarations, and tclstub83.lib would not have
.. 	  hooks to 8.5's dict routines.
..
.. So, is anything but option #1 viable or even possible?
..
.. ===
.. === Vim's replacement for exit and catch from if_tcl.c (note that
.. === catch checks for exit having been called; this is used by Vim
.. === to determine if the current Tcl interpreter should be deleted
.. === and a new one created):
.. ===
..
.. /*
..  * Replace standard "exit" and "catch" commands.
..  *
..  * This is a design flaw in Tcl -  the standard "exit" command just calls
..  * exit() and kills the application.  It should return TCL_EXIT to the
..  * app, which then decides if it wants to terminate or not.  In our case,
..  * we just delete the Tcl interpreter (and create a new one with the next
..  * :tcl command).
..  */
.. #define TCL_EXIT	5
..
..     static int
.. exitcmd(dummy, interp, objc, objv)
..     ClientData dummy UNUSED;
..     Tcl_Interp *interp;
..     int objc;
..     Tcl_Obj *CONST objv[];
.. {
..     int value = 0;
..
..     switch (objc)
..     {
.. 	case 2:
.. 	    if (Tcl_GetIntFromObj(interp, objv[1], &value) != TCL_OK)
.. 		break;
.. 	    /* FALLTHROUGH */
.. 	case 1:
.. 	    Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
.. 	    return TCL_EXIT;
.. 	default:
.. 	    Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?");
..     }
..     return TCL_ERROR;
.. }
..
..     static int
.. catchcmd(dummy, interp, objc, objv)
..     ClientData	dummy UNUSED;
..     Tcl_Interp	*interp;
..     int		objc;
..     Tcl_Obj	*CONST objv[];
.. {
..     char    *varname = NULL;
..     int	    result;
..
..     switch (objc)
..     {
.. 	case 3:
.. 	    varname = Tcl_GetStringFromObj(objv[2], NULL);
.. 	    /* fallthrough */
.. 	case 2:
.. 	    Tcl_ResetResult(interp);
.. 	    Tcl_AllowExceptions(interp);
.. 	    result = Tcl_EvalObj(interp, objv[1]);
.. 	    if (result == TCL_EXIT)
.. 		return result;
.. 	    if (varname)
.. 	    {
.. 		if (Tcl_SetVar(interp, varname, Tcl_GetStringResult(interp), 0) == NULL)
.. 		{
.. 		    Tcl_SetResult(interp, "couldn't save command result in 
variable", TCL_STATIC);
.. 		    return TCL_ERROR;
.. 		}
.. 	    }
.. 	    Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
.. 	    return TCL_OK;
.. 	default:
.. 	    Tcl_WrongNumArgs(interp, 1, objv, "command ?varName?");
..     }
..     return TCL_ERROR;
.. }
0
use2926 (15)
1/31/2012 7:46:08 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

4 Replies
801 Views

Similar Articles

[PageSpeed] 23

Dave wrote:
> . So, is anything but option #1 viable or even possible?

Best answer would be to change the question.

> . /*
> .  * Replace standard "exit" and "catch" commands.
> .  *
> .  * This is a design flaw in Tcl -  the standard "exit" command just calls
> .  * exit() and kills the application.  

That's correct, at least in this context.

It should return TCL_EXIT to the
> .  * app, which then decides if it wants to terminate or not.  In our case,
> .  * we just delete the Tcl interpreter (and create a new one with the next
> .  * :tcl command).

But that's not really a good solution.

Better solution is to replace [exit] with a command that deletes
the interp.  No use of a custom return code, and thus, no need to
replace [catch] to enable special treatment of the custom return
code.  Note that with the addition of [try] in later Tcl releases,
modifying [catch] is no longer sufficient anyway, to say nothing
of the other places where a custom return code might be encountered.

> .  */
> . #define TCL_EXIT    5
> .
> .     static int
> . exitcmd(dummy, interp, objc, objv)
> .     ClientData dummy UNUSED;
> .     Tcl_Interp *interp;
> .     int objc;
> .     Tcl_Obj *CONST objv[];
> . {
> .     int value = 0;
> .
> .     switch (objc)
> .     {
> .     case 2:
> .         if (Tcl_GetIntFromObj(interp, objv[1], &value) != TCL_OK)
> .         break;
> .         /* FALLTHROUGH */
> .     case 1:
> .         Tcl_SetObjResult(interp, Tcl_NewIntObj(value));

             Tcl_DeleteInterp(interp);
             break;

> .     default:
> .         Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?");
> .     }
> .     return TCL_ERROR;


-- 
| Don Porter            Applied and Computational Mathematics Division |
| donald.porter@nist.gov             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|
0
dgp2341 (685)
1/31/2012 7:59:30 PM
On 1/31/2012 1:59 PM, Don Porter wrote:

>> . static int
>> . exitcmd(dummy, interp, objc, objv)
>> . ClientData dummy UNUSED;
>> . Tcl_Interp *interp;
>> . int objc;
>> . Tcl_Obj *CONST objv[];
>> . {
>> . int value = 0;
>> .
>> . switch (objc)
>> . {
>> . case 2:
>> . if (Tcl_GetIntFromObj(interp, objv[1], &value) != TCL_OK)
>> . break;
>> . /* FALLTHROUGH */
>> . case 1:
>> . Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
>
> Tcl_DeleteInterp(interp);
> break;
>

Wow, thanks for the quick reply.

Vim's if_tcl.c uses Tcl_Eval() and Tcl_EvalFile() to run a script. My 
first thought was to setjmp/longjmp these calls with the replacement
exit() doing the longjmp. However, from your suggestion above, I'm 
thinking that a call to Tcl_InterpDeleted() after the calls to Tcl_Eval 
or Tcl_EvalFile would be the way to go. Am I on the right track?

0
use2926 (15)
1/31/2012 8:51:45 PM
> Vim's if_tcl.c uses Tcl_Eval() and Tcl_EvalFile() to run a script. My 
> first thought was to setjmp/longjmp these calls with the replacement
> exit() doing the longjmp. However, from your suggestion above, I'm 
> thinking that a call to Tcl_InterpDeleted() after the calls to Tcl_Eval 
> or Tcl_EvalFile would be the way to go. Am I on the right track?

Sounds like it.  You'll also want to make use of Tcl_Preserve() and
Tcl_Release().  I suggest you look at the sources for Tcl_Main() for
some guidance.

-- 
| Don Porter            Applied and Computational Mathematics Division |
| donald.porter@nist.gov             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|
0
dgp2341 (685)
1/31/2012 9:09:05 PM
On 1/31/2012 3:09 PM, Don Porter wrote:
>
>> Vim's if_tcl.c uses Tcl_Eval() and Tcl_EvalFile() to run a script. My
>> first thought was to setjmp/longjmp these calls with the replacement
>> exit() doing the longjmp. However, from your suggestion above, I'm
>> thinking that a call to Tcl_InterpDeleted() after the calls to
>> Tcl_Eval or Tcl_EvalFile would be the way to go. Am I on the right track?
>
> Sounds like it. You'll also want to make use of Tcl_Preserve() and
> Tcl_Release(). I suggest you look at the sources for Tcl_Main() for
> some guidance.
>
Using your suggestion it took me all of ten minutes to make the changes.
As far as I can tell Vim is now working with Tcl 8.5
I'll submit the patch to vim.org

Thanks much for the help.
0
use2926 (15)
2/1/2012 4:00:15 AM
Reply:

Similar Artilces:

Tcl-fuse: A Tcl interface to the Linux kernel's FUSE subsystem.
This is an announcement for a relatively new Tcl project: tcl-fuse Tcl-fuse is a Tcl extension that exports the full functionality of the underlying FUSE (File-System in User-Space) Linux kernel feature, to the Tcl programming language. It enables: * Export of the Tcl VFS layer (and all the filesystems implemented in it) to external processes, via the FUSE subsystem. * Easy creation of FUSE filesystems, using Tcl. Dependencies: * Tcl 8.5 or greater. * The running kernel is compiled with FUSE support enabled. Tcl-fuse was developed as a GSoC2008 project, with Tcl as the mentoring...

Binary reader speed comparison
I have a fairly simple binary reader proc that exhibits massive speed differences between Tcl 8.5.8 and Tcl8.6b1.1. Here's the proc: proc readFormatted {filename} { set fd [ open $filename r ] fconfigure $fd -encoding binary -translation binary binary scan [ read $fd 2 ] cc type nextlen if {$type != 75} { return -error "File is not in the expected format" } while {![append buffer [read $fd $nextlen] ; eof $fd]} { binary scan [read $fd 2] cc lastlen nextlen # convert to unsigned value set nextlen ...

Dr. Dobb's Tcl-URL!
QOTW: "Doctor, do you think this rash on my foot would be better cured with a blowtorch or with a belt sander?" -- Darren New "Tcl's language lawyers are so busy getting real work done that they've not stopped to take the time to create a specification." -- lvirden@yahoo.com POTW: Tile Widget Set, version 0.3 by Joe English. This is "an experimental reimplementation of some of the standard Tk widgets" that offers "Native look and feel under Windows XP" and "'Revitalized' look and feel under Unix". http://tktabl...

Dr. Dobb's Tcl-URL!
QOTW: "I don't mind having the posibility of shooting myself in the foot. Just let me have the ability to extract the bullet with some good debugging tools." -- David Gravereaux "Doubt all you want, the truth is Tcl has improved a lot." -- Jeff Hobbs POTW: XOTcl 1.1.0 by Gustaf Neumann and Uwe Zdun. "XOTcl is an object-ori- ented extension of Tcl". "It prevails [sic] the Tcl programming style and the dynamic/introspective nature of the language, rather than introducing other language's styles and rigidness". http://www.xotcl.org ...

Dr. Dobb's Tcl-URL!
QOTW: "Of course in Tcl, we can do whatever we want." -- Benjamin Riefenstahl "I will not mix string and list commands in TCL" -- Phil Powell POTW: Tcl Windows API (TWAPI) 0.2 by Ashok P. Nadkarni. "The Tcl Windows API (TWAPI) extension provides access to functions in the Windows API from within the Tcl scripting language. The extension targets the Windows NT family (NT 4.0, Windows 2000, Windows XP and Windows 2003), and is not supported on the Windows 95/98/ME platforms." http://twapi.sourceforge.net Windows vs. Tcl in an "exec $e...

Dr. Dobb's Tcl-URL!
QOTW: "[E]mbedding via Tcl is The Right Way(r)." -- Jeffrey Hobbs "Keeping histories is a great anti-vandal device." -- Donal K. Fellows POTW: Tcl only needs a little bit of hardware to run well on, for example, the Slug: http://wiki.tcl.tk/14649 Once upon a time, rsh and exec and allied tools were the best tools administrators had for common tasks. Donal Fellows describes more succinct and secure ssh-based approaches now available. http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/402c3545b1518c1e/ Part of the work o...

Dr. Dobb's Tcl-URL!
QOTW: "TCL = The Comfortable Language" -- John Seal http://groups-beta.google.com/group/comp.lang.tcl/browse_thread/thread/4a4e224b072818f1/ "[pkg_mkIndex] is trying to solve a problem that in its full generality is very, very difficult." -- Don Porter POTW: "regexpviewer is a small app for regular expression experimentation." http://freshmeat.net/projects/regexpviewer/ The planetary expert on use of [pkg_mkIndex] (again) advises: don't use [pkg_mkIndex] (mostly). http://groups-beta.google.com/group/comp.lang.tcl/browse_thread/th...

Dr. Dobb's Tcl-URL!
QOTW: "I didn't need to know that its a bad idea or why its a bad idea. I just needed to known why Tcl didn't do what I expected." - ulis "Many Tclers post answers in comp.lang.tcl for the benefit of not just the original poster, but all who may read the archives - but *you* didn't need to know that." - neuronstorm in answer to ulis on c.l.t. "The Tcl-core developers did a lot of hard work, to get a sane semantic for exec even to windows." - Andreas Leitgeb POTW: ANN: Tkhtml alpha 4 available. "Tkhtml" is a Tcl/Tk widget that displays H...

Dr. Dobb's Tcl-URL!
QOTW: "Tcl has such an extensive library of packages that every time I get a new contract and start designing the tool, I find that someone else has already written over 50% of what I need to write and if I want to use it in my test tool almost 100% of the time all that is required is a simple 'package require xxxxxx' and it's available to me." -- Anthony Davis "I'm surprised, how many regular Tcl'ers have a wrong picture of Tcl and nevertheless can still write good code." -- Andreas Leitgeb POTW: Pgtcl 1.4 by Brett Schwarz. "This is ...

Dr. Dobb's Tcl-URL!
QOTW: "That's part of 'marketing'. Tcl for one reason or the other, seems to have done a really good job of getting into companies, but it seems to be a 'black hole' in that nothing gets out again." - David Welton "Also it is self-reinforcing: When there is no 'buzz' surrounding a language, companies don't flaunt it as a 'buzz-word'." - Donald Arsenau, also on c.l.t POTW: ANN: TkHelpBrowser 1.2 TkHelpBrowser is a simple but complete system for displaying user documentation in an application. In addition to providing ...

Dr. Dobb's Tcl-URL!
QOTW: "That Tcl/Tk affords some amount of updating without separate thread handling should be looked upon as a bonus, in that the event loop is far simpler to handle than threading models." -- Melissa Schrumpf "Today at work I was asked to do some very specific (and thought by management to be difficult to impossible) tasks which were one-liners in tcl." -- Gordon Johnstone POTW: Notebook v2.0.3 by Will Duquette. "Notebook is a personal notebook application." "If you've ever used a Wiki on the Web, Notebook is much like a personal Wiki. But it goes ...

Dr. Dobb's Tcl-URL!
QOTW: "I don't believe anything that I haven't measured myself." - Jesus Rivas, world expert on *Eunectes murinus*, probably the world's largest snake http://www.salon.com/news/feature/2006/08/18/anaconda/index1.html "I must admit that from what I've seen, it appears to be more stable than JAVA." - Eric Rice and ... "Thanks We do take a pretty stringent approach to bugs here, and try to stamp them out with a mallet as soon as they show their ugly faces :)." - ... and Jacob Levy from the past POTW: Tcl Plug-In for Eclipse by Greg Pierce...

Dr. Dobb's Tcl-URL!
QOTW: "It was easier to re-train the VB guys to write Tcl than to port the app to VB." - slebetman "... do almost nothing, and still get the job done." - Richard Suchenwirth on Tcl in various aspects POTW: "PgBrowse ver 1.3 is a generic Postgresql database browser that works on Windows, Macintosh and Linux platforms that is written in Tcl/Tk." http://homepage.mac.com/levanj/TclTk Bryan Oakley illustrates the ability to provide "what i exactly want" even in a thread on menu items and tooltips where he doesn't "understand th...

Dr. Dobb's Tcl-URL!
QOTW: "For me stubs is simply a brilliant feature of tcl." -- Georgios Petasis "Sufficient for the day are the regexp-related evils thereof. :o)" -- David McClamrock POTW: You didn't realize that the Homebrew Competition Coordination Program is Tcl-powered (in just under 10,000 lines of source)? http://www.folsoms.net/hccp/ Tktable scrolling remains an issue. Must it be by column only? http://groups-beta.google.com/group/comp.lang.tcl/browse_thread/thread/5ee4ef36980f7c93/da9444d65dd7a653 Melissa Schrumpf shows how simple automation of misce...

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

Bug789040 came back in Tcl 8.4.6 and Tcl 8.5.
Dear All, Bug 789040 caused exec error in Windows 9x and was fixed in 10/04/03. But it came back in Tcl 8.4.6 and Tcl 8.5. Tcl Windows 9x users should be alerted to the possible failure of exec in the current Tcl 8.4.6 and 8.5 releases due to this bug. Chengye Mao http://www.geocities.com/~chengye Chengye Mao wrote: > Bug 789040 caused exec error in Windows 9x and was fixed in 10/04/03. > But it came back in Tcl 8.4.6 and Tcl 8.5. Tcl Windows 9x users > should be alerted to the possible failure of exec in the current Tcl > 8.4.6 and 8.5 releases due to this bug. Have you i...

What's wrong with "fconfigure stdout -encoding utf-8" on windows in Tcl 8.5.10
With my built 8.5.10 I tried to issue command "fconfigure stdout - encoding utf-8" to tclsh on WinXP, the tcl prompt then was shown as two dots instead of percentage sign, C:\>tclsh85t.exe % fconfigure stdout -encoding utf-8 =E2=80=A5date The current date is: 11/29/2011 Tue Enter the new date: (mm-dd-yy) time The system cannot accept the date entered. Enter the new date: (mm-dd-yy) =E2=80=A5 =E2=80=A5 So wonder what's wrong with fconfigure on stdout? Is that the issue? On Nov 29, 7:46=C2=A0am, "wrena...@gmail.com" <wrena...@gmail.com> wrote: > With my built 8.5.10 I tried to issue command "fconfigure stdout - > encoding utf-8" to tclsh on WinXP, the tcl prompt then was shown as > two dots instead of percentage sign, > > C:\>tclsh85t.exe > % fconfigure stdout -encoding utf-8 > =E2=80=A5date > The current date is: 11/29/2011 Tue > Enter the new date: (mm-dd-yy) time > The system cannot accept the date entered. > Enter the new date: (mm-dd-yy) > =E2=80=A5 > =E2=80=A5 > > So wonder what's wrong with fconfigure on stdout? Is that the issue? Short answer: Yes. Longer answer: The encoding in Windows is not UTF-8 but one of cp.... flavors. Question: what did you expect that to do? Mark On 29/11/2011 06:59, Mark Janssen wrote: > Short answer: Yes. > Longer answer: The encoding in Windows is not UTF-8 but one of cp.... > flavors. Also, the code that writes to the (genuine) ...

[ANN] Registration open && 2nd Call For Papers
Hello comp.lang.tcl, fyi ... 22nd Annual Tcl/Tk Conference (Tcl'2015) http://www.tcl.tk/community/tcl2015/ October 19 - 23, 2015 Comfort Suites Manassas 7350 Williamson Blvd, 20109 Manassas, Virginia, USA Important Dates: [[ Attention! Registration is open! Please have a look at http://www.tcl.tk/community/tcl2015/register.html ]] Abstracts and proposals due August 24, 2015 Notification to authors August 31, 2015 WIP and BOF reservations open July 27, 2015 Author materials due September 28, 2015 Tutorials Start October 19, 2015 Co...

A Busy Developer's Guide to Tcl/Tk 8.5
For anyone who is looking for a fairly concise explanation of the highlights of Tcl/Tk 8.5 (or what goodies you'll be missing out on if you don't start planning to migrate), I hope this document might be of some help: http://www.markroseman.com/tcl/guide85.html Mark O/H Mark Roseman ������: > For anyone who is looking for a fairly concise explanation of the > highlights of Tcl/Tk 8.5 (or what goodies you'll be missing out on if > you don't start planning to migrate), I hope this document might be of > some help: > > http://www.markroseman.com/t...

"::tcl::tm::UnknownHandler ::tclPkgUnknown msgcat 1.4" caused by replacing Tcl 8.4.1 with 8.5.7
In the blog http://planet.larrythecow.org/archives/2009-07-26.html "The Twouble with Tcl" Iain Buchanan shows that redefining OPEN proc leads to the errors similar to what I am getting - when I replaced Tcl 8.4.1 with Tcl 8.5.7. In my case I don't know the exact root cause though ... Any ideas how I should proceed with debugging this issue ? Thanks, Alex tclsh c:/Tornado/host/resource/hutils/tcl/makeSymTbl.tcl ppc tmp.o symTbl.c invalid command name "::tcl::tm::UnknownHandler" while executing "::tcl::tm::UnknownHandler ::tclPkgUnknown msg...

Tcl's Future was: Re: Apache 2.0 TCL solution
davidnwelton@gmail.com wrote: [snip] > Part of the problem is that where Rails has had brilliant marketing, > Tcl's has been nothing short of disastrous, so with something like > Rails, that is good technology, hopping on the bandwagon is a pleasant > change from the "trench warfware" world of trying to defend Tcl. > > A recent example: > > http://aspn.activestate.com/ASPN/Mail/Message/tcl-core/3201127 > > Someone 'important' actually used Tcl for an important project, and I > don't even see anyone answering him in public. I doubt any...

Tcl 8.4.x & tcl-dp 4.0.x
Has anyone built tcl-dp 4.0.x on windows against Tcl 8.4.x ? Is it possible to get the windows dll and the source code with modifications? ...

FVWM: Tcl's 'Iconwindow' not working with fvwm-2.5.18-1
I posted this to the "FVWM Users" <fvwm@fvwm.org>, but no one on that list seems to know what is wrong. I use several Tcl/Tk programs (exmh, plus some homegrown ones) that use Tcl's 'iconwindow' function to create dynamic window manager icons. I also use FVWM's IconBox module. For some reason, those applications that use Tcl's 'iconwindow' function, don't get their proper icons in the IconBox. Instead they get the 'default' generic icon. This *used* to work just fine back when I was using fvwm-2.4.<mumble>. What has changed? ...

tcl 8.5.9: extension command's binary string result predictably corrupted
I'm writing a C++ extension against Tcl 8.5.9. My C++-implemented Tcl command returns the wrong result as visible from the Tcl side, but all evidence shows the proper result is being placed into the interpreter's result field from the C++ side. The result is a raw binary string, and the pattern of corruption is reliable. That is, for a particular _desired_ result string S we always wind up with the same corrupted string C(S). Certain *sequences* of characters seem to get corrupted by truncation on the left. I therefore believe I am misusing the API (rather than having some kind of memory corruption in my own code). The relevant C++ code implementing the Tcl command looks like this: #if 0 const char zRes1[16] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0X0D, 0x0E, 0x0F, 0x10}; const char zRes2[16] = {0xC2, 0xA4, 0x7C, 0x44, 0x60, 0x61, 0x0D, 0x10, 0xA6, 0x74, 0x8B, 0xE3, 0xDE, 0x8C, 0xA3, 0x5C}; const char zRes3[16] = {0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2, 0xC2}; #endif const char zRes4[16] = {0xC2, 0xA4, 0xC2, 0xA4, 0xC2, 0xA4, 0xC2, 0xA4, 0xC2, 0xA4, 0xC2, 0xA4, 0xC2, 0xA4, 0xC2, 0xA4}; Tcl_Obj* pOut = Tcl_NewObj(); Tcl_IncrRefCount(pOut); /* (I know this isn't strictly necessary here) */ Tcl_SetStringObj(pOut, (const char*) zRes4, 16); Tcl_SetObjResult(pInterp, pOut); Tcl_DecrRefCount(pOut); /* (obviously this is only here if the corresp...

Web resources about - Tcl 8.5 & Vim's Tcl interface - comp.lang.tcl

Resources last updated: 3/13/2016 10:21:01 AM