Am Freitag, den 01.12.2006, 16:26 +0100 schrieb Michael Van Canneyt:
>
> On Fri, 1 Dec 2006, Vincent Snijders wrote:
>
> > Michael Van Canneyt schreef:
> > >
> > > On Thu, 30 Nov 2006, Felipe Monteiro de Carvalho wrote:
> > >
> > > > On 11/30/06, Marc Santhoff <[EMAIL PROTECTED]> wrote:
> > > > > Ah, yes, I remember. My first thought was to replace fpc with a batch
> > > > > file, but I didn't try.
> > > > Doesn´t need to be a batch file. Can be an executable. And you can
> > > > change the path to fpc executable on Lazarus IDE to point to your
> > > > bat/exe, so you don´t have to really replace fpc.
> > > >
> > > > This could be a easy solution.
> > > >
> > > > your preprocessor could check if the file being compiled has .tpp
> > > > extension, and if so preprocess it and send to fpc. If not, send
> > > > directly to fpc.
> > >
> > > The problem is not so easy:
> > > the fpc commandline has only the project file on it.
> > >
> > > But the project contains many units, which are not specified on the
> > > commandline, therefore the batchfile does not know which files to
> > > preprocess. The compiler will only use .pp or .pas.
> > >
> > > That is why I said that only the IDE 'knows' which files must be
> > > preprocessed and which not, and they must all be preprocessed
> > > before the compiler is invoked. You will not solve this with
> > > a simple pre-compile command without additional IDE functionality.
> >
> > That depends on the intelligence of the precompiler.
> >
> > I imagine something like
> > mypp myproject.lpi
> >
> > it reads the project file and preprocesses all project files
>
> That could be done. Remains the problem of the filenames.
> If you have unita.pp in your list of units, what file will
> the preprocessor write ? It can't overwrite unita.pp...
That would be a serious problem. In no case a preprocessor should
overwrite sources not written by it.
One solution would be to have a special tags in the target file for
informing the preprocessor it can overwrite because itself has written
the file. Potential problems for users not aware of this will stay
(changing files having this comment).
A cleaner way of doing so would be to use fpc to use the pre if the file
has a special extension, as suggested.
>From digging through the sources of 2.0.4 I know there is something in
the compiler, that I don't understand fully yet:
Triggered by the switch -m some code will be compiled in surrounded by a
related symbol.
<compiler.pas:379>
{ Compile the program }
{$ifdef PREPROCWRITE}
if parapreprocess then
parser.preprocess(inputdir+inputfile+inputextension)
else
{$endif PREPROCWRITE}
parser.compile(inputdir+inputfile+inputextension);
</compiler.pas>
Can someone tell me what this construct does?
At least the scheme of implementation could be used for handing over to
or streaming through an external program, I think.
Marc
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives