Re: [Flashforth-devel] n=
Brought to you by:
oh2aun
|
From: Mikael N. <mik...@fl...> - 2021-08-02 04:01:00
|
I now remembered that in the spring I
did optimize the interpreter parsing speed and N=
has changed in an incompatible way.
I need to update the documentation.
n= ( c-addr1 c-addr2 -- flag )
Compare strings in ram(c-addr1) and flash(c-addr2)
flag is false if strings match. u<16.
: s1 s" hallo" ; ok<$,ram>
: s2 s" hello" ; ok<$,ram>
create str-buf 20 allot ok<$,ram>
s1 str-buf ok<$,ram> 6799 5 52c
place ok<$,ram>
str-buf c@+ ok<$,ram> 52d 5
type hallo ok<$,ram>
str-buf s2 ok<$,ram> 52c 67ab 5
drop ok<$,ram> 52c 67ab
1- ok<$,ram> 52c 67aa
n= ok<$,ram> 404
str-buf s1 drop 1- ok<$,ram> 404 52c 6798
n= ok<$,ram> 404 0
BR Mikael
On 2021-08-02 02:58, BK Navarette wrote:
> I tried using your example staring with 2 different strings in flash
>
> and this is the output I get:
>
> : s1 s" hello" ; ok<#,ram>
> : s2 s" hallo" ; ok<#,ram>
> ram create str-buf 20 allot ok<#,ram>
> s1 str-buf place ok<#,ram>
> ok<#,ram>
> str-buf 1+ s1 n= ok<#,ram> 979 65535
>
> str-buf 1+ s2 n= ok<#,ram> 979 65535
>
> It shows true for both? The stack effects don't lineup with the wordsAll.txt
>
> also, the input to the word shows something different than the way the
>
> example shows. What am I doing wrong, am I interperting the output wrong?
>
> Is c-addr str-buf 1+ ? what is an nfa? Shouldn't the last thing put on the stack be a
>
> number u ( u<16)? shouldn't the output be only a flag?
>
> Thanks for any help, even pointing out my ignorance. Thanks again
>
> Bian-in-ohio |