It is currently Thu Jun 20, 2013 4:14 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [Implemented] Reserved Constant: #PB_Compiler_IncludeFile
PostPosted: Tue May 22, 2012 4:05 pm 
Offline
Addict
Addict

Joined: Tue Nov 09, 2010 10:15 pm
Posts: 808
I wish we had this. Here are two uses I can immediately think of for it:

Code:
Procedure FancyLibrary(i.i)
   CompilerIf #PB_Compiler_IncludeFile = #False     ; example for debugging
      Debug "Parameter for " + #PB_Compiler_Procedure + ": " + Str(i)
   CompilerEndIf
EndProcedure

CompilerIf #PB_Compiler_IncludeFile = #False
   ; example to show a demo of the library in use
   FancyLibrary(123)
CompilerEndIf


As it is, if we want this functionality we have to edit the library Include file to demo it.


Top
 Profile  
 
 Post subject: Re: Reserved Constant: #PB_Compiler_IncludeFile
PostPosted: Wed May 23, 2012 5:01 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 937
Location: New York
+1

When I write include files, I like to append example code or test code at the bottom. These need to be commented out or CompilerIf'ed out between each test execute versus each inclusion in another project.

It would be nice to simply do something like this:

Code:
; Contents of an include file:
Your Constants Here
Your Structures Here
Your Procedures Here
Etc...

CompilerIf (#PB_Compiler_IncludeFile = #False)
  Your Test/Example Code Here
CompilerEndif


An alternative would be the exact opposite: instead of a constant that indicates whether it is an Included file, a constant that indicates whether it is the "top" or main file being compiled.


Top
 Profile  
 
 Post subject: Re: Reserved Constant: #PB_Compiler_IncludeFile
PostPosted: Wed May 23, 2012 5:08 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 26, 2009 3:51 pm
Posts: 194
Location: Westernmost tip of Norway
+1, this would be useful.

_________________
You never learn anything by doing it right.


Top
 Profile  
 
 Post subject: Re: Reserved Constant: #PB_Compiler_IncludeFile
PostPosted: Sun May 27, 2012 6:01 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 259
Me, too!

_________________
Purebasic 5.11 | Fedora 18 (32-bit)


Top
 Profile  
 
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 1 guest


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