[fpc-devel] Output flush on pipes
Daniël Mantione
daniel.mantione at freepascal.org
Sun May 14 11:12:04 CEST 2006
Op Sun, 14 May 2006, schreef Michael Van Canneyt:
>
>
> On Sun, 14 May 2006, Daniël Mantione wrote:
>
> >
> >
> > Op Sun, 14 May 2006, schreef Martin Schreiber:
> >
> > > Since some time FPC doesn't flush output on pipes after writeln.
> > > On linux I can use a pseudo terminal, what can I do on win32 to get flushed
> > > output from FPC into the message window of MSEide?
> >
> > It is strongly recommended against to parse the compiler output, as it is
> > designed for humans, not computers. The formatting of the compiler output
> > can therefore change in time and can also be configured by the user in any
> > language. Some people are doing it anyway, like Lazarus.
> >
> > The compiler has an interface designed for computers and that is through
> > the compiler and comphook units. This allows you to retrieve the messages
> > neatly. If you want process separation, please write a wrapper that puts
> > the messages in a computer friendly way, and we'll include it in FPC.
>
> We could do this ourselves by assigning a unique number to each error.
> (and keeping these numbers)
I think a command line output for computers needs to be a bit more
advanced, take for example this error message:
testc.pas(11,1) Fatal: Syntax error, "BEGIN" expected but "identifier Z" found
We have:
* The source file
* The error location
* The error severity
* The error message, containing two parameters.
Both the severity and error message are currently unpredictable, i.e. they
can be translated for example. Some IDE's may want to have access to the
error messages their parameters as well.
A command line output for computers also needs to be extendable, if we
want to output more information, this should not break existing
applications.
For example, a good way to output this error message in a computer
friendly format would be:
error:(file='testc.pas';line=11;column=1;message_code='02003_F';
message='Syntax error, $1 expected but $2 found';
parameters=('BEGIN','IDENTIFIER Z'));
Daniël
More information about the fpc-devel
mailing list