home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / tcl / 1357 < prev    next >
Encoding:
Internet Message Format  |  1992-09-14  |  2.1 KB

  1. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!spool.mu.edu!agate!sprite.Berkeley.EDU!ouster
  2. From: ouster@sprite.Berkeley.EDU (John Ousterhout)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: varargs problem in Tcl_AppendResult()?
  5. Date: 14 Sep 1992 22:44:56 GMT
  6. Organization: U.C. Berkeley Sprite Project
  7. Lines: 57
  8. Distribution: na
  9. Message-ID: <1934l8INNb65@agate.berkeley.edu>
  10. References: <1992Sep14.021944.17302@sctc.com>
  11. NNTP-Posting-Host: tyranny.berkeley.edu
  12.  
  13. In article <1992Sep14.021944.17302@sctc.com>, scott@sctc.com (Scott Hammond) writes:
  14. |> Re: tcl6.4 on Sun4 (SunOS 4.1.2) built with 'cc'
  15. |> 
  16. |> Using a simple loop that reads single lines from the user and passes
  17. |> them to the same interp via Tcl_Eval(), I entered the following:
  18. |> 
  19. |>     ? proc testhis {} { uplevel 1; set x 5 }
  20. |>     result: ''
  21. |>     ? testhis
  22. |>     err result: 'wrong # args: should be "'
  23. |>     wrong # args: should be "
  24. |>         while executing
  25. |>     "uplevel 1"
  26. |>         (procedure "testhis" line 1)
  27. |>         invoked from within
  28. |>     "testhis"
  29. |> 
  30. |> 
  31. |> result is the value of interp->result.  err result is
  32. |> the same after error detected, followed by information
  33. |> from Tcl_GetVar() on errorInfo.
  34. |> 
  35. |> My concern is that the error message is truncated, which
  36. |> means the varargs stuff in Tcl_AppendResult() isn't working.
  37.  
  38. Not to worry.  It's just a silly bug in the "uplevel" command where it
  39. goofed up its error messages under the conditions you created.  I've fixed
  40. it in my unrleased sources now.  Here's a patch to tclProc.c in case
  41. you need the fix before the next Tcl release:
  42.  
  43. *** /tmp/,RCSt1543560    Mon Sep 14 15:43:29 1992
  44. --- tclProc.c    Mon Sep 14 15:42:29 1992
  45. ***************
  46. *** 289,294 ****
  47. --- 289,297 ----
  48.       return TCL_ERROR;
  49.       }
  50.       argc -= (result+1);
  51. +     if (argc == 0) {
  52. +     goto uplevelSyntax;
  53. +     }
  54.       argv += (result+1);
  55.   
  56.       /*
  57. ***************
  58. *** 302,310 ****
  59.        * Execute the residual arguments as a command.
  60.        */
  61.   
  62. -     if (argc == 0) {
  63. -     goto uplevelSyntax;
  64. -     }
  65.       if (argc == 1) {
  66.       result = Tcl_Eval(interp, argv[0], 0, (char **) NULL);
  67.       } else {
  68. --- 305,310 ----
  69.  
  70.