Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f21a4d3109d713230b7e35ec6a7c169ebc1bdf6e
Ticket: 218408ffffffffffffffffffffffffffffffffff
How to save/restore Tcl interpretor state in C ?
User & Date: nobody on 2000-10-26 00:57:13
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 5369 Bug
    Version: 8.3.1
    SubmitDate: '2000-05-05'
    LastModified: '2000-05-11'
    Severity: LOW
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Windows NT
    FixedDate: '2000-10-25'
    ClosedDate: '2000-05-11'
    
    
    Name:
    Christophe Cognault
    
    ReproducibleScript:
    In C code, I want to save interpretor state, do a Tcl_Eval and
    restore interpretor state, but I don't find any API
    suitable for my need.
    
    In details:
    
    I need that because I translate error message in C code by using
    Tcl_Eval of an 'msgcat::mc' command, but I don't want that
    this particular Tcl_Eval modify the current interpretor state.
    Use of Tcl_SaveResult/Tcl_RestoreResult and saving/restoring
    errorInfo and errorCode are not sufficient because Tcl_Eval
    modify the flags of current interpretor and I cannot save/restore
    these flags. And so, in case of error, after translation done,
    I loose call stack up to C code, e.g.:
    I have Tcl code that calls a command implemented in C that calls
    Tcl code with Tcl_Eval. In case of error in the inner Tcl code,
    I want to get all the call stack in errorInfo, BUT my C code
    calls Tcl_Eval another time in order to translate an error message
    and the second Tcl_Eval erases Interp::flags of current interpretor
    so I loose the call stack in errorInfo, 
    because, on next call to Tcl_AddErrorInfo, errorInfo is cleaned.
    
    I think to use 2 interpretor, a main interpretor and a "translator"
    interpretor but this is not very convenient for my application,
    so at this moment I implement a kind of Tcl_SaveState/Tcl_RestoreState
    (but in a very bad way, no stubs, save very few things, bad code...)
    and I see in tclNamesp.c (1.17) at line 371 in func Tcl_PopCallFrame
    a comment saying:
         * What's really needed is a general-purpose mechanism for saving and
         * restoring interpreter state.
    
    So is this mechanism planned or event exist ?
    
    DesiredBehavior:
    Having Tcl_SaveState/Tcl_RestoreState in C API ?
    
    
    
    The user is likely better off with the two interp model, because
    there is nothing in the Tcl C API to exactly handle what they need,
    aside from the Tcl*Result functions. 
    -- 05/11/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.3.1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "How to save/restore Tcl interpretor state in C ?"
  11. type changed to: "RFE"