Results 1 to 9 of 9

Thread: Passing a UDT to an external macro function

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Age
    82
    Posts
    26
    Rep Power
    15

    Passing a UDT to an external macro function

    I'm using thinBasic as the macro engine for my app (SPFLite) and it works just fine. But I'm creating a new function and am trying to pass a UDT from the macro code to a function in SPFLite. The function is intended to fill in the UDT fields and return.

    Both the macro and SPFLite code are using compatible TYPE definitions. But I can't seem to establish a pointer in the SPFLite code to the UDT area in the thinBasic macro.
    Here's the thinBasic macro:
    ' Try.macro
    SPF_Trace(Off)
    SPF_CMD("CLS")
    type ENVType
       ID  as string * 2
       Num as long
       Txt as asciiz * 100
    end type
    dim ENV as ENVType
    ENV.ID = "XY"
    ENV.Num = 789
    ENV.Txt = "AAAAA"
    
    SPF_Try(ENV)
    
    spf_Debug(ENV.Num)
    spf_Debug(ENV.Txt)
    Halt (OK)
    
    And here's my attempt at the function:
    FUNCTION SPF_Try() AS LONG                                        '
    '--------------------------------------------------------------------------------------------------+
    '- Try stuff                                                                                       |
    '--------------------------------------------------------------------------------------------------+
    LOCAL UDTName, lTxt() AS STRING                                   '
    LOCAL i, pVar, pUDT, lMainType, lSubType, lIsArray, pDirect, ArrayElements, ArrayPtr, lSize, lCounter AS LONG   '
    LOCAL aText AS WSTRING
    LOCAL pENV AS ENVType PTR                                         ' Map the passed area
    LOCAL pRaw AS BYTE PTR                                            ' Temp for step over
       IF thinBasic_CheckOpenParens(%True, %True) THEN                ' An Open (
             thinBasic_VariableParsePtr(pVar)                         ' Get a ptr to a variable (name is ArrayName)
             IF pVar <> %Null THEN                                    ' Got something?
                IF thinBasic_CheckCloseParens THEN                    ' Closed properly?
                   pUDT = thinBasic_VariablePtrToDirectPtr(pVar)      ' Get Direct pointer
                   pENV = thinBasic_DirectPtrToDataPtr(pUDT)          ' Get Data pointer
                   pRaw = pENV
                   FOR i = 1 TO 10
                      debug HEX$(@pRaw, 2)
                      INCR pRaw
                   NEXT i
                   IF @pENV.ID <> "XY" THEN                           ' Is eyeball correct
                      '
                   END IF
                   @pENV.Num = 123                                    ' Stuff in some test values
                   @pENV.Txt = "Hello Sailor"                         '
                END IF
             ELSE                                                     '
                thinBasic_RunTimeError(%ERR__VARIABLE_NOT_DEFINED)    '
          END IF                                                      ' End Close )
       END IF                                                         ' End Open (
    
       FUNCTION = 0: TP.ErrMsgReset                                   '
    END FUNCTION                                                      '
    
    Looking for suggestions

    George

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,850
    Rep Power
    10
    Ciao George,

    understood the question, I will reply this night CET time.
    Sorry no time right now.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,850
    Rep Power
    10
    Please change from this
    pENV = thinBasic_DirectPtrToDataPtr(pUDT)
    
    to this
    pENV = thinBasic_DirectPtrToDataPtr(pVar)
    
    and should work.

    I know, it is a little misleading the name of the interface function but the starting point is always a pointer to internal thinBasic variable.
    internal thinBasic variables are managed by pointer to a structure that point to another structure that point to real data buffer.
    Starting point is always initial pVar populated by thinBasic_VariableParsePtr

    Let me know if it works otherwise I will create a full module example
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    Junior Member
    Join Date
    Jan 2013
    Age
    82
    Posts
    26
    Rep Power
    15
    Quote Originally Posted by ErosOlmi View Post
    Please change from this
    pENV = thinBasic_DirectPtrToDataPtr(pUDT)
    
    to this
    pENV = thinBasic_DirectPtrToDataPtr(pVar)
    
    and should work.

    I know, it is a little misleading the name of the interface function but the starting point is always a pointer to internal thinBasic variable.
    internal thinBasic variables are managed by pointer to a structure that point to another structure that point to real data buffer.
    Starting point is always initial pVar populated by thinBasic_VariableParsePtr

    Let me know if it works otherwise I will create a full module example
    First test looks fine, I'll do some more and if I run into other troubles I'll get back to you.

    Many, many thanks. I've been trying all kinds of variations.

    George

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,850
    Rep Power
    10
    Just checked source code and thinBasic_DirectPtrToDataPtr is definitely misleading.

    It accept a pVariable pointer (first level internal variable structure) and not a pDirect pointer (second level internal variable structure)
    I will add a thinBasic_VariablePtrToDataPtr thinBasic Core API in next release in order to be more precise.

    Maybe you can use thinBasic_VariableParseAndGetInfo API and in one go you will have:
    BYREF VariableName    AS STRING
    BYREF VariablePtr     AS LONG  
    BYREF MainType        AS LONG  
    BYREF SubType         AS LONG  
    BYREF DataPtr         AS LONG  
    BYREF nElements       AS LONG
    

    What version of thinBasic Core engine are you using?
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    Junior Member
    Join Date
    Jan 2013
    Age
    82
    Posts
    26
    Rep Power
    15
    Quote Originally Posted by ErosOlmi View Post
    Just checked source code and thinBasic_DirectPtrToDataPtr is definitely misleading.

    It accept a pVariable pointer (first level internal variable structure) and not a pDirect pointer (second level internal variable structure)
    I will add a thinBasic_VariablePtrToDataPtr thinBasic Core API in next release in order to be more precise.

    Maybe you can use thinBasic_VariableParseAndGetInfo API and in one go you will have:
    BYREF VariableName    AS STRING
    BYREF VariablePtr     AS LONG  
    BYREF MainType        AS LONG  
    BYREF SubType         AS LONG  
    BYREF DataPtr         AS LONG  
    BYREF nElements       AS LONG
    

    What version of thinBasic Core engine are you using?
    I was on 1.11, but upgraded to 1.13 (to see if it made any difference)
    Right now, I'm happy with things and can move ahead.

    George

  7. #7
    Junior Member
    Join Date
    Jan 2013
    Age
    82
    Posts
    26
    Rep Power
    15
    Quote Originally Posted by gddeluca View Post
    I was on 1.11, but upgraded to 1.13 (to see if it made any difference)
    Right now, I'm happy with things and can move ahead.

    George
    I spoke too soon. The thinBasic upgrade seems to now cause a problem.

    I can tun a macro from SPFLite, it works fine and returns to SPFLite as usual. A 2nd invocati9on always ends in a crash, and it turns out to be in the call to thinBasic_Init. I've made no changes to the code which calls thinBasic, so I've no idea. I'll paste in the calling code. It actually runs thinBasic in a separate thread in case the macro goes into a loop.

    George

    FUNCTION MB_Call() AS LONG                                        '
    '--------------------------------------------------------------------------------------------------+
    '- Execute the macro in a seperate thread in case it loops                                         |
    '--------------------------------------------------------------------------------------------------+
    LOCAL idThread AS DWORD                                           '
    LOCAL Arg, RetVal, i, j, WC, WinCtr, lRet AS LONG                 '
    LOCAL MSG, t AS STRING                                            '
       gMacNoLoopTest = %False: gMacroTrace = %False                  ' Reset Users no loop check flag and Trace flag
       gMacThread = CreateThread(BYVAL %Null, 0, CODEPTR(MB_CallThread), BYREF Arg, _   '
                            %THREAD_TERMINATE OR %THREAD_QUERY_INFORMATION, _  '
                            BYVAL VARPTR(idThread))                   '
    
       IF gMacThread <> %INVALID_HANDLE_VALUE THEN                    '
          DO                                                          '
             WC = WaitForSingleObject(gMacThread, 10000)              ' Give macro 10 seconds to execute
             SELECT CASE WC                                           ' What came back?
    
                CASE %WAIT_ABANDONED                                  '
                   '-                                                 '
                CASE %WAIT_OBJECT_0                                   ' Thread did its job and ended by itself
                   GetExitCodeThread(gMacThread, Retval)              '
                   TP.CsrRow = TP.GPTop: TP.CsrCol = TP.GPCmdCol      ' Reset the command line
                   TP.ErrMsgReset                                     ' Clear intermediate errors
                   IF gMacroRC > 0 OR gMacroMsg <> "" THEN            ' Something to issue?
                      TP.ErrMsgAdd(gMacroRC, gMacroMsg)               ' Issue the RC and Msg
                      '--------------------------------------------------------------------------------+
                      '- If error in line command, clear comamnd line                                  |
                      '--------------------------------------------------------------------------------+
                      IF IsFMTab THEN                                 ' If FM then
                         j = IIF(gFMMacMode = 1, %True, %False)       ' Use gFMMacMode
                      ELSE                                            '
                         j = IIF(gEDMacMode = 1, %True, %False)       ' Use gEDMacMode
                      END IF                                          '
                      IF j THEN TP.pCommand = ""                      ' Null Cmd if a line command
                   END IF                                             '
                   CloseHandle gMacThread                             ' Clear handle
                   gMacroMode = %False                                ' Turn off Macro mode
                   KbdPopRestore                                      ' Reset popup state
                   TP.AttnDo = (TP.AttnDo OR %Refresh)                ' Ask for refresh
                   DoStatusBar($AllStatusBarBoxes)                    ' re-Do the StatusBar box in case something's changed
                   EXIT DO                                            ' Done
    
                CASE %WAIT_TIMEOUT                                    ' Delay is over, see what to do
                   IF gMacNoLoopTest THEN ITERATE DO                  ' User says to ignore loops
                   IF GetWindowHandle("thinBasic :: Script RunTime error!", WinCtr) THEN ITERATE DO ' If thinbasic telling of an error, also exit
                   MSG = "Macro may be looping," + $CRLF + "Select OK, to ignore loop and continue execution," + $CRLF + _  '
                         "Select Cancel to terminate the macro"       '
                   i = DoMessageBox(MSG, %MB_USERICON OR %MB_OKCANCEL, "SPFLite Macro Loop Intercept") '
                   IF i = %IDOK THEN                                  ' Continue?
                      ITERATE DO                                      ' Just keep waiting
                   ELSE                                               '
                      TerminateThread BYVAL gMacThread, 999           ' Second value is thread exit code
                      SLEEP 500                                       ' Give thread time to end
                      GetExitCodeThread(gMacThread, Retval)           '
                      CloseHandle gMacThread                          ' Call CloseHandle after TerminateThread
                      TP.ErrMsgAdd(%eFail, "Macro was terminated")    '
                      KbdPopRestore                                   ' Do final reset
                      TP.AttnDo = (TP.AttnDo OR %Refresh)             ' Ask for refresh
                      gMacroMode = %False                             ' Turn off Macro mode
                      EXIT DO                                         '
                   END IF                                             '
                CASE ELSE
                   '
            END SELECT                                                '
          LOOP                                                        '
       ELSE                                                           '
         TP.ErrMsgAdd(%eFail, "Unable to start macro thread")         '
       END IF                                                         '
    
       IF ghDBFn <> 0 THEN                                            ' A DebugLog Active?
          CLOSE # ghDBFn                                              ' Close it
          RESET ghDBFn, ghDBFName                                     ' Reset file info
       END IF                                                         '
       TP.CsrRow = TP.GPTop: TP.CsrCol = TP.GPCmdCol                  ' reset the command line
       gLTblRange = %False                                            ' Reset line ranges
    END FUNCTION                                                      '
    
    SUB      MB_CallThread()                                          '
    '--------------------------------------------------------------------------------------------------+
    '- Handle the MACRO BASIC format                                                                   |
    '--------------------------------------------------------------------------------------------------+
    LOCAL BasicPgm AS STRING, RCA AS RCArea                           '
    LOCAL hLib_thinCore                  AS LONG                      ' Handle of thinCore.dll library
    LOCAL hProc_thinBasic_Init           AS LONG                      ' Handle to Init function
    LOCAL hProc_thinBasic_LoadSymbol     AS LONG                      ' Handle to LoadSymbol function
    LOCAL hProc_thinBasic_AddIncludePath AS LONG                      ' Handle to AddIncludePath function
    LOCAL hProc_thinBasic_AddVariable    AS LONG                      ' Handle to AddVariable function
    LOCAL hProc_thinBasic_AddEquate      AS LONG                      ' Handle to AddEquate function
    LOCAL hProc_thinBasic_Run            AS LONG                      ' Handle to Run function
    LOCAL hProc_thinBasic_Release        AS LONG                      ' Handle to Release function
    LOCAL lRet, i, j                     AS LONG                      '
       gMacroRC = 0: gMacroMsg = ""                                   ' Clear the RC and Msg
    
       '-----------------------------------------------------------------------------------------------+
       '- Save the Line control context at start of macro                                              |
       '-----------------------------------------------------------------------------------------------+
       gMacRange  = gLTblRange                                        ' Line control range at Macro start
       gMacSCmd   = TRIM$(gLTblSCmd)                                  '
       gMacSFrom  = gLTblSFrom                                        '
       gMacSTo    = gLTblSTo                                          '
       gMacSRpt   = gLTblSRpt                                         '
       gMacSFlag  = gLTblSFlag                                        '
       gMacDCmd   = TRIM$(gLTblDCmd)                                  '
       gMacDFrom  = gLTblDFrom                                        '
       gMacDTo    = gLTblDTo                                          '
       gMacDRpt   = gLTblDRpt                                         '
       gMacDFlag  = gLTblDFlag                                        '
    
       '-----------------------------------------------------------------------------------------------+
       '- Open and load thinCore.dll library                                                           |
       '-----------------------------------------------------------------------------------------------+
       hLib_thinCore = LoadLibraryA( BYCOPY "thinCore.Dll" )          '
    
       '-----------------------------------------------------------------------------------------------+
       '- If all went fine                                                                             |
       '-----------------------------------------------------------------------------------------------+
       IF hLib_thinCore THEN                                          ' thinCore exists
          gMacCore = hLib_thinCore                                    ' Save Core address
    
          '--------------------------------------------------------------------------------------------+
          '- Try to load the functions                                                                 |
          '--------------------------------------------------------------------------------------------+
          hProc_thinBasic_Init           = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_Init")   '
          hProc_thinBasic_LoadSymbol     = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_LoadSymbol")   '
          hProc_thinBasic_AddVariable    = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_AddVariable")  '
          hProc_thinBasic_AddIncludePath = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_AddIncludePath")  '
          hProc_thinBasic_AddEquate      = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_AddEquate") '
          hProc_thinBasic_Run            = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_Run"     )  '
          hProc_thinBasic_Release        = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_Release" )  '
          gMacRelease = hProc_thinBasic_Release                       ' Save release for global use
    
          '--------------------------------------------------------------------------------------------+
          '- If all went fine ...                                                                      |
          '--------------------------------------------------------------------------------------------+
          IF hProc_thinBasic_Init           AND _                     '
             hProc_thinBasic_LoadSymbol     AND _                     '
             hProc_thinBasic_AddVariable    AND _                     '
             hProc_thinBasic_AddIncludePath AND _                     '
             hProc_thinBasic_AddEquate      AND _                     '
             hProc_thinBasic_Run            AND _                     '
             hProc_thinBasic_Release        THEN                      '
    
             '-----------------------------------------------------------------------------------------+
             '- Initialise all necessary functions etc.                                                |
             '-----------------------------------------------------------------------------------------+
             CALL DWORD hProc_thinBasic_Init USING thinBasic_Init(0, ghInstance, "thinBasic") '
    
             '-----------------------------------------------------------------------------------------+
             '- Add our Macro paths to thinBasic's #INCLUDE path                                       |
             '-----------------------------------------------------------------------------------------+
             IF ISNULL(gMaclib) THEN                                  ' If no MACLIB overrides
                CALL DWORD hProc_thinBasic_AddIncludePath USING thinBasic_AddIncludePath(gENV.HomeData + "MACROS\") '
             ELSE                                                     ' If there IS a MACLIB
                FOR i = 1 TO PARSECOUNT(gMacLibList, ";")             ' Add each file in the list
                   CALL DWORD hProc_thinBasic_AddIncludePath USING thinBasic_AddIncludePath(PARSE$(gMaclibList, ";", i)) '
                NEXT i                                                '
             END IF                                                   '
    
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("DELETE_GBL_NUM",        %thinBasic_ReturnCodeLong,  CODEPTR(Delete_GBLNUM))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("DELETE_GBL_STR",        %thinBasic_ReturnCodeLong,  CODEPTR(Delete_GBLSTR))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("DROP_HANDLE$",          %thinBasic_ReturnString,    CODEPTR(Drop_HANDLE))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("FIRST_HANDLE$",         %thinBasic_ReturnString,    CODEPTR(First_Handle)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("HALT",                  %thinBasic_ReturnNumber,    CODEPTR(HALT))         '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("HAS_HANDLE",            %thinBasic_ReturnNumber,    CODEPTR(Has_HANDLE))   '
             '
             ' A whole bunch more LoadSymbols
             '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_AVAILABLE",          %thinBasic_ReturnNumber,    CODEPTR(ISAVAILABLEF)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_BOTTOM",             %thinBasic_ReturnNumber,    CODEPTR(IS_BOTTOM))    '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_Cmd_Name$",          %thinBasic_ReturnString,    CODEPTR(ISCmdName))    '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_DATA",               %thinBasic_ReturnNumber,    CODEPTR(IS_DATA))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_WORD",               %thinBasic_ReturnNumber,    CODEPTR(IS_WORD))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_MARK",               %thinBasic_ReturnNumber,    CODEPTR(IS_MARK))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_MASK",               %thinBasic_ReturnNumber,    CODEPTR(IS_MASK))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_NOTE",               %thinBasic_ReturnNumber,    CODEPTR(IS_NOTE))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_PROF",               %thinBasic_ReturnNumber,    CODEPTR(IS_PROF))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_TABS",               %thinBasic_ReturnNumber,    CODEPTR(IS_TABS))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_TOP",                %thinBasic_ReturnNumber,    CODEPTR(IS_TOP))       '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_ULINE",              %thinBasic_ReturnNumber,    CODEPTR(IS_ULINE))     '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_XMARKER",            %thinBasic_ReturnNumber,    CODEPTR(IS_XMARKER))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_BNDS",               %thinBasic_ReturnNumber,    CODEPTR(IS_BNDS))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_COLS",               %thinBasic_ReturnNumber,    CODEPTR(IS_COLS))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_FILE",               %thinBasic_ReturnNumber,    CODEPTR(IS_FILE))      '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_XLINE",              %thinBasic_ReturnNumber,    CODEPTR(IS_XLine))     '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_PRIMARY_CMD",        %thinBasic_ReturnNumber,    CODEPTR(IS_PrimCmd))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_LINE_CMD",           %thinBasic_ReturnNumber,    CODEPTR(IS_LineCmd))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_FM",                 %thinBasic_ReturnCodeLong,  CODEPTR(IS_FM))        '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("LAST_HANDLE$",          %thinBasic_ReturnString,    CODEPTR(Last_Handle))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("NEXT_HANDLE$",          %thinBasic_ReturnString,    CODEPTR(Next_Handle))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("NOP",                   %thinBasic_ReturnNumber,    CODEPTR(NOP))          '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("OF",                    %thinBasic_ReturnNumber,    CODEPTR(OV))           '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("PREV_HANDLE$",          %thinBasic_ReturnString,    CODEPTR(Prev_Handle))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("REQUEST_LABEL$",        %thinBasic_ReturnString,    CODEPTR(Get_Handle))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("RELEASE_LABEL$",        %thinBasic_ReturnString,    CODEPTR(Drop_HANDLE))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("RESET_GBL_NUM",         %thinBasic_ReturnNumber,    CODEPTR(Reset_GBLNUM)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("RESET_GBL_STR",         %thinBasic_ReturnNumber,    CODEPTR(Reset_GBLSTR)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("Restore_SrchArgs",      %thinBasic_ReturnNumber,    CODEPTR(ParseLoad))    '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("Save_SrchArgs",         %thinBasic_ReturnNumber,    CODEPTR(ParseSave))    '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_CLR_LINE",          %thinBasic_ReturnNumber,    CODEPTR(SET_ClrLine))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_CSR",               %thinBasic_ReturnNumber,    CODEPTR(SET_CSR))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_LCSR",              %thinBasic_ReturnNumber,    CODEPTR(SET_LCSR))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_LINE",              %thinBasic_ReturnNumber,    CODEPTR(SET_LINE))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_MARK",              %thinBasic_ReturnNumber,    CODEPTR(SET_MARK))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_MASK",              %thinBasic_ReturnNumber,    CODEPTR(SET_MASK))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_MSG",               %thinBasic_ReturnNumber,    CODEPTR(SET_MSG))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_SETVAR",            %thinBasic_ReturnNumber,    CODEPTR(SET_SETVAR))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_GBL_NUM",           %thinBasic_ReturnNumber,    CODEPTR(SET_GBLNUM))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_GBL_STR",           %thinBasic_ReturnNumber,    CODEPTR(SET_GBLSTR))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_TABS",              %thinBasic_ReturnNumber,    CODEPTR(SET_TABS))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_TOPSCRN_LPTR",      %thinBasic_ReturnNumber,    CODEPTR(SET_TOPSCREEN))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_WORD",              %thinBasic_ReturnNumber,    CODEPTR(SET_WORD))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_CMD",               %thinBasic_ReturnNumber,    CODEPTR(SPF_CMD))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_COMMENT",           %thinBasic_ReturnNumber,    CODEPTR(SPF_COMMENT))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_DEBUG",             %thinBasic_ReturnNumber,    CODEPTR(SPF_Debug)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_DEBUGLOG",          %thinBasic_ReturnNumber,    CODEPTR(SPF_DebugLog)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_TRACE",             %thinBasic_ReturnNumber,    CODEPTR(SPF_Trace)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_EXEC",              %thinBasic_ReturnNumber,    CODEPTR(SPF_EXEC))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_EXEMPT_FILE",       %thinBasic_ReturnNumber,    CODEPTR(SPF_Exempt_File)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_FMLCmd",            %thinBasic_ReturnCodeLong,  CODEPTR(FMRun_LCmd))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_INS",               %thinBasic_ReturnNumber,    CODEPTR(SPF_INS))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_INVCHARS$",         %thinBasic_ReturnString,    CODEPTR(SPF_INVCHARS)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_OVR",               %thinBasic_ReturnNumber,    CODEPTR(SPF_OVR))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_LOOP_CHECK",        %thinBasic_ReturnNumber,    CODEPTR(SPF_LOOPCHECK))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_OVR_REP",           %thinBasic_ReturnNumber,    CODEPTR(SPF_OVR_REP))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_PARSE",             %thinBasic_ReturnNumber,    CODEPTR(SPF_PARSE)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_POST_DO",           %thinBasic_ReturnNumber,    CODEPTR(SPF_POST_DO))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_REP",               %thinBasic_ReturnNumber,    CODEPTR(SPF_REP))   '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_QUOTE$",            %thinBasic_ReturnString,    CODEPTR(SPF_QUOTE)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_SpellChk$",         %thinBasic_ReturnString,    CODEPTR(MacSpellChk))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_UNQUOTE$",          %thinBasic_ReturnString,    CODEPTR(SPF_UNQUOTE))  '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_SHELL",             %thinBasic_ReturnNumber,    CODEPTR(SPF_SHELL)) '
             CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_TRY",               %thinBasic_ReturnNumber,    CODEPTR(SPF_TRY))   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("OK",    "", 0,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("WARN",  "", 8,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FAIL",  "", 8,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ON",    "", 1,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("OFF",   "", 0,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ERROR", "", 2,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("YES",   "", 1,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("NO",    "", 0,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("SYNC",  "", 0,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ASYNC", "", 1,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("NORMAL","", 1,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("HIDDEN","", 0,        %EquateTypeNumber)   '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ARG_OPT","", 256,     %EquateTypeNumber)   ' X'00000100'
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ARG_DEF","", 512,     %EquateTypeNumber)   ' X'00000200'
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ARG_VAR","", 1024,    %EquateTypeNumber)   ' X'00000400'
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FLISTData",    "", 0,          %EquateTypeNumber)  '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FilePath",     "", 1,          %EquateTypeNumber)  '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Recent",        "", 2,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Found",         "", 3,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Opened",        "", 4,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Favorites",     "", 5,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FLISTS",        "", 6,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Paths",         "", 7,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Configs",       "", 8,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Profiles",      "", 8,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DirUp",         "", 1,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DirDown",       "", 2,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_File",          "", 3,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Path",          "", 4,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FList",         "", 5,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Profile",       "", 6,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_READONLY",      "", &H00000001, %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_HIDDEN",        "", &H00000002, %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_SYSTEM",        "", &H00000004, %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DIRECTORY",     "", &H00000010, %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_ARCHIVE",       "", &H00000020, %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DATA_FILE",     "", 1,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_BACKUP_DATA",   "", 2,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_BACKUP_STATE",  "", 3,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_NORMAL_FOLDER", "", 1,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_BACKUP_FOLDER", "", 2,          %EquateTypeNumber) '
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("DATA",                 "", 1,          %EquateTypeNumber)
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("gTabsNum",             "", gTabsNum,   %VarSubType_Long, VARPTR(gTabsNum))
             CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("gMacroName$",          gMacroName, 0,  %VarMainType_IsString, 0, 0, 0, 0, 0)
             '-----------------------------------------------------------------------------------------+
             '- Run the program                                                                        |
             '-----------------------------------------------------------------------------------------+
             BasicPgm = JOIN$(gMaclines(), $CRLF) + $CRLF             ' Join the array together
             gMacroMode = %True                                       ' Flag we are in Macro Mode
             KbdPopSave                                               ' Ready for pop-up
             CALL DWORD hProc_thinBasic_Run USING thinBasic_RUN( _    '
                                         0&                             , _ 'Will be used in future release
                                         BasicPgm                       , _ 'File name or string Buffer
                                         %thinBasic_BufferType_IsScript , _ 'Previous op is a File Name, or previous op is a string Buffer
                                         (1 OR 2)                       , _ 'Options (See below)
                                         %FALSE                         , _ 'Debug Mode      %TRUE/%FALSE
                                         %FALSE                         , _ 'Log Mode        %TRUE/%FALSE
                                         %FALSE                         , _ 'Obfuscate Mode  %TRUE/%FALSE
                                         1&                             , _ 'Calling Program 1=thinBasic, 2=Console
                                         %FALSE                           _ 'Dependancy Mode %TRUE/%FALSE
                                       ) TO lRet                      '
                                                                      ' Option 1 = use base directory from the executable running thinBasic_Run
                                                                      '            else thinBasic itself
                                                                      ' Option 2 = In case of script run-time ERROR, DO NOT CLOSE calling application too.
                                                                      '            If this option is omitted, thinBasic will fire a PostQuitMessage
    
             '-----------------------------------------------------------------------------------------+
             '- Unload all modules, release all memory                                                 |
             '-----------------------------------------------------------------------------------------+
             CALL DWORD hProc_thinBasic_Release USING thinBasic_Release(0&  _  'Will be used in future release
                                                                        ) TO lRet '
             '-----------------------------------------------------------------------------------------+
             '- Free loaded thinCore library                                                           |
             '-----------------------------------------------------------------------------------------+
             FreeLibrary(hLib_thinCore)                               '
          ELSE                                                        '
             TP.ErrMsgAdd(%eFail, "Internal thinBasic functions not found") ' Error
          END IF                                                      '
       ELSE                                                           '
          TP.ErrMsgAdd(%eFail, "thinBasic does not appear to be installed") ' Say why we didn't do it
       END IF                                                         '
    END SUB                                                           '
    

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,850
    Rep Power
    10
    I confirm I've replicated the problem in my thinBasic 1.14 version under development

    At the moment I'm on vacation till 21st of July.
    I will see if I can do something before my return or, at last, when I will be back
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #9
    Junior Member
    Join Date
    Jan 2013
    Age
    82
    Posts
    26
    Rep Power
    15
    Quote Originally Posted by ErosOlmi View Post
    I confirm I've replicated the problem in my thinBasic 1.14 version under development

    At the moment I'm on vacation till 21st of July.
    I will see if I can do something before my return or, at last, when I will be back
    No problem, I reverted back to my previous version, so no hurry.

    George

Similar Threads

  1. Problem passing strings to function
    By EricE in forum thinBasic General
    Replies: 4
    Last Post: 23-09-2024, 15:37
  2. "macro" convert how into thinbasic?
    By largo_winch in forum Modules specific issues
    Replies: 3
    Last Post: 19-01-2012, 22:01
  3. External MD2 support for TBGL
    By Petr Schreiber in forum TBGL General
    Replies: 5
    Last Post: 01-01-2009, 18:17
  4. Example: passing vector or array to same function
    By e90712 in forum Math scripts
    Replies: 2
    Last Post: 19-07-2008, 00:33

Members who have read this thread: 6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •