Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: FreeBASIC module SDK for thinBasic_1.9.x.x

  1. #1

    FreeBASIC module SDK for thinBasic_1.9.x.x

    More up to date FreeBASIC thinBasic module SDK.

    I created new importlib and thinCore.bi include file.

    all ALIAS code removed (extern "MS-Windows" end extern is the key)
    optional params now really optional
    added ext data type
    added missing exports for script calling
    ...

    Download: thinBasic_1.9.x.x_FreeBASIC_SDK.zip

    Joshy
    (Sorry about my bad English.)

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,138
    Rep Power
    733
    This is lot of work and time invested, good job!

    I found a few functions which are still missing in the above, I list here the PB originals. Please don't feel it as "... and you should add them right now", just wanted to make your life easier by searching the differences for your possible future updates of FreeBASIC SDK.

    For launching ThinBASIC scripts:
      %thinBasic_BufferType_IsFile      = 0&
      %thinBasic_BufferType_IsScript    = 1&
    
      Declare Function  thinBasic_Init                                _
                              Lib "thinCore.dll"                      _
                              Alias "thinBasic_Init"                  _
                              (                                       _
                                ByVal hWnd            As Long       , _
                                ByVal cInstance       As Long       , _
                                ByVal sKey            As String       _
                              ) As Long
      Declare Function  thinBasic_Release                             _
                              Lib "thinCore.dll"                      _
                              Alias "thinBasic_Release"               _
                              (                                       _
                                ByVal hScript         As Long         _
                              ) As Long
      Declare Function  thinBasic_Run                                 _
                              Lib "thinCore.dll"                      _
                              Alias "thinBasic_Run"                   _
                              (                                       _
                                ByVal hScript         As Long       , _
                                byval sBuffer         As string     , _
                                ByVal BufferType      As Long       , _
                      Optional  ByVal Options         As Long       , _
                                ByVal DebugMode       As Long       , _
                                ByVal LogMode         As Long       , _
                                ByVal ObfuscateMode   As Long       , _
                                ByVal CallingProgram  As Long       , _
                                ByVal DependancyMode  As Long         _
                              ) As Long
    
    For code tips:
      '----------------------------------------------------------------------------
      'thinBasic_LoadSymbolEX
      '----------------------------------------------------------------------------
      ' Description
      '   Creates e new keyword inside interpreter.
      '   You define your own Function or Sub inside your program. Then call
      '   thinBasic_LoadSymbol to add a new keyword connected to your new function/sub
      '
      ' Parameters
      '   SymbolName  : Name you want to give to your sub or function inside the
      '                 interpreter. It is the new keyword name.
      '
      '   ReturnCode  : specify what kind of var your function returns
      '                 Use predefined constants:
      '                 %thinBasic_ReturnNumber
      '                 %thinBasic_ReturnString
      '                 %thinBasic_ReturnNone
      '                 If SymbolName will end with "$" char, ReturnCode will
      '                 be forced to %thinBasic_ReturnString
      '                 Note: if you pass a pointer to a SUB routine and ReturnCode
      '                       is different from %thinBasic_ReturnNone, a GPF will be
      '                       fired by the Operating System.
      '                 Note: if ReturnCode <= 0 then %thinBasic_ReturnNone will be
      '                       assumed 
      '
      '   FunctionOrSubPointer:
      '                 DWORD returned by CODEPTR function pointing to the function
      '                 that will be called when SymbolName keyword will be encountered
      '                 during script execution
      '
      '   ForceOverWrite:
      '                 If different from 0 it means that even if SymbolName
      '                 already exists as a keyword, you want to overwrite it with
      '                 a new one.
      '                 For example, if you want to overwrite behave of MID$
      '                 creating your own MID$ function, set this parameter to a value
      '                 > 0 like in this example:
      '                 thinBasic_LoadSymbol("MID$", %thinBasic_ReturnString, CODEPTR(MyMid), 1)
      '   sSyntax:
      '                 Syntax of the symbol name
      '   sHelp:
      '                 help about the symbol name
      '
      ' Possible Return Code
      '   >0 = no error, return the associated SymbolName ID
      '   -1 = empty SymbolName
      '   -2 = duplicated SymbolName and no ForceOverWrite flag
      '   -3 = invalid sub/function pointer
      '   -4 = SymbolName contains invalid char(s)
      '
      ' Example
      '   thinBasic_LoadSymbol "MyNewFunction", %thinBasic_ReturnNumber, CODEPTR(MyFunc)
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_LoadSymbolEX                          _
                              Lib "thinCore.DLL"                        _
                              Alias "thinBasic_LoadSymbolEX"            _
                              (                                         _
                                ByVal SymbolName            As String , _
                                ByVal ReturnCode            As Long   , _
                                ByVal FunctionOrSubPointer  As Dword  , _
                                Optional                                _
                                ByVal ForceOverWrite        As Long   , _
                                ByVal sSyntax               As String , _
                                ByVal sHelp                 As String   _
                              ) As Long
    
    Variables:
      '----------------------------------------------------------------------------
      'thinBasic_VariableGetList
      '----------------------------------------------------------------------------
      ' Returns a string with the list of all variables of a specific stack level
      ' If StackLevel is missing, current stack level will be returned
      '----------------------------------------------------------------------------
      Declare Function thinBasic_VariableGetList                      _
                              LIB "thinCore.DLL"                      _
                              Alias "thinBasic_VariableGetList"       _
                              (                                       _
                                Optional                              _
                                ByVal lStackLevel   As Long         , _
                                ByVal sSep          As String         _
                              ) As String
      '----------------------------------------------------------------------------
    
      '----------------------------------------------------------------------------
      'thinBasic_VariableGetValueNum
      '----------------------------------------------------------------------------
      ' Returns numeric value of a numeric variable given variable name and optionally array index
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_VariableGetValueNum                 _
                              LIB "thinCore.DLL"                      _
                              Alias "thinBasic_VariableGetValueNum"   _
                              (                                       _
                                          ByVal SearchKey As String , _
                                Optional  ByVal lIndex    As Long     _
                              ) As Ext
      '----------------------------------------------------------------------------
    
    Declare Function  thinBasic_VariableGetInfoPtr                  _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_VariableGetInfoPtr"    _
                              (                                       _
                                ByVal pVariable   As Long           , _       '---A pointer to Variable
                                ByRef MainType    As Long           , _       '---ATTENTION: parameter passed BYREF will return info
                                ByRef SubType     As Long           , _       '---ATTENTION: parameter passed BYREF will return info
                                ByRef IsArray     As Long             _       '---ATTENTION: parameter passed BYREF will return info
                              ) As Long
    
    Variable subtypes:
    %SubType_Boolean          =  2?
    %SubType_String           = 30?
    
    Variable maintypes:
        %MainType_GUID            = 40?               : %MainType_IsGUID    = %MainType_GUID
        %MainType_IsString  = %MainType_String
    
        %MainType_IsVariant = %MainType_Variant
        %MainType_IsUDT     = %MainType_UDT
        %MainType_PTR             = 70?               : %MainType_IsPTR     = %MainType_PTR
        %MainType_Object          = 80?               : %MainType_IsObject  = %MainType_Object
        %MainType_Class           = 90?               : %MainType_IsClass   = %MainType_Class
    
    Arrays:
    %Array_ElementsAreFixed     = 15&     '%TRUE if elements are fixed size, like fixed strings or UDT
    
    %Array_UBoundDim_1          = 91&     'Returns the Upper Bound of dimension 1
    %Array_UBoundDim_2          = 92&     'Returns the Upper Bound of dimension 2
    %Array_UBoundDim_3          = 93&     'Returns the Upper Bound of dimension 3
    
    Adding:
      '----------------------------------------------------------------------------
      'thinBasic_AddUdt
      '----------------------------------------------------------------------------
      ' Add a new UDT structure
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_AddUdt                              _
                              LIB "thinCore.DLL"                      _
                              Alias "thinBasic_AddUdt"                _
                              (                                       _
                                ByVal sUDT_Code   As String           _
                              ) As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_DeclareFunction
      '----------------------------------------------------------------------------
      ' Add a new function using DECLARE statement and function pointer
      '----------------------------------------------------------------------------
      Declare Function thinBasic_DeclareFunction                      _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_DeclareFunction"       _
                              (                                       _
                                ByVal sDeclare As String    ,         _
                                ByVal pFun As Dword                   _
                              ) As Long
    
    Functions:
      '----------------------------------------------------------------------------
      'thinBasic_FunctionGetPtr
      '----------------------------------------------------------------------------
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionGetPtr                      _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionGetPtr"        _
                              (                                       _
                                ByVal fName       As String           _
                              ) As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_FunctionGetPtr
      '----------------------------------------------------------------------------
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionGetName                     _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionGetName"       _
                              (                                       _
                                ByVal FunctionPtr As Long             _  '---PTR to function returned by (for example) thinBasic_FunctionGetPtr
                              ) As String
    
    
      '----------------------------------------------------------------------------
      'thinBasic_FunctionIsCallBack
      '----------------------------------------------------------------------------
      ' Determine if fucntion passed as PTR has been defined as CALLBACK function in script
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionIsCallBack                  _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionIsCallBack"    _
                              (                                       _
                                ByVal FunctionPtr As Long             _  '---PTR to function returned by thinBasic_FunctionGetPtr
                              ) As Long
    
    
      '----------------------------------------------------------------------------
      'thinBasic_FunctionGetCBParam
      '----------------------------------------------------------------------------
      ' Returns the value of a designated CallBack pseudo variable.
      ' ATTENTION: interface function valid only whileinside a callback function       
      '----------------------------------------------------------------------------
      ' Parameters:
      '   CBParamType: one of the following equates
            '---Equates for CBParamType
            %CBParam_CBHNDL       = 100&
            %CBParam_CBMSG        = 110&
            %CBParam_CBCTL        = 120&
            %CBParam_CBCTLMSG     = 130&
            %CBParam_CBLPARAM     = 140&
            %CBParam_CBWPARAM     = 150&
            %CBParam_CBNMCODE     = 160&
            %CBParam_CBNMHDR      = 170&
            %CBParam_CBNMHWND     = 180&
            %CBParam_CBNMID       = 190&             
      '   lError: a pointer to a long variable that will receive possible error variables
      '           Possible errors:
      '                            -10: not inside at any function
      '                            -20: inside a function but not a callback function
      '                            -30: unsupported/invalid CBParamType
      '----------------------------------------------------------------------------
      Declare Function thinBasic_FunctionGetCBParam                     _
                              Lib "thinCore.DLL"                        _
                              Alias "thinBasic_FunctionGetCBParam"      _
                              (                                         _
                                          ByVal CBParamType As Long   , _
                                Optional  ByVal lError As Long Ptr      _
                              ) As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_FunctionGetNumberOfParams
      '----------------------------------------------------------------------------
      ' Returns the number of parameters defined in a script function
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionGetNumberOfParams           _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionGetNumberOfParams"     _
                              (                                       _
                                ByVal FunctionPtr As Long             _  '---PTR to function returned by thinBasic_FunctionGetPtr
                              ) As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_FunctionGetReturnMainType
      '----------------------------------------------------------------------------
      ' Gets the main data type returned by a script function. See %VarMainType* equates above
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionGetReturnMainType           _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionGetReturnMainType"     _
                              (                                       _
                                ByVal FunctionPtr As Long             _  '---PTR to function returned by thinBasic_FunctionGetPtr
                              ) As Long
    
    
      '----------------------------------------------------------------------------
      'thinBasic_FunctionSimpleCall
      '----------------------------------------------------------------------------
      ' Call a script function and optionally returns it value (numeric or string)
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_FunctionSimpleCall                  _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_FunctionSimpleCall"    _
                              (                                       _
                                ByVal FunctionName As String,         _  '---Name of the function
                                Optional                              _
                                ByVal ptrEXT As Ext Ptr,              _  '---Used to get back from the called function a numeric value
                                ByVal ptrSTR As String Ptr            _  '---Used to get back from the called function a string value
                              ) As Long
    
    Parsing:
      '----------------------------------------------------------------------------
      'thinBasic_ParsePtrToSomething
      '----------------------------------------------------------------------------
      ' Parse whatever and return a PTR to something
      '----------------------------------------------------------------------------
      Declare Function thinBasic_ParsePtrToSomething                    _
                              LIB "thinCore.DLL"                        _
                              Alias "thinBasic_ParsePtrToSomething"     _
                              (                                         _
                                ByRef VariablePtr As Long               _   '---ATTENTION: parameter passed BYREF will return info
                              ) As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_ParseVariableInfo
      '----------------------------------------------------------------------------
      ' Parameters (all passed BYREF ... AS LONG):
      '   - VariablePtr       pointer to internal thinBasic Core engine data structure
      '                       used to store variable info
      '   - MainType          variable main type
      '   - SubType           variable sub type
      '   - ElementsAreFixed  %TRUE if elements inside data buffer are fixed size.
      '                       For example will return %TRUE:
      '                         - fixed STRING size, the one declared ... AS STRING * size
      '                         - fixed ASCIIZ size, the one declared ... AS ASCIIZ * size
      '                         - UDT variables
      '   - TotElements       total number of elements in variable. Usually 1 if
      '                       variable is not an array
      '   - ElementSize       size of the single element. For example if variable is a
      '                       LONG, ElementSize = 4. If EXT ElementSize = 10
      '                       if variable is a UDT, it will depend from UDT to UDT.
      '   - DataPtr           pointer to variable data 
      '   - AbsPos            absolute position inside the array if variable is an array
      '                       if variable is not an array 1 is returned
      '----------------------------------------------------------------------------
      declare function thinBasic_ParseVariableInfo                      _
                              LIB "thinCore.DLL"                        _
                              alias "thinBasic_ParseVariableInfo"       _
                              (                                         _
                                byref VariablePtr       as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref MainType          as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref SubType           as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref ElementsAreFixed  as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref TotElements       as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref ElementSize       as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref DataPtr           as long           , _   '---ATTENTION: parameter passed BYREF will return info
                                byref AbsPos            as long             _   '---ATTENTION: parameter passed BYREF will return info
                              ) as long
      '------------------------------------------------------------------------------
      '---
      ' Parse one string expression.
      Declare Sub       thinBasic_ParseStr                    Lib "thinCore.DLL" Alias "thinBasic_ParseStr"                   (ByRef sResult As String)
    
      '---
      ' Parse a variant variable (scalar or array) and returns its pointer
      Declare Function  thinBasic_ParseVariant                Lib "thinCore.DLL" Alias "thinBasic_ParseVariant"               () As Dword
    
      Declare Function  thinBasic_CheckSemicolon_Mandatory    Lib "thinCore.DLL" Alias "thinBasic_CheckSemicolon_Mandatory"   () As Long
      Declare Function  thinBasic_CheckSemicolon_Optional     Lib "thinCore.DLL" Alias "thinBasic_CheckSemicolon_Optional"    () As Long
    
      Declare Function  thinBasic_CheckEqual_Mandatory        Lib "thinCore.DLL" Alias "thinBasic_CheckEqual_Mandatory"       () As Long
      Declare Function  thinBasic_CheckEqual_Optional         Lib "thinCore.DLL" Alias "thinBasic_CheckEqual_Optional"        () As Long
    
      Declare Function  thinBasic_CheckPoint_Mandatory        Lib "thinCore.DLL" Alias "thinBasic_CheckPoint_Mandatory"       () As Long
      Declare Function  thinBasic_CheckPoint_Optional         Lib "thinCore.DLL" Alias "thinBasic_CheckPoint_Optional"        () As Long
    
      Declare Function  thinBasic_CheckPlus_Optional          Lib "thinCore.DLL" Alias "thinBasic_CheckPlus_Optional"         () As Long
      Declare Function  thinBasic_CheckMinus_Optional         Lib "thinCore.DLL" Alias "thinBasic_CheckMinus_Optional"        () As Long
      Declare Function  thinBasic_CheckMult_Optional          Lib "thinCore.DLL" Alias "thinBasic_CheckMult_Optional"         () As Long
      Declare Function  thinBasic_CheckDiv_Optional           Lib "thinCore.DLL" Alias "thinBasic_CheckDiv_Optional"          () As Long
    
      Declare Function  thinBasic_CheckEOL_Optional           Lib "thinCore.DLL" Alias "thinBasic_CheckEOL_Optional"          () As Long
    
    
      Declare Function  thinBasic_GetUnknownToken             Lib "thinCore.DLL" Alias "thinBasic_GetUnknownToken"            (Optional ByVal AutoPutBack As Long) As String
      '----------------------------------------------------------------------------
    
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_CheckEqualType_Mandatory    Lib "thinCore.DLL" Alias "thinBasic_CheckEqualType_Mandatory"   () As Long
        %Equal_EQ             = 1520&   ' =
        %Equal_PLUSEQUAL      = 1521&   ' +=
        %Equal_MINUSEQUAL     = 1522&   ' -=
        %Equal_MULTIPLYEQUAL  = 1523&   ' *=
        %Equal_DIVIDEEQUAL    = 1524&   ' /=
        %Equal_IDIVIDEEQUAL   = 1525&   ' \=
        %Equal_CONCEQUAL      = 1526&   ' &=
        %Equal_POINTEQUAL     = 1527&   ' .=
      '----------------------------------------------------------------------------
    
    Variables:
      '----------------------------------------------------------------------------
      'thinBasic_GetVariableNumberDirect
      '----------------------------------------------------------------------------
      '
      ' Returns the value of a variable giving its ptr and it abs position
      '----------------------------------------------------------------------------
      Declare Function thinBasic_GetVariableNumberDirect              _
                              LIB "thinCore.DLL"                      _
                              Alias "thinBasic_GetVariableNumberDirect" _
                              (                                       _
                                ByVal VariablePtr     As Long       , _
                                ByVal VariableAbsPos  As Long         _
                              ) As Ext
    
      '----------------------------------------------------------------------------
      'thinBasic_ChangeVariableUDTDirect
      '----------------------------------------------------------------------------
      ' See also thinBasic_VariableParse
      '
      ' Change a variable using direct variable pointer's data returned by
      ' thinBasic_VariableParse. This will ensure to work also with arrays
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_ChangeVariableUDTDirect          _
                              Lib "thinCore.DLL"                      _
                              Alias "thinBasic_ChangeVariableUDTDirect" _
                              (                                       _
                                ByVal VariablePtr     As Long       , _
                                ByVal VariableAbsPos  As Long       , _
                                ByVal lValString      As String       _
                              ) As Long
    
    Other:
      '----------------------------------------------------------------------------
      'thinBasic_ScriptIsObuscated
      '----------------------------------------------------------------------------
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_ScriptIsObfuscated    Lib "thinCore.DLL" Alias "thinBasic_ScriptIsObfuscated"   () As Long
      '----------------------------------------------------------------------------
    
    Tracing:
      '----------------------------------------------------------------------------
      'Trace Handling
      '----------------------------------------------------------------------------
      '----------------------------------------------------------------------------
      ' TRACE Equates
        '---What to ask for
          %TRACE_What_SourcePtr                       =   1&
          %TRACE_What_StackLevel                      =  10&
          %TRACE_What_IFLevel                         =  20&
          %TRACE_What_SourceFullPath                  =  30&
      
        '---Error codes
          %TRACE_Error_NotPossible_Obfuscated         =   1&
          
          %TRACE_Error_InstallHandle_Null             = 200&
          %TRACE_Error_InstallHandle_AlreadyInstalled = 201&
    
      '----------------------------------------------------------------------------
      'thinBasic_ITrace_GetValue
      '----------------------------------------------------------------------------
      ' 
      '  
      '  
      '  
      '----------------------------------------------------------------------------
        Declare Function thinBasic_ITrace_GetValue                      _
                                Lib   "thinCore.dll"                    _
                                Alias "thinBasic_ITrace_GetValue"       _
                                (                                       _
                                            ByVal lWhat As Long       , _
                                  Optional  ByVal sWhat As String     , _
                                            ByVal lRet1 As Long Ptr   , _
                                            ByVal lRet2 As Long Ptr   , _
                                            ByVal sRet1 As String Ptr   _
                                ) As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_ITrace_InstallHandle
      '----------------------------------------------------------------------------
      ' 
      ' 
      '
      '
      '----------------------------------------------------------------------------
        Declare Function thinBasic_ITrace_InstallHandle                 _
                                Lib   "thinCore.dll"                    _
                                Alias "thinBasic_ITrace_InstallHandle"  _
                                (                                       _
                                            ByVal fHandle As Long       _
                                ) As Long
      '----------------------------------------------------------------------------
    
      '----------------------------------------------------------------------------
      'thinBasic_StackGetCurrent
      '----------------------------------------------------------------------------
      ' Returns the current script stack level.
      ' 1 = Global, 2 = next function executed, 3 = ...
      '----------------------------------------------------------------------------
        Declare Function thinBasic_StackGetCurrent                      _
                                Lib   "thinCore.dll"                    _
                                Alias "thinBasic_StackGetCurrent"       _
                                (                                       _
                                ) As Long
      '------------------------------------------------------------------------------
    
      '----------------------------------------------------------------------------
      'thinBasic_StackGetList
      '----------------------------------------------------------------------------
      ' Returns a string containing the names of the current nesting stack levels
      ' As a minimum this function will return one string containing "GLOBAL"
      '----------------------------------------------------------------------------
        Declare Function thinBasic_StackGetList                         _
                                Lib   "thinCore.dll"                    _
                                Alias "thinBasic_StackGetList"          _
                                (                                       _
                                  Optional ByVal sSep As String         _
                                ) As String
      '----------------------------------------------------------------------------
    
    Errors:
      '----------------------------------------------------------------------------
      'thinBasic_ErrorFlag
      '----------------------------------------------------------------------------
      ' Returns a value different from 0 if a runtime error occurred
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_ErrorFlag         Lib "thinCore.DLL" Alias "thinBasic_ErrorFlag"        () As Long
    
      '----------------------------------------------------------------------------
      'thinBasic_ErrorFree
      '----------------------------------------------------------------------------
      ' Returns -1 if there thinBasic is not under runtime error state
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_ErrorFree         Lib "thinCore.DLL" Alias "thinBasic_ErrorFree"        () As Long
      '----------------------------------------------------------------------------
    
      '----------------------------------------------------------------------------
      'thinBasic_ErrorUserConfirmed
      '----------------------------------------------------------------------------
      ' Returns -1 if, after an error, user has confirmed the dialog
      '----------------------------------------------------------------------------
      Declare Function  thinBasic_ErrorUserConfirmed         Lib "thinCore.DLL" Alias "thinBasic_ErrorUserConfirmed"        () As Long
      '----------------------------------------------------------------------------
    
      %ERR__PREPARSER_DirectiveNotSupported       = 800&
                                                  
      %ERR__PREPARSER_ScriptVersionRequest        = 820&
                                                  
      %ERR__INTERNAL_RETURNMAINTYPE               = 900&
                                                  
      %ERR__INTERNAL_DECRIPTION                   = 910& 
                                                  
      %ERR__INTERNAL_UDTBUFFER_SHORT              = 915& 
                                                  
      %ERR__INTERNAL_RETURNNONE_NOCODEPTR         = 921& 
      %ERR__INTERNAL_RETURNNUMBER_NOCODEPTR       = 922& 
      %ERR__INTERNAL_RETURNSTRING_NOCODEPTR       = 923& 
                                                  
      %ERR__CLASS_NEW_NOINDEXALLOWED              = 5010&
      %ERR__CLASS_NEW_DIFFERENTCLASS              = 5015&
      %ERR__CLASS_NEW_NOCLASS                     = 5020&
      %ERR__CLASS_NEW_EXPECTED_NEW                = 5025&
      %ERR__CLASS_NOT_INIT_WITH_NEW               = 5030&
      %ERR__CLASS_METHODPROPERTY_NOTFOUND         = 5100&
    
      %ERR__TRACE_STOP_BY_USER                    = 11000& 
                                                  
      %ERR__OBFUSCATION_FILENOTVALID              = 12000&
                                                  
      %ERR__COM_GENERIC                           = 30000&
    
    Classes:
      '----------------------------------------------------------------------------
      'thinBasic_Class_Add
      '----------------------------------------------------------------------------
      ' Add a new class to thinBasic Core Engine
      '----------------------------------------------------------------------------
        Declare Function thinBasic_Class_Add                                _
                                Lib   "thinCore.dll"                        _
                                Alias "thinBasic_Class_Add"                 _
                                (                                           _
                                    ByVal sClassName            As String , _     '---Name of the Class to be created
                                    ByVal pClassFunc            As Long     _     '---Pointer to a class function that will handle calls to methods
                                ) As Long
      '----------------------------------------------------------------------------
    
      '----------------------------------------------------------------------------
      'thinBasic_Class_AddMethod
      '----------------------------------------------------------------------------
      ' Add a method to a class previously created with thinBasic_Class_Add
      '----------------------------------------------------------------------------
        Declare Function thinBasic_Class_AddMethod                          _
                                Lib   "thinCore.dll"                        _
                                Alias "thinBasic_Class_AddMethod"           _
                                (                                           _
                                    ByVal pClass                As Long   , _     '---Poiter to a class. This is the value returned by thinBasic_Class_Add
                                    ByVal sMethodName           As String , _     '---Name of the Class to be created
                                    ByVal MethodReturnType      As Long   , _
                                    ByVal pMethodFunc           As Long     _     '---Pointer to a method function that will handle method execution
                                ) As Long
      '----------------------------------------------------------------------------
    
      %Class_Action_None          = 0?
      %Class_Action_Get           = 1?
      %Class_Action_Set           = 2?
      
      %Class_Action_Constructor   = 100?
      %Class_Action_Destructor    = 110?
    
      '----------------------------------------------------------------------------
      'thinBasic_Class_AddProperty
      '----------------------------------------------------------------------------
      ' Add a property to a class previously created with thinBasic_Class_Add
      '----------------------------------------------------------------------------
        Declare Function thinBasic_Class_AddProperty  _
                                Lib   "thinCore.dll"                        _
                                Alias "thinBasic_Class_AddProperty"         _
                                (                                           _
                                    ByVal pClass                As Long   , _     '---Poiter to a class. This is the value returned by thinBasic_Class_Add 
                                    ByVal sPropertyName         As String , _     '---Name of the Class to be created                                      
                                    ByVal PropertyReturnType    As Long   , _                                                                            
                                    ByVal PtrToPropertyFunction As Long     _     '---Pointer to a method function that will handle method execution       
                                 ) As Long
    

    Thanks,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    It's in the zip file now.

    thank you

    Joshy

    By the way classes in the SDK means thinBasic or PowerBasic classes ?
    Last edited by D.J.Peters; 20-05-2013 at 19:19.
    (Sorry about my bad English.)

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,138
    Rep Power
    733
    Whoa,

    great!

    Regarding the classes - I think what works now for sure is wrapping of COM objects, I did it from PowerBASIC during my tests.
    I remember I talked with Eros about possibility to define objects using own allocations (to make it independent on COM), but I am not sure if it is possible at the moment. I will try to experiment with it and will let you know.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,138
    Rep Power
    733
    Okay,

    so both is possible: COM (better for writing in PowerBASIC) and custom allocations too (universal, any language).
    I prepared example of both approaches for you and others in separate thread:
    MyClass & MyClassCOM - simple demo of creating module class


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    thank you D.J.Peters for the FreeBasic SDK update, btw I love your borg avatar.


  7. #7
    The MainType for boolean and integer both are defined as 2
    Is this right i mean bool and int are both 16 bit ?

    why are all main and sub types double defined i mean with VAR_ in front ?

    Joshy
    const    MainType_IsNumber       As Long = 20
    const VarMainType_IsNumber       As Long = MainType_IsNumber
    const VarMainType_IsAsciiZ       As Long = 25
    const    MainType_String         As Long = 30
    const    MainType_IsString       as long = MainType_String
    const VarMainType_IsString       As Long = MainType_String
    const    MainType_GUID           as long = 40
    const    MainType_IsGUID         as long = MainType_GUID
    const    MainType_Variant        As Long = 50
    const    MainType_IsVariant      as long = MainType_Variant
    const VarMainType_IsVariant      As Long = MainType_IsVariant
    const    MainType_UDT            As Long = 60
    const    MainType_IsUDT          as long = MainType_UDT
    const    MainType_PTR            as long = 70
    const    MainType_IsPTR          as long = MainType_PTR
    const    MainType_Object         as long = 80
    const    MainType_IsObject       as long = MainType_Object
    const    MainType_Class          as long = 90
    const    MainType_IsClass        as long = MainType_Class
    
    
    const    SubType_Byte            As Long =  1
    const VarSubType_Byte            As Long =  SubType_Byte
    const    SubType_Integer         As Long =  2
    const VarSubType_Integer         As Long =  SubType_Integer
    const    SubType_Boolean         as long =  2
    const    SubType_Word            As Long =  3
    const VarSubType_Word            As Long =  SubType_Word
    const    SubType_DWord           As Long =  4
    const VarSubType_DWord           As Long =  SubType_DWord
    const    SubType_Long            As Long =  5
    const VarSubType_Long            As Long =  SubType_Long
    const    SubType_Quad            As Long =  6
    const VarSubType_Quad            As Long =  SubType_Quad
    const    SubType_Single          As Long =  7
    const VarSubType_Single          As Long =  SubType_Single
    const    SubType_Double          As Long =  8
    const VarSubType_Double          As Long =  SubType_Double
    const    SubType_Currency        As Long =  9
    const VarSubType_Currency        As Long =  SubType_Currency
    const    SubType_Ext             As Long = 10
    const VarSubType_Ext             As Long = 10
    const    SubType_AsciiZ          As Long = 25 
    const    SubType_String          as long = MainType_String
    const VarSubType_Variant         As Long = MainType_Variant
    
    Last edited by D.J.Peters; 21-05-2013 at 12:01.
    (Sorry about my bad English.)

  8. #8
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    Yes
    Uses "CONSOLE"
    
    Dim myBoolYes As Boolean = TRUE
    Dim myBoolNo  As Boolean ' = FALSE
    Dim myInteger As Integer = 123
    
     
    
    PrintL "myBoolYes" 
    VarInfo(VarPtr(myBoolYes), SizeOf(Boolean))
    PrintL "myBoolNo" 
    VarInfo(VarPtr(myBoolNo), SizeOf(Boolean))
    PrintL "myInteger"
    VarInfo(VarPtr(myInteger), SizeOf(Integer))
    
    WaitKey
    
    Sub VarInfo(ByVal pVar As DWord, ByVal sizeVar As Long )
    
    Local sContent As String
    Local i As Long
    
    PrintL "  Len     =" + Str$(SizeVar) 
    For i = sizeVar - 1 To 0 Step -1
    ' ordered from back to front- they are flipped in memory...
      sContent += Hex$(Peek(pVar + i), 2) + " "
    Next   
    
    PrintL "  Content =" + sContent
    PrintL
    
    
    End Sub
    
    Last edited by ReneMiner; 21-05-2013 at 11:44.
    I think there are missing some Forum-sections as beta-testing and support

  9. #9
    Hello ReneMiner
    Thanx for the code I know how to get the size of any data i'm not a beginner :-)

    My question is more SDK interpreter relevant.

    If you define for all kinds of data types ID's
    this ID's should be unique (normally) independent from its size in memory.

    for example long and dword are the same size in memory but long is signed and dword are unsigned
    this is why dword and long has different ID's

    integer and boolean are the same size in memory but boolean are unsigned and integer are signed
    both are defined as 2

    from my point of view boolean should have it's own unique ID

    You know what my bad english means ?

    Joshy
    Last edited by D.J.Peters; 21-05-2013 at 12:00.
    (Sorry about my bad English.)

  10. #10
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,544
    Rep Power
    172
    Help says:
    tB-Version 1.6.0.4

    Added BOOLEAN data type. It is internally managed exactly like INTEGER but it plays a role in VARIANT variables.
    In VARIANT variables INTEGERs and BOOLEANs value are both stored in an INTEGER class shared space but internally their type is different. Some COM interfaces need a BOOLEAN type.

    More Info maybe in help: thinBasic language > Data types and variables > Variant variables

    sorry that colorful copy&paste-thing from help...
    Last edited by ReneMiner; 21-05-2013 at 12:00.
    I think there are missing some Forum-sections as beta-testing and support

Page 1 of 2 12 LastLast

Similar Threads

  1. FireFly for FreeBasic
    By ErosOlmi in forum Free Basic
    Replies: 4
    Last Post: 22-06-2010, 05:37
  2. Freebasic to get C emitter
    By Charles Pegge in forum Software discussion
    Replies: 6
    Last Post: 22-01-2010, 08:16
  3. FreeBasic strings
    By ErosOlmi in forum Module SDK (Freebasic version)
    Replies: 12
    Last Post: 21-11-2008, 08:28
  4. FreeBasic - EBasic
    By kryton9 in forum Free Basic
    Replies: 10
    Last Post: 16-04-2008, 07:50
  5. Freebasic SDK
    By ErosOlmi in forum Module SDK (Freebasic version)
    Replies: 7
    Last Post: 19-06-2007, 20:27

Members who have read this thread: 1

Posting Permissions

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