Diff for /gforth/history.fs between versions 1.7 and 1.9

version 1.7, 1995/09/06 21:00:17 version 1.9, 1996/01/07 17:22:11
Line 1 Line 1
 \ History file support                                 16oct94py  \ History file support                                 16oct94py
   
   \ Copyright (C) 1995 Free Software Foundation, Inc.
   
   \ This file is part of Gforth.
   
   \ Gforth is free software; you can redistribute it and/or
   \ modify it under the terms of the GNU General Public License
   \ as published by the Free Software Foundation; either version 2
   \ of the License, or (at your option) any later version.
   
   \ This program is distributed in the hope that it will be useful,
   \ but WITHOUT ANY WARRANTY; without even the implied warranty of
   \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   \ GNU General Public License for more details.
   
   \ You should have received a copy of the GNU General Public License
   \ along with this program; if not, write to the Free Software
   \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   
 0 Value history  0 Value history
   
 2Variable forward^  2Variable forward^
Line 79  Create lfpad #lf c, Line 97  Create lfpad #lf c,
 Create prefix-found  0 , 0 ,  Create prefix-found  0 , 0 ,
   
 : word-lex ( nfa1 nfa2 -- -1/0/1 )  : word-lex ( nfa1 nfa2 -- -1/0/1 )
   dup 0=  IF  2drop 1  EXIT  THEN      dup 0=
   cell+ >r cell+ count $1F and      IF
   dup r@ c@ $1F and =          2drop 1  EXIT
   IF  r> char+ capscomp 0<=  EXIT  THEN      THEN
   nip r> c@ $1F and < ;      name>string 2>r name>string
       dup r@ =
 : search-voc ( addr len nfa1 nfa2 -- addr len nfa3 ) >r      IF
     BEGIN  dup  WHILE  >r dup r@ cell+ c@ $1F and <=          rdrop r> capscomp 0<= EXIT
         IF  2dup r@ cell+ char+ capscomp  0=      THEN
             IF  r> dup r@ word-lex      r> <
                 IF  dup prefix-found @ word-lex      nip rdrop ;
                     0>= IF  rdrop dup >r  THEN  
                 THEN >r  : search-voc ( addr len nfa1 nfa2 -- addr len nfa3 )
       >r
       BEGIN
           dup
       WHILE
           >r dup r@ name>string nip <=
           IF
               2dup r@ name>string drop capscomp  0=
               IF
                   r> dup r@ word-lex
                   IF
                       dup prefix-found @ word-lex
                       0>=
                       IF
                           rdrop dup >r
                       THEN
                   THEN
                   >r
             THEN              THEN
         THEN  r> @          THEN
     REPEAT drop r> ;          r> @
       REPEAT
       drop r> ;
   
 : prefix-string ( addr len nfa -- addr' len' )  : prefix-string ( addr len nfa -- addr' len' )
     dup prefix-found !  ?dup      dup prefix-found !  ?dup
     IF  cell+ count $1F and rot /string rot drop      IF
           name>string rot /string rot drop
         dup 1+ prefix-found cell+ !          dup 1+ prefix-found cell+ !
     ELSE      ELSE
         2drop s" " prefix-found cell+ off          2drop s" " prefix-found cell+ off

Removed from v.1.7  
changed lines
  Added in v.1.9


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