More "RESTORE" functionality

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

More "RESTORE" functionality

Post by DoubleDutch »

The ability to set the "restore" point using a variable would be great, also the ability to read the current data read position would be good too.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: More "RESTORE" functionality

Post by PB »

> The ability to set the "restore" point using a variable would be great

Agreed. I tried using pointers to do this, but was unsuccessful.

Also, it would be good if the Read command could have more than one
parameter per line... for example, the following code gives an error:

Code: Select all

Read a$,b$,c$ ; Won't work, need 3 x Read lines instead. :(
Debug a$+" "+b$+" "+c$

DataSection
  Data.s "Hello","There","Mate"
EndDataSection
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

you could set a var to the address of the label in the datasection and then

Code: Select all

Procedure LabelTest(LabelAdress.l) 
! MOV    eax,[esp] 
! MOV    dword [PB_DataPointer],eax 
EndProcedure 

  lb.l=?label2
  LabelTest(lb) 
  Read text.s 
  Debug text.s 
End 


DataSection 
  label1: 
    Data.s "Text from Label 1" 
  label2: 
    Data.s "Text from Label 2" 
  label3: 
    Data.s "Text from Label 3" 
EndDataSection 
for long type data you can even do this

Code: Select all

Procedure LabelTest(LabelAdress.l,offset.l) 
! MOV   eax,[esp] 
! add   eax,[esp+4]
! MOV   dword [PB_DataPointer],eax
EndProcedure 

  lb.l=?label2
  LabelTest(lb,16) 
  Read l
  Debug l
End 


DataSection 
  label1: 
    Data.s "Text from Label 1" 
  label2: 
    Data.l 1,2,3,4,5
  label3: 
    Data.s "Text from Label 3" 
EndDataSection 
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

That should work perfectly - thanks :)

I will just add another function to read the current address of PB_DataPointer into a variable.

Fred: Will you add this kind of functionality into purebasic, they would be good as native commands.

-Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply