home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!spool.mu.edu!agate!sprite.Berkeley.EDU!ouster
- From: ouster@sprite.Berkeley.EDU (John Ousterhout)
- Newsgroups: comp.lang.tcl
- Subject: Re: varargs problem in Tcl_AppendResult()?
- Date: 14 Sep 1992 22:44:56 GMT
- Organization: U.C. Berkeley Sprite Project
- Lines: 57
- Distribution: na
- Message-ID: <1934l8INNb65@agate.berkeley.edu>
- References: <1992Sep14.021944.17302@sctc.com>
- NNTP-Posting-Host: tyranny.berkeley.edu
-
- In article <1992Sep14.021944.17302@sctc.com>, scott@sctc.com (Scott Hammond) writes:
- |> Re: tcl6.4 on Sun4 (SunOS 4.1.2) built with 'cc'
- |>
- |> Using a simple loop that reads single lines from the user and passes
- |> them to the same interp via Tcl_Eval(), I entered the following:
- |>
- |> ? proc testhis {} { uplevel 1; set x 5 }
- |> result: ''
- |> ? testhis
- |> err result: 'wrong # args: should be "'
- |> wrong # args: should be "
- |> while executing
- |> "uplevel 1"
- |> (procedure "testhis" line 1)
- |> invoked from within
- |> "testhis"
- |>
- |>
- |> result is the value of interp->result. err result is
- |> the same after error detected, followed by information
- |> from Tcl_GetVar() on errorInfo.
- |>
- |> My concern is that the error message is truncated, which
- |> means the varargs stuff in Tcl_AppendResult() isn't working.
-
- Not to worry. It's just a silly bug in the "uplevel" command where it
- goofed up its error messages under the conditions you created. I've fixed
- it in my unrleased sources now. Here's a patch to tclProc.c in case
- you need the fix before the next Tcl release:
-
- *** /tmp/,RCSt1543560 Mon Sep 14 15:43:29 1992
- --- tclProc.c Mon Sep 14 15:42:29 1992
- ***************
- *** 289,294 ****
- --- 289,297 ----
- return TCL_ERROR;
- }
- argc -= (result+1);
- + if (argc == 0) {
- + goto uplevelSyntax;
- + }
- argv += (result+1);
-
- /*
- ***************
- *** 302,310 ****
- * Execute the residual arguments as a command.
- */
-
- - if (argc == 0) {
- - goto uplevelSyntax;
- - }
- if (argc == 1) {
- result = Tcl_Eval(interp, argv[0], 0, (char **) NULL);
- } else {
- --- 305,310 ----
-
-