It is currently Wed Jul 24, 2019 9:52 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: #PB_Macro for Defined()
PostPosted: Wed Jul 10, 2019 1:50 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4257
Location: Germany
Hi,

I just came accross a problem:
I need to know if a Macro is already defined (many include files :( )

I tried to use
Code:
CompilerIf Not Defined()


But ...

#PB_Macro does not exist.


Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Macro for Defined()
PostPosted: Wed Jul 10, 2019 1:56 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 2971
Location: Boston, MA
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


Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Macro for Defined()
PostPosted: Thu Jul 11, 2019 3:10 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3598
Location: Berlin, Germany
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.

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: #PB_Macro for Defined()
PostPosted: Fri Jul 12, 2019 8:04 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Jun 01, 2012 12:20 am
Posts: 139
Code:
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()


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye