Hi,

I've been battling away for a few days and ended up doing some tests
with the following code. Since my hardware at present cannot share the
usart with a serial terminal and GPS I'm typing the strings in by hand
in the terminal window to simulate what the GPS would generate. All of
this effort raised some more questions which defy me after hours of
going in circles:

: gettest ( --- a1 n1 ) \ accept some text into tib
        ." type test string now: "
        tib 40
        over swap accept
        ;       
: test$ \ ( --- )
        gettest
        over c@         \ get first char of input line
        [char] $ <>     \ test if not a $ char
        if      2drop ." No $ at start" exit
        then
        negate 1+       
        >in +!          
        drop            \ drop remaining address on stack
        [char] , parse \ returns addr len of string delimited by ,
        type \ type out what should be a string beginning with $ up to the
character before the comma
        ;

What I found was as follows:

> test$
type test string now: $aa,bbbbbbbb
$aa ?? -13 5
> test$
type test string now: $aaaaaaaa,bbbb
$aaaa ok

Clearly I do not understand how parse works. Can anyone shed some
light on this please?

Kind regards
Richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to