Thanks Eros,
I wanted to find out whether any further bells and whistles were required from the Oxygen side to complete the OOP module interface.
And as far as I can tell, no further constructs are required, and we are in sync
Your scheme will also work quite well with non OOP modular code.
Charles
Here is a tentative outline for an Oxygen OOP based module.
uses "oxygen"
dim as string src
src="
#file "thinBasic_LList.dll"
'SUBSET OF THINCORE
%thinBasic_ReturnNone = 0 'Used in thinBasic_LoadSymbol to define a sub
%thinBasic_ReturnNumber = 20 'Used in thinBasic_LoadSymbol to define a function returning a EXT number
%thinBasic_ReturnString = 30 'Used in thinBasic_LoadSymbol to define a function returning a string
%thinBasic_ReturnCodeByte = 1
%thinBasic_ReturnCodeInteger = 2
%thinBasic_ReturnCodeWord = 3
%thinBasic_ReturnCodeDWord = 4
%thinBasic_ReturnCodeLong = 5
%thinBasic_ReturnCodeQuad = 6
%thinBasic_ReturnCodeSingle = 7
%thinBasic_ReturnCodeDouble = 8
%thinBasic_ReturnCodeCurrency = 9
%thinBasic_ReturnCodeExt = 10
% thinBasic_ForceOverWrite = 1 'Used in thinBasic_LoadSymbol to force symbol over writing
library "thincore.dll"
DECLARE FUNCTION thinBasic_LoadSymbol _
( _
BYVAL SymbolName AS STRING, _
BYVAL ReturnCode AS LONG, _
BYVAL FunctionOrSubPointer AS DWORD, _
OPTIONAL BYVAL ForceOverWrite AS LONG _
) AS LONG
DECLARE SUB thinBasic_ParseNumber (Result AS EXT)
Declare SUB thinBasic_ParseLong (Result As Long)
Declare Function thinBasic_ParseString (ByRef sResult As String) As Ext
DECLARE FUNCTION thinBasic_CheckOpenParens_Optional () AS LONG
DECLARE FUNCTION thinBasic_CheckCloseParens_Mandatory () AS LONG
DECLARE FUNCTION thinBasic_CheckComma_Optional () AS LONG
declare sub thinBasic_Class_Add (string cn,long m)
declare sub thinBasic_Class_AddMethod (long pt,string na,long rt, ad)
library ""
extern
'==========
Class LList
'==========
string s
long count
method _create() as sys
'======================
'
'CREATE PERSISTENT OBJECT
'
LList*p : @p=getmemory sizeof(p)
'
'INITIAL VALUES
'
p.s="ok"
p.count=0
return @p
end method
method _Free()
'=============
s=""
freememory @this
end method
method addstring()
'=========================
count++
end method
method ListCount() as long
'=========================
return count
end method
end class
'----------------------------------------------------------------------------
Function LoadLocalSymbols Alias "LoadLocalSymbols" (Optional ByVal sPath As String) As Long, export
' This function is automatically called by thinCore whenever this DLL is loaded.
' This function MUST be present in every external DLL you want to use with thinBasic
' Use this function to initialize every variable you need and for loading the
' new symbol (read Keyword) you have created.
'----------------------------------------------------------------------------
local RetCode As Long
local pClass As Long
pClass = thinBasic_Class_Add("cLinkedList", 0)
'---If class was created
If pClass Then
RetCode = thinBasic_Class_AddMethod(pClass, "_Create" , %thinBasic_ReturnNumber , @LList._Create )
RetCode = thinBasic_Class_AddMethod(pClass, "_Destroy" , %thinBasic_ReturnNumber ,@LList._Free )
RetCode = thinBasic_Class_AddMethod(pClass, "AddString" , %thinBasic_ReturnNumber , @LList.AddString)
RetCode = thinBasic_Class_AddMethod(pClass, "Count" , %thinBasic_ReturnNumber , @LList.Count)
End If
End Function
end extern
"
o2_asmo src
if len(o2_error) then
msgbox 0,o2_error
stop
end if
o2_exec
Bookmarks