[fpc-pascal] run pascal programs as scripts
ludo.brands at free.fr
Mon Apr 25 10:24:58 CEST 2011
> One solution:
> PATH=YourDirectory:$PATH; script.pas
I prefer to keep the PATH intact. I'll use:
bash -c "PATH=YourDirectory:$PATH; script.pas"
> Another solution:
> A parameter could be added to instantfpc to specify the compiler.
Would be the most elegant solution. I understand the "search in the
directory of calling program first" is not very Linux though.
> This is is how shebang works internally. I didn't know the internals of
shebang until I wrote
> instantfpc. That's why I think a user does not need that information.
Learned also something new.
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de Mattias
Envoyé : samedi 23 avril 2011 20:57
À : fpc-pascal at lists.freepascal.org
Objet : Re: [fpc-pascal] run pascal programs as scripts
On Sat, 23 Apr 2011 20:27:37 +0200
"Ludo Brands" <ludo.brands at free.fr> wrote:
> Nice tool.
> 2 requests:
> - I would like to select the compiler. I'm typically working with the
> svn version of compiler but have in my PATH a stable version of the
> >From the sources I can see that the compiler is searched for only in
> PATH. A simple solution would be to look first for the compiler in the
> path specified in the shebang and, if not found, then in the PATH.
A parameter could be added to instantfpc to specify the compiler.
> - I was going to ask for the possibility of passing parameters to the
Just like a normal script:
> Scripts without the possiblity to pass parameters are not really
Indeed, that would be total crap.
> And we do't want to put parameters in the program neither since it
> would be re-compiled everytime the parameters change. Looking at the
> source I figured out that the compiler parameters stop at the first
> parameter not starting with a "-"
Yes, that parameter is the "script.pas".
> and passes the rest on to the program. Great,needs to be added to the
This is is how shebang works internally. I didn't know the internals of
shebang until I wrote instantfpc. That's why I think a user does not need
> but... The cache is compared to the complete
> script, including the shebang. So if a program parameter is changed,
> the program is re-compiled... The shebang is commented out but program
> parameters should be removed before compare. Recompiling if compiler
> parameters change is OK.
The shebang contains the parameters for the compiler, not for the script.
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal