Macro Block Parameters
Pass block of data as single parameter: (enclosing the data between brackets)
Oxygen Update http://community.thinbasic.com/index.php?topic=2517
[code=thinbasic]
'
'------------------
'MACRO BLOCK PARAMS
'==================
uses "oxygen","file"
dim src as string
src="
#basic
'
def pr print %1
pr `Hello`
pr ( `Hello` ` ` `Sky!` )
pr ( 21*2 )
terminate
"
'msgbox 0,o2_prep src
o2_basic src
if len(o2_error) then msgbox 0,o2_error
o2_exec
[/code]
Families of Macros with dotted names.
Related macros can be bunched together - like methods the individual routines are referenced by dotted names. The macro members are defined inside the group macro.
[code=thinbasic]
'
'--------------
'MACRO FAMILIES
'==============
uses "oxygen","file"
dim s as string
s="
#basic
def mac
(
.hello
(
print `hello %1`
)
.goodbye
(
print `goobye %1`
)
)
mac.hello fred
mac.goodbye fred
terminate
"
'msgbox 0,o2_prep s
o2_basic s
if len(o2_error) then msgbox 0,o2_error
o2_exec
[/code]
Bookmarks