--- gforth/utf-8.fs 2005/11/05 23:26:49 1.17 +++ gforth/utf-8.fs 2006/02/19 17:27:12 1.19 @@ -1,6 +1,6 @@ \ UTF-8 handling 12dec04py -\ Copyright (C) 2004 Free Software Foundation, Inc. +\ Copyright (C) 2004,2005 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -128,6 +128,11 @@ $80 Value max-single-byte nip nip over - then ; +: u8width ( xcaddr u -- n ) + 0 rot rot over + swap ?DO + I xc@+ swap >r wcwidth + + r> I - +LOOP ; + : set-encoding-utf-8 ( -- ) ['] u8emit is xemit ['] u8key is xkey @@ -139,6 +144,7 @@ $80 Value max-single-byte ['] u8!+? is xc!+? ['] u8@+ is xc@+ ['] u8len is xc-size + ['] u8width is x-width ['] -u8trailing-garbage is -trailing-garbage ;