18.6.1.2487.25
XC-SIZE
x-c-size
XCHAR
(
xchar
--
u
)
u
is the number of pchars used to encode
xchar
in memory.
Implementation:
:
XC-SIZE
(
xchar -- n )
DUP
$80
U<
IF
DROP
1
EXIT
THEN
\
special case ASCII
$800 2
>R
BEGIN
2DUP
U>=
WHILE
5
LSHIFT
R>
1+
>R
DUP
0=
UNTIL
THEN
2DROP
R>
;
Testing:
This test assumes UTF-8 encoding is being used.
HEX
T{ 0
XC-SIZE
-> 1 }T
T{ 7f
XC-SIZE
-> 1 }T
T{ 80
XC-SIZE
-> 2 }T
T{ 7ff
XC-SIZE
-> 2 }T
T{ 800
XC-SIZE
-> 3 }T
T{ ffff
XC-SIZE
-> 3 }T
T{ 10000
XC-SIZE
-> 4 }T
T{ 1fffff
XC-SIZE
-> 4 }T
Forth 2012
Forth 2012
Extended-Character word set
Foreword
Proposals Process
200
x
Membership
Introduction
Terms, notation, and references
Usage requirements
Documentation requirements
Compliance and labeling
Glossary
Block word set
Double-Number word set
Exception word set
Facility word set
File-Access word set
Floating-Point word set
Locals word set
Memory-Allocation word set
Programming-Tools word set
Search-Order word set
String word set
Extended-Character word set
Rationale
Bibliography
Compatibility analysis
Portability guide
Reference Implementations
Test Suite
Alphabetic list of words
Glossary
Introduction
Additional terms and notation
Additional usage requirements
Additional documentation requirements
Compliance and labeling
Glossary
XC-SIZE
X-SIZE
XC!+
XC!+?
XC,
XC-SIZE
XC@+
XCHAR+
XEMIT
XKEY
XKEY?
+X/STRING
-TRAILING-GARBAGE
CHAR
EKEY>XCHAR
PARSE
X-WIDTH
XC-WIDTH
XCHAR-
XHOLD
X\STRING-
[CHAR]