* Stefan Reinauer stepan@suse.de [020625 13:00]:
0 > s" constant" $find ok 3 > .s 120019b88 0 -1 ok
Our definition seems to be wrong: col($FIND LAST @ >R 2DUP R@ COMP-WORD ?BRANCH(9) 2DROP R> DUP >XCODE SWAP CELL+ C@ TRUE EXIT R> @ ?DUP 0= ?BRANCH(-21) 2DROP FALSE)
what exactly does "SWAP CELL+ C@" do? should this not just be a NIP ?
Ah.. it fetches the word's flags, stupid me. This is not correct according to the standard, though we do need this flag.
I have two things in mind:
* the word SEE * the fcode evaluator
for the first one we need to be able to get to a word's header when we have the execution token (xt). This seems impossible at the moment as we have a variable header length
for the second we need to know at least whether the word is compile-only or immediate, given only the xt. Currently my implementation of the evaluator keeps a lookup table containing of xts for every word available in fcode, using the fcode# as an index in this table. This is created via ' end0 , [..]
I wrote a little function for this problem, but it runs in O(N), linear to the number of dictionary entries:
: xt>hdr ( xt -- addr-a ) last @ begin 2dup >xcode = if nip exit then @ dup 0= until ;
This looks suboptimal, but I'm going to use it until something better comes up.
Anny comments?
Stefan