Diff for /gforth/utf-8.fs between versions 1.39 and 1.43

version 1.39, 2009/05/11 08:07:44 version 1.43, 2011/09/01 20:09:23
Line 1 Line 1
 \ UTF-8 handling                                       12dec04py  \ UTF-8 handling                                       12dec04py
   
 \ Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc.  \ Copyright (C) 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
Line 273  here wc-table - Constant #wc-table Line 273  here wc-table - Constant #wc-table
   
 \ inefficient table walk:  \ inefficient table walk:
   
 : wcwidth ( xc -- n )  : xc-width ( xc -- n )
     wc-table #wc-table over + swap ?DO      wc-table #wc-table over + swap ?DO
         dup I 2@ within IF  I 2 cells + @  UNLOOP EXIT  THEN          dup I 2@ within IF  I 2 cells + @  UNLOOP EXIT  THEN
     3 cells +LOOP  1 ;      3 cells +LOOP  1 ;
   [ELSE]
       ' wcwidth Alias xc-width
 [THEN]  [THEN]
           
 : u8width ( xcaddr u -- n )  : u8width ( xcaddr u -- n )
     0 rot rot over + swap ?DO      0 rot rot over + swap ?DO
         I xc@+ swap >r wcwidth +          I xc@+ swap >r xc-width +
     r> I - +LOOP ;      r> I - +LOOP ;
   
 : set-encoding-utf-8 ( -- )  : set-encoding-utf-8 ( -- )
Line 298  here wc-table - Constant #wc-table Line 300  here wc-table - Constant #wc-table
     ['] +u8/string is +x/string      ['] +u8/string is +x/string
 [ [THEN] ]  [ [THEN] ]
     ['] u8@ is xc@      ['] u8@ is xc@
   [ [IFDEF] xc!+ ]
       ['] u8!+ is xc!+
   [ [THEN] ]
     ['] u8!+? is xc!+?      ['] u8!+? is xc!+?
     ['] u8@+ is xc@+      ['] u8@+ is xc@+
     ['] u8len is xc-size      ['] u8len is xc-size

Removed from v.1.39  
changed lines
  Added in v.1.43


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