Author Topic: bstring  (Read 4241 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
bstring
« on: July 30, 2011, 12:12:17 PM »
Deleted
« Last Edit: May 07, 2015, 11:24:02 AM by Peter »

Charles Pegge

  • Guest
Re: bstring
« Reply #1 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.  
« Last Edit: July 30, 2011, 01:07:09 PM by Charles Pegge »

JRS

  • Guest
Re: bstring
« Reply #2 on: July 30, 2011, 01:18:42 PM »
-1

@ is a standard in higher level languages for indirection.


efgee

  • Guest
Re: bstring
« Reply #3 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 &?


Charles Pegge

  • Guest
Re: bstring
« Reply #4 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