Oxygen Basic

Programming => Bugs & Feature Requests => Topic started by: Peter on July 30, 2011, 12:12:17 PM

Title: bstring
Post by: Peter on July 30, 2011, 12:12:17 PM
Deleted
Title: Re: bstring
Post by: Charles Pegge on July 30, 2011, 12:50:41 PM
Peter,

(zstring*text)
or
(text as zstring) 'default byref

then push @text

Code: OxygenBasic
  1.  
  2. Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByRef lpText As zString, ByRef lpCaption As zString, ByVal wType As Long) As Long
  3. % MB_OK =0
  4.  
  5. bstring sText="HELLO BASIC AND EVERYTHING ELSE."
  6. bstring caption ="MELDUNG "
  7.  
  8. Sub Report(zstring*Text)
  9. push   MB_OK
  10. push   caption
  11. push   @Text 'push [ebp+8]
  12. push   0
  13. call   MessageBox
  14. End Sub
  15.  
  16. call Report(sText)
  17. bstring sText =" WHY BSTRING?"
  18. call Report(sText)
  19. zstring sText =" ZSTRING PTR WILL ALSO DO!"
  20. call Report(sText)
  21.  

Charles

PS: stricter prototype:
Code: OxygenBasic
  1. Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, Byref lpText As zString, ByRef lpCaption As zString, ByVal wType As Long) As Long
  2.  
Title: Re: bstring
Post by: JRS on July 30, 2011, 01:18:42 PM
-1

@ is a standard in higher level languages for indirection.

Title: Re: bstring
Post by: efgee on July 30, 2011, 01:19:38 PM
I dislike this sign @.  >:(
Maybe we could get an ADDR for that @-sign.

Is really more understandable. 

This is in the eye of the beholder.
Please don't get rid of the @.

BTW: As Oxygen accepts C syntax as well, does it recognize the &?

Title: Re: bstring
Post by: Charles Pegge on July 30, 2011, 01:49:35 PM

Peter,

I needed this '@' thing to escape from & && &h &o &b ambiguities.

You can add this to wFunc:

def Addr @

This will work in Assembler if it is a simple variable with one level of indirection. For other situations creating a pointer in Basic beforehand will always work: sys p= Addr variable.

Charles