Calling Macros in Macros

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
cxAlex
User
User
Posts: 88
Joined: Fri Oct 24, 2008 11:29 pm
Location: Austria
Contact:

Calling Macros in Macros

Post by cxAlex »

Code: Select all

Macro DO_1()
  x=1
EndMacro

Macro DO_2()
  x=2
EndMacro

Macro DO(x)
  DO_#x()
EndMacro

Do(1)
Please add a possibility to call macros in macros.

Greets, Alex
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

wouldn't that need Two-Pass-Compiling...?
oh... and have a nice day.
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

Not if you pass em in the right Order .. kind of like Procedures without the declare.

However while i dont see the benefit from this except a few calls instead using a procedure - i cant really say if this makes sense to implement or not . Since it probably would mean reworking the macro system quiet a bit.

Cheers,
Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Code: Select all

Macro DO_1() 
  x=1 
EndMacro 

Macro DO_2() 
  x=2 
EndMacro 

Macro CallMacro(N)
  N
EndMacro

Macro DO(x)
  CallMacro(DO_#x())
EndMacro

Do(1)
Debug x

Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

okay.. but you could almost make a new style of coding out of that. :lol:
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
Post Reply