Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: edefae59f857acb661ab98dfaeb6be9dc43a1e38
Ticket: 1061224fffffffffffffffffffffffffffffffff
"expr sqrt(-1)" crash with EXCEPTION_FLT_INVALID_OPERATION
User & Date: davygrvy on 2004-11-09 10:20:14
Changes

  1. icomment:
    Logged In: YES 
    user_id=7549
    
    Initial call in my bridge:
    
    struct Tcl_NotifierProcs us = {
        Tcl_SetTimer,
        XiRCwaitForEventProc,
        0L,
        0L,
        Tcl_InitNotifier,
        Tcl_FinalizeNotifier,
        Tcl_AlertNotifier,
        Tcl_ServiceModeHook
    };
    originalW4EP = (Tcl_WaitForEventProc *)
    GetProcAddress(hTclMod, "Tcl_WaitForEvent");
    Tcl_SetNotifier(&us);  // Need to specify our own!
    
    
    Thunk stuff ended up being:
    struct ThunkData {
        int cwords;
    };
    
    void
    EnterToMsvcrt (ThunkData *data)
    {
        // See
    https://sourceforge.net/support/tracker.php?aid=1061224
        data->cwords = _controlfp(0, 0);
        _controlfp(CW_DEFAULT, 0xFFFF);
    }
    
    void
    LeaveFromMsvcrt (ThunkData *data)
    {
        _clearfp();
        _controlfp(data->cwords, 0xFFFF);
    }
    
    #define ENTER \
        ThunkData data; EnterToMsvcrt(&data)
    
    #define LEAVE \
        LeaveFromMsvcrt(&data)
    
    All the exports to the app are protected by ENTER and LEAVE:
    int
    fake_Tcl_EvalFile (Tcl_Interp *interp, char *fileName)
    {
        ENTER;
        int result = Tcl_EvalFile(interp, fileName);
        LEAVE;
        return result;
    }
    
    My Tcl_WaitForEvent got a bit tricky, though, to prevent an
    infinite loop:
    int
    XiRCwaitForEventProc (Tcl_Time *timePtr)
    {
        ENTER;
        int result;
        struct Tcl_NotifierProcs stuff = {
    Tcl_SetTimer,
    originalW4EP,
    0L,
    0L,
    Tcl_InitNotifier,
    Tcl_FinalizeNotifier,
    Tcl_AlertNotifier,
    Tcl_ServiceModeHook
        };
    
        Tcl_SetNotifier(&stuff);
        result = originalW4EP(timePtr);
        stuff.waitForEventProc = XiRCwaitForEventProc;
        Tcl_SetNotifier(&stuff);
        LEAVE;
        return result;
    }
    
    I'll make a note here if this passes the acid test I'll
    start working on now.  I think I've got XiRCwaitForEventProc
    upside down, but not sure yet.
    
    
  2. login: "davygrvy"
  3. mimetype: "text/plain"
  4. username: "davygrvy"