I have a small program in Purebasic and I want to translate it into Spiderbasic. I'm asking this question here because it concerns Spiderbasic.
I have the following piece of code:
Code: Select all
Structure MyStruct
*CLASS
MyCanvas.l
x.l
y.l
EndStructure
Procedure New(MyCanvas,x,y)
Protected *Rec.MyStruct
*Rec=AllocateMemory(SizeOf(MyStruct))
With *Rec
\MyCanvas=MyCanvas
\x=x
\y=y
\CLASS=?CLASS; I have a syntax error here in SB
EndWith
ProcedureReturn *Rec
EndProcedure
DataSection
CLASS:
Data.i @Draw()
Data.i @Free()
EndDataSection
I have a Syntax Error on the line \CLASS=?CLASS.
I understand that the ? places me at the start of the DataSection, but how are the Datas read in PB? Because I would like to find a way to reproduce this mechanism in SB. I tried with Restore, writing: \CLASS=Restore CLASS replacing \CLASS=?CLASS, but it gives me the answer: "With EnableExplicit variables have to be declared". When I remove the EnableExplicit directive, it gives me the error message "A variable can't be named the same as a keyword: Restore".
My question is: How to obtain, in Spiderbasic, the address of the start of one of the data of a DataSection at any label? And is it possible in this language?