Page 1 of 1

Posted: Sun Sep 22, 2002 5:47 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

Sometimes I need to include data in my sources from a text file, and to
do so I have to run an external app to generate the data before I can
IncludeFile it. Two steps, which is one too many. :)

So I was thinking... it should be fairly simple to have a new compiler
command called CompilerRun that would run program.exe,
wait for it to exit, and then continue compilation. Is that possible?
Shouldn't be too hard to do, and would mean I wouldn't have to keep
switching to the external program manually to run it before compiling.


PB - Registered PureBasic Coder

Posted: Sun Sep 22, 2002 6:47 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

Good idea. Would even have an after hook too (to pack the exe automatically for example)

Fred - AlphaSND

Posted: Sun Sep 22, 2002 7:07 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> Good idea. Would even have an after hook too (to pack the exe
> automatically for example)

After hook? Pack exe? I don't understand...? All I was suggesting was
to pause compilation, run an exe, wait for it to exit, then continue
compilation. I didn't want to pack an exe into the source or anything.

Let me give a better example: Assume that I have the following line
in my code: IncludeFile "data.txt". Now, assume this file is created
by a program called "MakeData.exe". Currently, you would have to run
MakeData.exe before compiling your app, so that "data.txt" contains
fresh information for inclusion. But if we had "CompilerRun", the
code could become this:

Code: Select all

CompilerRun "MakeData.exe"
;
; Compilation pauses now until MakeData.exe finishes, meaning that
; the file "data.txt" created by it has fresh information.  Then,
; compilation continues with the fresh data like so:
;
IncludeFile "data.txt"
;
; If CompilerRun didn't exist, then "data.txt" would always contain
; the same data, until we manually ran MakeData.exe before compilation.
; But CompilerRun saves us this manual step.
Another example would be when including a bitmap containing certain
graphics. You could use CompilerRun to run an exe that generates the
bitmap, which is then IncludeFile'd. Basically I'm asking for a way
to include dynamic data at compile time, done by running an exe during
the compilation. :)


PB - Registered PureBasic Coder

Posted: Sun Sep 22, 2002 7:33 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

Ok

Fred - AlphaSND

Posted: Sun Sep 22, 2002 11:33 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Things like an "After Hook" (an before, too)
should be included to the Addons menu in the editor..
...so this programs run automatically before
and after compilation.

Ofcourse you could set the preferences for all
addon menu entries, so some run always and some
(like UPX) run only if you make a real .EXE -
UPX isnt needed for F5 compilation (too slow).

When i get an overview about the editor source
later, i´ll take a look.

Addition:
Things like PB´s wish "CompilerRun" can be easy
implemented into this system.
You just write a program for the "Before Hook"
that scans the SourceCode for "CompilerRun",
generates the file he wants and removes this
line from the source.

Same for a "not-used-procedures-Remover".
This program gets automatically executed from
the addon menu before compilation (the source
file given as argument) and it removes all not
used procs without a question.

The possibilities for such a System are endlessly
and the results can be very nice... :)

cya,
...Danilo
(registered PureBasic user)

Posted: Mon Sep 23, 2002 3:08 am
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

The editor source is already available? :)

El_Choni

Posted: Mon Sep 23, 2002 7:19 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

I said "later" (3.40?) :)

cya,
...Danilo

(registered PureBasic user)

Posted: Mon Sep 23, 2002 10:45 am
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by Danilo
You just write a program for the "Before Hook"
that scans the SourceCode for "CompilerRun",
generates the file he wants and removes this
line from the source.



The possibilities for such a System are endlessly
and the results can be very nice... :)
A PureBasic pre-processor would be a nice language specific tool so you could do things like macros and not need the compiler to be updated (i.e. to handle macros, or anything else which could be added to the preprocessor). It might even mean someone else could write it rather than give Fred even more work :wink:

Surely there are already external editors which allow you to write a script rather than a single line to execute?

--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.30)