Annotation of gforth/compat/strcomp.fs, revision 1.1

1.1     ! anton       1: \ string comparisons
        !             2: 
        !             3: \ This file is in the public domain. NO WARRANTY.
        !             4: 
        !             5: \ Uses of COMPARE can be replaced with STR=, STRING-PREFIX?, and STR<
        !             6: \ (and these can be implemented more efficiently and used more easily
        !             7: \ than COMPARE).  See <news:2002Aug12.110229@a0.complang.tuwien.ac.at>
        !             8: \ and following.
        !             9: 
        !            10: s" gforth" environment? [if]
        !            11:     defined str=
        !            12: [else]
        !            13:     0
        !            14: [then]
        !            15: 0= [if]
        !            16: 
        !            17: : str= ( c-addr1 u1 c-addr2 u2 -- f )
        !            18:     compare 0= ;
        !            19: 
        !            20: : string-prefix? ( c-addr1 u1 c-addr2 u2 -- f )
        !            21:     \G Is @var{c-addr2 u2} a prefix of @var{c-addr1 u1}?
        !            22:     tuck 2>r min 2r> str= ;
        !            23: 
        !            24: : str< ( c-addr1 u1 c-addr2 u2 -- f )
        !            25:     compare 0< ;
        !            26: 
        !            27: [then]

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>