PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: John Montenigro on November 23, 2006, 12:50:52 PM

Title: Tip: coding .INC files for both PB and FireFly
Post by: John Montenigro on November 23, 2006, 12:50:52 PM
I have some .INC files that were originally written for plain PB code syntax that I'm now adapting in order to take advantage of certain FireFly functions. Some are general-purpose routines such as INI_Controls.inc. Others are graphical, such as the OpenFile and SaveFile routines in my FileAccess.inc (SDK vs FF_ calls).

I like to keep both PB and FF versions of the code in the same .INC file so that I have only one file to #INCLUDE in any program, and I don't have to keep track of which IDE I'm compiling from.


I came up with this after a bit of frustrated head-scratching, and figured I'd pass it along. It may be obvious to the experts, but maybe it will be helpful to other non-pros here...


At the top of each FF main module place this equate:
  %IDE_FF = %TRUE

Then in your .INC file, bracket the different code sections like this:

#IF %DEF(%IDE_FF)
 'Use FF_ functions
#ELSE
  'Use native PB code
#ENDIF



Simple, yes, but it took me awhile to realize that this was both possible and useful. I hope it's useful to others!

-John