Got an idea for enhancing PureBasic? New command(s) you'd like to see?
-
infratec
- Always Here
- Posts: 6874
- Joined: Sun Sep 07, 2008 12:45 pm
- Location: Germany
Post
by infratec »
Hi,
I just came accross a problem:
I need to know if a Macro is already defined (many include files
)
I tried to use
But ...
#PB_Macro does not exist.
-
skywalk
- Addict
- Posts: 3999
- Joined: Wed Dec 23, 2009 10:14 pm
- Location: Boston, MA
Post
by skywalk »
Yeah, I check a constant defined within my common macros.
Undefine macro
Define macro could be a workaround?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
-
Little John
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Post
by Little John »
Hi,
this was discussed before:
viewtopic.php?f=13&t=46310
Anyway, it's good to have a feature request for it now in the appropriate forum section.
-
acreis
- Enthusiast
- Posts: 182
- Joined: Fri Jun 01, 2012 12:20 am
Post
by acreis »
Code: Select all
Macro CompilerIfNotDefinedMacro(_Macro_Name_)
CompilerIf Defined(_Macro_Name_#_Defined_, #PB_Constant) = 0
#_Macro_Name_#_Defined_ = 1
EndMacro
CompilerIfNotDefinedMacro(MyMacro)
Macro MyMacro()
Debug 14
EndMacro
CompilerEndIf
CompilerIfNotDefinedMacro(MyMacro)
Macro MyMacro()
Debug 25
EndMacro
CompilerEndIf
MyMacro()