Diff for /gforth/utf-8.fs between versions 1.6 and 1.7

version 1.6, 2004/12/28 17:27:24 version 1.7, 2004/12/28 21:09:47
Line 20 Line 20
   
 \ short: u8 means utf-8 encoded address  \ short: u8 means utf-8 encoded address
   
   s" malformed UTF-8 character" exception Constant UTF-8-err
   
 : u8len ( u8 -- n )  : u8len ( u8 -- n )
     dup      $80 u< IF  drop 1  EXIT  THEN \ special case ASCII      dup      $80 u< IF  drop 1  EXIT  THEN \ special case ASCII
     $800  2 >r      $800  2 >r
Line 31 Line 33
     $7F and  $40 >r      $7F and  $40 >r
     BEGIN  dup r@ and  WHILE  r@ xor      BEGIN  dup r@ and  WHILE  r@ xor
             6 lshift r> 5 lshift >r >r count              6 lshift r> 5 lshift >r >r count
 \           dup $C0 and $80 <> abort" malformed character"              dup $C0 and $80 <> IF   UTF-8-err throw  THEN
             $3F and r> or              $3F and r> or
     REPEAT  rdrop ;      REPEAT  rdrop ;
   
Line 57 Line 59
     $7F and  $40 >r      $7F and  $40 >r
     BEGIN  dup r@ and  WHILE  r@ xor      BEGIN  dup r@ and  WHILE  r@ xor
             6 lshift r> 5 lshift >r >r defers key              6 lshift r> 5 lshift >r >r defers key
 \           dup $C0 and $80 <> abort" malformed character"              dup $C0 and $80 <> IF  UTF-8-err throw  THEN
             $3F and r> or              $3F and r> or
     REPEAT  rdrop ;      REPEAT  rdrop ;
   
Line 71 Line 73
   
 \ input editor  \ input editor
   
 : save-cursor ( -- )  27 emit '7 emit ;  [IFUNDEF] #esc  27 Constant #esc  [THEN]
 : restore-cursor ( -- )  27 emit '8 emit ;  
   : save-cursor ( -- )  #esc emit '7 emit ;
   : restore-cursor ( -- )  #esc emit '8 emit ;
 : .rest ( addr pos1 -- addr pos1 )  : .rest ( addr pos1 -- addr pos1 )
     restore-cursor 2dup type ;      restore-cursor 2dup type ;
 : .all ( span addr pos1 -- span addr pos1 )  : .all ( span addr pos1 -- span addr pos1 )

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


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