[fpc-pascal] run pascal programs as scripts
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Mar 24 18:52:36 CET 2011
On Thu, 24 Mar 2011 18:38:04 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:
>
>
> On Thu, 24 Mar 2011, Mattias Gaertner wrote:
>
> > Hi all,
> >
> > I would like to execute small pascal programs like normal unix
> > scripts. For example:
> >
> > #!/usr/bin/instantfpc
> > begin
> > writeln('shebang executed');
> > end.
> >
> > Has anyone already written a tool, that compiles and
> > runs the program?
>
> As far as I know, the "!/something just means, start /something,
> and pass current filename as a commandline param ?
>
> So all your tool has to do is write all except the first line to a temp file,
> compile temp file and execute it ?
Almost.
- It should return the exit code.
- If compile fails it should print out the fpc output.
- It should give nice error messages.
- Handle spaces in parameters correctly.
- Preferably it recompiles only if source changed.
Mattias
More information about the fpc-pascal
mailing list