Diff for /gforth/utf-8.fs between versions 1.24 and 1.27

version 1.24, 2006/08/26 12:39:57 version 1.27, 2007/06/30 23:00:14
Line 1 Line 1
 \ UTF-8 handling                                       12dec04py  \ UTF-8 handling                                       12dec04py
   
 \ Copyright (C) 2004,2005 Free Software Foundation, Inc.  \ Copyright (C) 2004,2005,2006 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
Line 71  $80 Value max-single-byte Line 71  $80 Value max-single-byte
   
 \ utf key and emit  \ utf key and emit
   
   Defer check-xy  ' noop IS check-xy
   
 : u8key ( -- u )  : u8key ( -- u )
     defers key dup max-single-byte u< ?EXIT  \ special case ASCII      defers key dup max-single-byte u< ?EXIT  \ special case ASCII
       dup $FF = ?EXIT  \ special resize character
     dup $C2 u< IF  UTF-8-err throw  THEN  \ malformed character      dup $C2 u< IF  UTF-8-err throw  THEN  \ malformed character
     $7F and  $40 >r      $7F and  $40 >r
     BEGIN  dup r@ and  WHILE  r@ xor      BEGIN  dup r@ and  WHILE  r@ xor
Line 91  $80 Value max-single-byte Line 94  $80 Value max-single-byte
   
 \ utf-8 stuff for xchars  \ utf-8 stuff for xchars
   
 : +u8/string ( c-addr1 u1 -- c-addr2 u2 )  : u8string+ ( xcaddr u -- xcaddr u' )
     over dup u8>> swap - /string ;      over + u8>> over - ;
   : u8string- ( xcaddr u -- xcaddr u' )
       over + u8<< over - ;
   
 : -u8/string ( c-addr1 u1 -- c-addr2 u2 )  : +u8string ( xc-addr1 u1 -- xc-addr2 u2 )
       over dup u8>> swap - /string ;
   : -u8string ( xc-addr1 u1 -- xc-addr2 u2 )
     over dup u8<< swap - /string ;      over dup u8<< swap - /string ;
   
 : u8@ ( c-addr -- u )  : u8@ ( c-addr -- u )
Line 287  here wc-table - Constant #wc-table Line 294  here wc-table - Constant #wc-table
     ['] u8key is xkey      ['] u8key is xkey
     ['] u8>> is xchar+      ['] u8>> is xchar+
     ['] u8<< is xchar-      ['] u8<< is xchar-
     ['] +u8/string is +x/string  [ [IFDEF] xstring+ ]
     ['] -u8/string is -x/string      ['] u8string+ is xstring+
       ['] u8string- is xstring-
       ['] +u8string is +xstring
       ['] -u8string is -xstring
   [ [THEN] ]
     ['] u8@ is xc@      ['] u8@ is xc@
     ['] u8!+? is xc!+?      ['] u8!+? is xc!+?
     ['] u8@+ is xc@+      ['] u8@+ is xc@+

Removed from v.1.24  
changed lines
  Added in v.1.27


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