gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] gforthmi and FFL


From: Bernd Paysan
Subject: Re: [gforth] gforthmi and FFL
Date: Thu, 14 Jun 2012 18:37:49 +0200
User-agent: KMail/4.8.4 (Linux/3.1.10-1.9-desktop; KDE/4.8.4; x86_64; ; )

Am Donnerstag, 14. Juni 2012, 14:22:45 schrieb Marcos Cruz:
> Hello,
> 
> I've noticed gforthmi doesn't work when Forth Foundation Library is
> loaded.  It starts Gforth and halts. First I thought the problem was
> the code of my game, but after a long debugging I found out the reason
> was the following line in the FFL's config.fs for Gforth:
> 
> ----8<----------------------------------------------------------
> 0 argc !            \ tell gforth not to process any more arguments
> ----8<----------------------------------------------------------
> 
> After commenting it out, gforthmi worked fine.

Of course. Gforthmi calls gforth with arguments to load the stuff, and *then* 
save it. "Then save it" is performed by appending -e "savesystem $tempfileX 
bye" to the command line.

> I contacted the author of FFL, but he thinks the problem is Gforth's:
> 
> ----8<----------------------------------------------------------
> The line
> 
> 0 argc !            \ tell gforth not to process any more arguments
> 
> prevents gforth interpreting command line arguments for the script and
> not for gforth. The line works well with gforth and enables the
> argument parser module in the ffl for gforth.
> 
> If the line isn't working for gfortmi, perhaps you should contact the
> gforth team with this problem.
> ----8<----------------------------------------------------------

Hm, ffl is pulling the carpet under our feets.  This is clearly a conflict.  
We want gforthmi to take normal Gforth engine+Gforth image options, this won't 
work that way.  We would have to split the options into image options (have to 
be first), then the -e "process-args savesystem ${tempfile}X bye" and then 
finally the runtime options.

The code looks erroneous, in any case.  It's only done on 32 bit Gforth, what 
about 64 bit Gforth?  The right way to interface with Gforth's argument parser 
is to communicate with it, i.e. by using the next-arg word to get the next 
argument to parse.  Then ffl's arg parser only consumes args when it is 
actually used (that's how it should be), and only for those args where it is 
used.

Since apparently Gforth is the only system where the arg library works (by 
actually providing #args), making it right there should not be such a big 
problem.

> I use Gforth 0.7.0 on Debian 6.0.5.

And apparently 32 bit, because in 64 bit Gforth, the problem (and the arg 
parser functionality) magically disappears ;-).

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]