Code: Select all
Define.s myVar$ = "RECT"
NewMap mapSTRUCT.i()
mapSTRUCT("RECT") = 1
Debug Defined(RECT, #PB_Structure)
Debug mapSTRUCT(myVar$) ; 1
Debug Defined(myVar$, #PB_Structure) ; 0
Code: Select all
Define.s myVar$ = "RECT"
NewMap mapSTRUCT.i()
mapSTRUCT("RECT") = 1
Debug Defined(RECT, #PB_Structure)
Debug mapSTRUCT(myVar$) ; 1
Debug Defined(myVar$, #PB_Structure) ; 0
#PB_Constant
#PB_Variable
#PB_Array
#PB_List
#PB_Map
#PB_Structure
#PB_Interface
#PB_Procedure
#PB_Function
#PB_OSFunction
#PB_Label
#PB_Prototype
#PB_Module
#PB_Enumeration
Code: Select all
Define.s myVar$ = "RECT"
NewMap mapSTRUCT.i()
mapSTRUCT("RECT") = 1
Debug Defined(RECT, #PB_Structure)
Debug mapSTRUCT(myVar$) ; 1
Debug Defined(myVar$, #PB_Structure) ; 0
Debug Defined(myVar$, #PB_Variable) ; 1
Debug Defined(mapSTRUCT, #PB_Map) ; 1
I would say no. 'Defined' is a compiler function and so isn't of any use based on changeable data at runtime (such as your string contents).skywalk wrote:I already use a Map of known structures, but curious if there is another way to pass the variable contents to the Defined compiler function?Code: Select all
Define.s myVar$ = "RECT" NewMap mapSTRUCT.i() mapSTRUCT("RECT") = 1 Debug Defined(RECT, #PB_Structure) Debug mapSTRUCT(myVar$) ; 1 Debug Defined(myVar$, #PB_Structure) ; 0
Constructing a collection of the valid parsed Structures would seem to be the only viable solution.skywalk wrote:I am parsing C headers and need to keep valid Struct's when encountered.
Now I must use a pre-filled mapSTRUCT().