Default IncludeFile when IDE starts

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Default IncludeFile when IDE starts

Post by PB »

I requested this once before but I can't find it now. :)

I'd like to see an OPTION where a specific IncludeFile could be recognized by
the IDE when it starts. For example, in "Compiler Options" and above the
"Library Subsystem" setting. It would have a name of "Default IncludeFile"
with room for a string for the user to specify a file. Then, when the IDE is
loaded, this file is recognized by the compiler as if the user had included it
manually at the top of his code like this:

Code: Select all

IncludeFile "MyFavoriteProcedures.pb"
The reason for this request is simple: it saves me having to copy-and-paste
my favorite procedures into my new apps, essentially making that file a bit
like a "library" (even though it isn't). I know that any unused procedures will
also be included, but that's my problem to deal with later. :) Sound good?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Except when you just want to compile a small program and forget to turn the include off.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Hmm, good point... maybe that's why my previous request got deleted?

Anyway, I just realized I can do it myself by making a small read-only source
with the IncludeFile as the first line, and then when I go to save it, it'll prompt
me for a new name... thus doing exactly what I requested here. :) Thanks for
the heads-up, and Fred can safely ignore this request. ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

This can also be done with an editor tool.

Register the tool for the triggers "Before Compile/Run" and "Before Create Executable",
as argument use the %COMPILEFILE parameter. This gives you the temporary
file that will be compiled. You can modify this and your modification will be compiled.
(this will not affect the real source file you saved)

The trick is that you have to insert your IncludeFile at the start without adding a newline (ie Includefile "yourfile": <here comes the old first line>),
this way the linenumbers for the debugger do not get messed up, and you will not notice any difference when debugging from the IDE.
quidquid Latine dictum sit altum videtur
Post Reply