Discussion:
configuring ffl for ciforth
(too old to reply)
a***@spenarnc.xs4all.nl
2024-12-01 14:37:59 UTC
Permalink
https://github.com/irdvo/ffl

ffl takes no consideration for case sensitive Forth's.
So it took some more time, but I made same progress.
However I got stuck upon the following:
---------------------------------

[UNDEFINED] nil<>? [IF]

0 nil= [IF]
: nil<>? ( addr -- false | addr true = If addr is nil, then return false, else return address with true )
state @ IF
postpone ?dup
ELSE
?dup
THEN
; immediate
[ELSE]
: nil<>?
dup nil<> IF
true
ELSE
drop
false
THEN
;
[THEN

[THEN]
--------------------------------------------------

This combines a number of Forth stuff that I hate:
- Defining words by inspecting if it is undefined.
- an immediate word that it is smart
- a word that has variable output
- it contains ?DUP (bleh)
- it contains POSTPONE even postponing ?DUP

I can't progress because van Oudheusden uses this all over the place,
literally in every file, and I can't compile this piece of code.

********** PROBLEM ************************
ciforth don't know the word `` [THEN ''.
*******************************************
[I checked it and it is really in irho/ffl.]

What gives? 40 years of software maintenance have taught me to never
ever try to remove a defect if the specification of the module
is not clear. You can't properly test it without a specification,
you know.

For what it is worth gforth gives the message:
[THEN
:1: Undefined word
[THEN<<<
Can you help me?
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
mhx
2024-12-01 16:55:46 UTC
Permalink
Post by a***@spenarnc.xs4all.nl
[UNDEFINED] nil<>? [IF]
[..]
Post by a***@spenarnc.xs4all.nl
I can't progress because van Oudheusden uses this all over the place,
literally in every file, and I can't compile this piece of code.
[..]

In the iForth config.fs file
\ $Date: 2009-05-20 13:27:22 $ $Revision: 1.5 $
it is replaced by

: nil<>? ( addr -- false | addr true = If addr is nil, then return
\ false, else return address with true )
?dup ; \ relies on inlining

It's unlikely I wrote that definition, it was probably done
by Dick (he did the port himself but asked for advice).

The last comment is probably no help, but that's what you get.

-marcel
a***@spenarnc.xs4all.nl
2024-12-01 19:17:22 UTC
Permalink
Post by mhx
Post by a***@spenarnc.xs4all.nl
[UNDEFINED] nil<>? [IF]
[..]
Post by a***@spenarnc.xs4all.nl
I can't progress because van Oudheusden uses this all over the place,
literally in every file, and I can't compile this piece of code.
[..]
In the iForth config.fs file
\ $Date: 2009-05-20 13:27:22 $ $Revision: 1.5 $
it is replaced by
: nil<>? ( addr -- false | addr true = If addr is nil, then return
\ false, else return address with true )
?dup ; \ relies on inlining
It's unlikely I wrote that definition, it was probably done
by Dick (he did the port himself but asked for advice).
The last comment is probably no help, but that's what you get.
That is a bit peculiar that the code can be simplified that much.
gforth triggered not by [THEN and to my surprise after I get rid
of a parsing bug, lina no longer tries to compiler [THEN .
It is hardly reassuring.
I use the convention that 0 is a null-address. If that is the same
in iforth I can probably use the same definition.

After the toolbelt loads, this decompiles to
: nil<>?
STATE @ IF
'?DUP , ELSE ?DUP THEN
; IMMEDIATE

This amounts to the same situation in iforth.
Is that what they mean that for a normal
word you add the interpret time behaviour to the definition?
Such that I can do
'DUP? ALIAS nil<>?

My definition of ?DUP is
: ?DUP DUP IF DUP THEN ;
Is it just me? I have the nagging feeling that ?DUP was fast to
implement on microprocessors from the 80's

Groetjes Albert
Post by mhx
-marcel
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
mhx
2024-12-02 01:58:19 UTC
Permalink
[..]
Post by a***@spenarnc.xs4all.nl
I use the convention that 0 is a null-address. If that is the same
in iforth I can probably use the same definition.
I don't know what the purpose of the word under questioning is.
If it is to query for 'unsafe' addresses, or one specific
unsafe address, then 0 will work...
FORTH> 0 ?
Caught exception 0xc0000005
ACCESS VIOLATION
instruction pointer = $000000000124A1DB
RAX = $01253425 RBX = $00000000
RCX = $00000000 RDX = $0000005F
RSI = $01155C00 RDI = $2F06F7D0
RBP = $01125F88 RSP = $2F06F818
R8 = $00001320 R9 = $00000020
R10 = $00FB0000 R11 = $00000000
R12 = $00FB0000 R13 = $01157000
R14 = $01136000 R15 = $01110000
Hardware exception in ``?''+$0000000B
**** RETURN STACK DUMP **** for MAIN-THREAD

.. but 1 ? , or everything out of the program's memory
is just as bad.

On a transputer 0 ? could be perfect valid, but IIRC,
Parsec's C compiler treated it as an exception and we
followed them with tForth. Not sure if the FFL had this
in mind.

-marcel

Loading...