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
Bookmarks