TclEvalObj does not work
Closed / Duplicate217788ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:43:40
OriginalBugID: 861 Bug Version: 8.1a2 SubmitDate: '1998-11-25' LastModified: '1998-12-08' Severity: SER Status: Closed Submitter: pat ChangedBy: stanton RelatedBugIDs: 786 OS: All OSVersion: NA Machine: NA FixedDate: '2000-10-25' FixedInVersion: NA ClosedDate: '1998-12-08' Date: Mon, 2 Nov 1998 11:59:45 -0800 (PST) To: [email protected] Cc: [email protected] Subject: TclEvalObj does not work From: [email protected] Tcl 8.1a2 Bug email: [email protected] Support: None Severity: 2 OperatingSystem: Other OperatingSystemVersion: SCO Unix, AIX CustomShell: None Synopsis: TclEvalObj does not work ReproducibleScript: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <tcl.h> #define STRING1 "puts \"hello there\"; set a \"hi\"; set b \"there\"; set c \"$a $b\" " void main(void) { Tcl_Obj *ftn1; Tcl_Interp *Interp; // main command interp if ( (Interp=Tcl_CreateInterp()) == NULL) { fprintf(stderr,"Tcl_CreateInterp failed\n"); } if ( (ftn1=Tcl_NewStringObj(STRING1,strlen(STRING1))) == NULL) fprintf(stderr,"Tcl_NewStringObj failed"); if (Tcl_EvalObj(Interp,ftn1,0) != TCL_OK) { fprintf(stderr, "code block failed\n"); } printf("Result [%s]\n",Tcl_GetStringFromObj(Tcl_GetObjResult(Interp),NULL)); if (Tcl_EvalObj(Interp,ftn1,0) != TCL_OK) { fprintf(stderr, "code block failed\n"); } printf("Result [%s]\n",Tcl_GetStringFromObj(Tcl_GetObjResult(Interp),NULL)); if (Tcl_EvalObj(Interp,ftn1,0) != TCL_OK) { fprintf(stderr, "code block failed\n"); } printf("Result[%s]\n", Tcl_GetStringFromObj(Tcl_GetObjResult(Interp),NULL)); } ObservedBehavior: The TclEvalObj only executes the TclObject once, Subsequent TclEvalObj executions fail on that TclObject. If there are many TclEvalObj on multiple TclObject executing multiple times, the programs usually crashes. This code runs fine and is very stable in Tcl 8.0.3 DesiredBehavior: The TclObject from what I understand is supposed to store a byte code representation of the ASCII commands after the first execution of the command. Subsequent execution should be significantly faster when using the byte code. The work around is to use TclEval instead of TclEvalObj which slows down the performance significantly.
welch Closed ticket [217788ffff].
[History diff]2000-10-26 07:49:18
Log in (anonymous is fine) to add a comment.