Postby aloberoger » Mar 12, 2012 16:55
My goal is to create a tool able to read a .bas file containing one or more classes
and automatically to convert them into DLL Com.
By supposing that the implementation of the class is carried out.
to help me has to read one or of the classes and to store them in the following Arrays:
for only one classe:
Dim Shared colClassFunctions(1 To 50) As TFunctions
Dim Shared colClassProperties(1 To 50) As TProperty
Dim Shared colClassSubs(1 To 50) As TSubprocedure
fore more classes :
NMAXCLASSES=10
NMAXFUNCTIONS=50
NMAXSUBS=50
NMAXPROPERTIES=50
Dim Shared colClassFunctions(1 to NMAXCLASSES,1 To NMAXFUNCTIONS) As TFunctions
Dim Shared colClassProperties(1 to NMAXCLASSES,1 To NMAXPROPERTIES) As TProperty
Dim Shared colClassSubs(1 to NMAXCLASSES,1 To NMAXSUBS) As TSubprocedure
example of class to read:
type POINTD
private:
m_x as double
m_y as double
public:
visible as long
declare constructor
declare destructor
declare property x as double
declare property x( as double)
decxlare function Somme as double) as double
decxlare function Produit(as double,as double) as double
decxlare sub Add(as double,as double,as integer)
end type
an exapmple to get
colClassSubs(1,1).SubName = "Add"
colClassSubs(1,1).AccessSpecifier = "public"
colClassSubs(1,1).Parameters = "as double,as double,as integer"
Type TProperty
Private:
Dim mvarPropertyName As String
Dim mvarAccessSpecifier As String
Dim mvarPropertyType As String
Dim mvarPropertyPurpose As Integer
Public:
Declare Function Header() As String
Declare Function ToString() As String
Declare Property PropertyName(vdata As String)
Declare Property PropertyName() As String
Declare Property AccessSpecifier(vdata As String)
Declare Property AccessSpecifier() As String
Declare Property PropertyType(vdata As String)
Declare Property PropertyType() As String
Declare Property PropertyPurpose(vdata As Integer)
Declare Property PropertyPurpose() As Integer
End Type
Type TFunctions
Private:
Dim mvarFunctionName As String
Dim mvarReturnType As String
Dim mvarAccessSpecifier As String
Dim mvarParameters As String
Dim mvarClassType As String="Normal"
Public:
Declare Property ClassType(vdata As String)
Declare Property ClassType As String
Declare Function ToString() As String
Declare Property FunctionName(vdata As String)
Declare Property FunctionName() As String
Declare Property ReturnType(vdata As String)
Declare Property ReturnType() As String
Declare Property AccessSpecifier(vdata As String)
Declare Property AccessSpecifier() As String
Declare Property Parameters(vdata As String)
Declare Property Parameters() As String
End Type
Type TSubprocedure
Private:
Dim mvarSubName As String
Dim mvarAccessSpecifier As String
Dim mvarParameters As String
Dim mvarClassType As String="Normal"
Public:
Declare Property ClassType(vdata As String)
Declare Property ClassType As String
Declare Function ToString() As String
Declare Property SubName(vdata As String)
Declare Property SubName() As String
Declare Property AccessSpecifier(vdata As String)
Declare Property AccessSpecifier() As String
Declare Property Parameters(vdata As String)
Declare Property Parameters() As String
End Type
NOTA: For the creation of the DLL COM starting from the tables obtained the code is already perfectly carried out.