Diff for /gforth/string.fs between versions 1.13 and 1.20

version 1.13, 2011/01/01 14:22:47 version 1.20, 2012/12/31 15:25:18
Line 1 Line 1
 \ dynamic string handling                              10aug99py  \ dynamic string handling                              10aug99py
   
 \ Copyright (C) 2000,2005,2007,2010 Free Software Foundation, Inc.  \ Copyright (C) 2000,2005,2007,2010,2011,2012 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
Line 17 Line 17
 \ You should have received a copy of the GNU General Public License  \ You should have received a copy of the GNU General Public License
 \ along with this program. If not, see http://www.gnu.org/licenses/.  \ along with this program. If not, see http://www.gnu.org/licenses/.
   
   [IFUNDEF] $!
 : delete   ( buffer size n -- ) \ gforth-string  : delete   ( buffer size n -- ) \ gforth-string
     \G deletes the first @var{n} bytes from a buffer and fills the      \G deletes the first @var{n} bytes from a buffer and fills the
     \G rest at the end with blanks.      \G rest at the end with blanks.
Line 81 Line 82
     >r >r      >r >r
     $@ BEGIN  dup  WHILE  r@ $split i' -rot >r >r execute r> r>      $@ BEGIN  dup  WHILE  r@ $split i' -rot >r >r execute r> r>
     REPEAT  2drop rdrop rdrop ;      REPEAT  2drop rdrop rdrop ;
   
   : $over ( addr u $addr off -- )
       \G overwrite string at offset off with addr u
       swap >r
       r@ @ 0= IF  s" " r@ $!  THEN
       2dup + r@ $@len > IF
           2dup + r@ $@len tuck max r@ $!len
           r@ $@ rot /string bl fill
       THEN
       r> $@ rot /string rot umin move ;
   
   \ string array words
   
   : $[] ( n addr -- addr' ) >r
       \G index into the string array and return the address at index n
       r@ @ 0= IF  s" " r@ $!  THEN
       r@ $@ 2 pick cells /string
       dup cell < IF
           2drop r@ $@len
           over 1+ cells r@ $!len
           r@ $@ rot /string 0 fill
           r@ $@ 2 pick cells /string
       THEN  drop nip rdrop ;
   
   : $[]! ( addr u n $[]addr -- )  $[] $! ;
   \G store a string into an array at index n
   : $[]+! ( addr u n $[]addr -- )  $[] $+! ;
   \G add a string to the string at addr n
   : $[]@ ( n $[]addr -- addr u )  $[] dup @ IF $@ ELSE drop s" " THEN ;
   \G fetch a string from array index n -- return the zero string if empty
   [THEN]
   

Removed from v.1.13  
changed lines
  Added in v.1.20


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