author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 22 Apr 2015 07:33:07 +0100 | |
branch | jv |
changeset 18261 | 22bdfc405bca |
parent 18217 | d222015cc39c |
parent 18240 | 28af09029a8b |
child 18274 | 042d13555f1f |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
154 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5407 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
17346 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
1 | 16 |
Magnitude subclass:#Character |
995
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
17 |
instanceVariableNames:'asciivalue' |
17249 | 18 |
classVariableNames:'CharacterTable Separators' |
995
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
19 |
poolDictionaries:'' |
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
20 |
category:'Magnitude-General' |
1 | 21 |
! |
22 |
||
2124 | 23 |
!Character class methodsFor:'documentation'! |
54 | 24 |
|
88 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
154 | 28 |
All Rights Reserved |
88 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
54 | 39 |
documentation |
40 |
" |
|
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
41 |
This class represents characters. |
7897 | 42 |
|
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
43 |
Notice, that actual character objects are not used when characters |
17249 | 44 |
are stored in strings, symbols etc. |
45 |
These only store a character's asciiValue/codePoint for a more compact representation. |
|
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
46 |
The word 'asciiValue' is a historic leftover - actually, any integer |
8028 | 47 |
code is allowed and actually used (i.e. characters are not limited to 8bit). |
17249 | 48 |
Also, the encoding is actually Unicode, of which ascii is a subset and the same encoding value |
49 |
for the first 128 characters (codePoint 0 to 127 are the same in ascii). |
|
50 |
||
18215 | 51 |
Some heavily used Characters are kept as singletons; i.e. for every asciiValue (0..N), |
17249 | 52 |
there exists exactly one instance of Character, which is shared. |
53 |
Character value:xxx checks for this, and returns a reference to an existing instance. |
|
54 |
For N<=255, this is guaranteed; i.e. in all Smalltalks, the single byte characters are always |
|
55 |
handled like this, and you can therefore safely compare them using == (identity compare). |
|
56 |
||
57 |
Other characters (i.e. codepoint > N) are not guaranteed to be shared; |
|
18215 | 58 |
i.e. these my or may not be created as required. |
17249 | 59 |
Actually, do NOT depend on which characters are and which are not shared. |
60 |
Always compare using #= if there is any chance of a non-ascii character being involved. |
|
61 |
||
62 |
Once again (because beginners sometimes make this mistake): |
|
18215 | 63 |
This means: you may compare characters using #== ONLY IFF you are certain, |
64 |
that the characters ranges is 0..255. |
|
65 |
Otherwise, you HAVE TO compare using #=. (if in doubt, always compare using #=). |
|
66 |
Sorry for this inconvenience, but it is (practically) impossible to keep |
|
67 |
the possible maximum of 2^32 characters (Unicode) around, for that convenience alone. |
|
17249 | 68 |
|
69 |
In ST/X, N is (currently) 1024. This means that all the latin characters and some others are |
|
70 |
kept as singleton in the CharacterTable class variable (which is also used by the VM when characters |
|
71 |
are instanciated). |
|
357 | 72 |
|
68 | 73 |
Methods marked as (JS) come from the manchester Character goody |
74 |
(CharacterComparing) by Jan Steinman, which allow Characters to be used as |
|
9153 | 75 |
Interval elements (i.e. ($a to:$z) do:[...] ); |
1229 | 76 |
They are not a big deal, but convenient add-ons. |
77 |
Some of these have been modified a bit. |
|
1 | 78 |
|
68 | 79 |
WARNING: characters are known by compiler and runtime system - |
18215 | 80 |
do not change the instance layout. |
357 | 81 |
|
82 |
Also, although you can create subclasses of Character, the compiler always |
|
83 |
creates instances of Character for literals ... |
|
814
d4d28ca7afcd
made the global CharacterTable a classVar of Character
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
84 |
... and other classes are hard-wired to always return instances of characters |
357 | 85 |
in some cases (i.e. String>>at:, Symbol>>at: etc.). |
86 |
Therefore, it may not make sense to create a character-subclass. |
|
1295 | 87 |
|
8028 | 88 |
Case Mapping in Unicode: |
18215 | 89 |
There are a number of complications to case mappings that occur once the repertoire |
90 |
of characters is expanded beyond ASCII. |
|
91 |
||
92 |
* Because of the inclusion of certain composite characters for compatibility, |
|
93 |
such as U+01F1 'DZ' capital dz, there is a third case, called titlecase, |
|
94 |
which is used where the first letter of a word is to be capitalized |
|
95 |
(e.g. Titlecase, vs. UPPERCASE, or lowercase). |
|
96 |
For example, the title case of the example character is U+01F2 'Dz' capital d with small z. |
|
97 |
||
98 |
* Case mappings may produce strings of different length than the original. |
|
99 |
For example, the German character U+00DF small letter sharp s expands when uppercased to |
|
100 |
the sequence of two characters 'SS'. |
|
101 |
This also occurs where there is no precomposed character corresponding to a case mapping. |
|
102 |
*** This is not yet implemented (in 5.2) *** |
|
103 |
||
104 |
* Characters may also have different case mappings, depending on the context. |
|
105 |
For example, U+03A3 capital sigma lowercases to U+03C3 small sigma if it is not followed |
|
106 |
by another letter, but lowercases to 03C2 small final sigma if it is. |
|
107 |
*** This is not yet implemented (in 5.2) *** |
|
108 |
||
109 |
* Characters may have case mappings that depend on the locale. |
|
110 |
For example, in Turkish the letter 0049 'I' capital letter i lowercases to 0131 small dotless i. |
|
111 |
*** This is not yet implemented (in 5.2) *** |
|
112 |
||
113 |
* Case mappings are not, in general, reversible. |
|
114 |
For example, once the string 'McGowan' has been uppercased, lowercased or titlecased, |
|
115 |
the original cannot be recovered by applying another uppercase, lowercase, or titlecase operation. |
|
8028 | 116 |
|
117 |
Collation Sequence: |
|
18215 | 118 |
*** This is not yet implemented (in 5.2) *** |
8028 | 119 |
|
1295 | 120 |
[author:] |
18215 | 121 |
Claus Gittinger |
1295 | 122 |
|
123 |
[see also:] |
|
18215 | 124 |
String TwoByteString Unicode16String Unicode32String |
125 |
StringCollection Text |
|
54 | 126 |
" |
127 |
! ! |
|
1 | 128 |
|
2124 | 129 |
!Character class methodsFor:'instance creation'! |
1 | 130 |
|
131 |
basicNew |
|
132 |
"catch new - Characters cannot be created with new" |
|
133 |
||
134 |
^ self error:'Characters cannot be created with new' |
|
135 |
! |
|
136 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
137 |
codePoint:anInteger |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
138 |
"return a character with codePoint anInteger" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
139 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
140 |
%{ /* NOCONTEXT */ |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
141 |
#ifdef __SCHTEAM__ |
18215 | 142 |
{ |
143 |
char ch = (char)(context.stArg(0).intValue("[codePoint:]")); |
|
144 |
||
145 |
return context._RETURN(STCharacter._new(ch)); |
|
146 |
} |
|
147 |
/* NOTREACHED */ |
|
148 |
#else |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
149 |
INT __codePoint; |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
150 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
151 |
if (__isSmallInteger(anInteger)) { |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
152 |
__codePoint = __smallIntegerVal(anInteger); |
14684 | 153 |
if ((unsigned INT)(__codePoint) <= MAX_IMMEDIATE_CHARACTER /* (__codePoint >= 0) && (__codePoint <= 255) */) { |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
154 |
RETURN ( __MKCHARACTER(__codePoint) ); |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
155 |
} else { |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
156 |
RETURN ( __MKUCHARACTER(__codePoint) ); |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
157 |
} |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
158 |
} |
18215 | 159 |
#endif |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
160 |
%}. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
161 |
(anInteger between:0 and:(CharacterTable size - 1)) ifTrue:[ |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
162 |
^ CharacterTable at:(anInteger + 1) |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
163 |
]. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
164 |
(anInteger between:16r100 and:16r3FFFFFFF) ifTrue:[ |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
165 |
^ super basicNew setCodePoint:anInteger |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
166 |
]. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
167 |
" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
168 |
a characters codePoint must be 0..16r3FFFFFFF. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
169 |
(i.e. only characters with up-to 30 bits are allowed.) |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
170 |
" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
171 |
RangeError raiseWith:anInteger errorString:'invalid codePoint for character' |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
172 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
173 |
" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
174 |
self codePoint:16r34. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
175 |
self codePoint:16r3455. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
176 |
self codePoint:16rFFFFFFFFFFFFFFFFFFF. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
177 |
" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
178 |
! |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
179 |
|
699 | 180 |
digitValue:anInteger |
181 |
"return a character that corresponds to anInteger. |
|
182 |
0-9 map to $0-$9, 10-35 map to $A-$Z" |
|
183 |
||
184 |
|val "{ Class: SmallInteger }" | |
|
185 |
||
186 |
val := anInteger. |
|
187 |
(val between:0 and:9) ifTrue:[ |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
188 |
^ Character codePoint:(val + ($0 codePoint)) |
699 | 189 |
]. |
190 |
(val between:10 and:35) ifTrue:[ |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
191 |
^ Character codePoint:(val + ($A codePoint - 10)) |
699 | 192 |
]. |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
193 |
^ self error:'value not in range 0 to 35' |
699 | 194 |
! |
195 |
||
6808 | 196 |
utf8DecodeFrom:aStream |
197 |
"read and return a single unicode character from an UTF8 encoded stream" |
|
198 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
199 |
|fetchNext c1 c2 c3 c4 c5 codePoint| |
6808 | 200 |
|
201 |
c1 := aStream next. |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
202 |
codePoint := c1 codePoint. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
203 |
codePoint <= 16r7F ifTrue:[ |
16074 | 204 |
"/ 0xxxxxxx - 7 bits |
205 |
^ c1. |
|
6808 | 206 |
]. |
207 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
208 |
(codePoint bitAnd:2r11000000) == 2r10000000 ifTrue:[ |
16074 | 209 |
"/ out of sync (got an intermediate character) |
210 |
InvalidEncodingError raiseRequestWith:codePoint errorString:' - out of sync'. |
|
211 |
^ c1. |
|
6808 | 212 |
]. |
213 |
||
214 |
fetchNext := [ |ch| |
|
16074 | 215 |
ch := aStream next. |
216 |
(ch codePoint bitAnd:2r11000000) == 2r10000000 ifFalse:[ |
|
217 |
"/ followup chars must have 2r10 in high bits |
|
218 |
InvalidEncodingError raiseRequestWith:ch codePoint. |
|
219 |
^ c1. |
|
220 |
]. |
|
221 |
ch |
|
222 |
]. |
|
6808 | 223 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
224 |
(codePoint bitAnd:2r11100000) == 2r11000000 ifTrue:[ |
16074 | 225 |
"/ 110xxxxx 10xxxxxx - 11 bits |
226 |
c2 := fetchNext value. |
|
227 |
codePoint := c1 codePoint bitAnd:16r1F. |
|
228 |
codePoint := (codePoint bitShift:6) bitOr:(c2 codePoint bitAnd:16r3F). |
|
229 |
codePoint <= 16r7F ifTrue:[ |
|
230 |
InvalidEncodingError raiseRequestWith:codePoint. |
|
231 |
]. |
|
232 |
^ Character codePoint:codePoint |
|
6808 | 233 |
]. |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
234 |
(codePoint bitAnd:2r11110000) == 2r11100000 ifTrue:[ |
16074 | 235 |
"/ 1110xxxx 10xxxxxx 10xxxxxx - 16 bits |
236 |
c2 := fetchNext value. |
|
237 |
c3 := fetchNext value. |
|
238 |
codePoint := c1 codePoint bitAnd:16r0F. |
|
239 |
codePoint := (codePoint bitShift:6) bitOr:(c2 codePoint bitAnd:16r3F). |
|
240 |
codePoint := (codePoint bitShift:6) bitOr:(c3 codePoint bitAnd:16r3F). |
|
241 |
codePoint <= 16r7FF ifTrue:[ |
|
242 |
InvalidEncodingError raiseRequestWith:codePoint. |
|
243 |
]. |
|
244 |
^ Character codePoint:codePoint |
|
6808 | 245 |
]. |
246 |
||
247 |
"/ notice: currently, characters can only have 16bit encoding; |
|
248 |
"/ therefore the following will raise a runtime exception, |
|
249 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
250 |
(codePoint bitAnd:2r11111000) == 2r11110000 ifTrue:[ |
16074 | 251 |
"/ 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - 21 bits |
252 |
c2 := fetchNext value. |
|
253 |
c3 := fetchNext value. |
|
254 |
c4 := fetchNext value. |
|
255 |
codePoint := c1 codePoint bitAnd:16r07. |
|
256 |
codePoint := (codePoint bitShift:6) bitOr:(c2 codePoint bitAnd:16r3F). |
|
257 |
codePoint := (codePoint bitShift:6) bitOr:(c3 codePoint bitAnd:16r3F). |
|
258 |
codePoint := (codePoint bitShift:6) bitOr:(c4 codePoint bitAnd:16r3F). |
|
259 |
codePoint <= 16rFFFF ifTrue:[ |
|
260 |
InvalidEncodingError raiseRequestWith:codePoint. |
|
261 |
]. |
|
262 |
^ Character codePoint:codePoint |
|
6808 | 263 |
]. |
264 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
265 |
(codePoint bitAnd:2r11111100) == 2r11111000 ifTrue:[ |
16074 | 266 |
"/ 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - 26 bits |
267 |
c2 := fetchNext value. |
|
268 |
c3 := fetchNext value. |
|
269 |
c4 := fetchNext value. |
|
270 |
c5 := fetchNext value. |
|
271 |
codePoint := c1 codePoint bitAnd:16r03. |
|
272 |
codePoint := (codePoint bitShift:6) bitOr:(c2 codePoint bitAnd:16r3F). |
|
273 |
codePoint := (codePoint bitShift:6) bitOr:(c3 codePoint bitAnd:16r3F). |
|
274 |
codePoint := (codePoint bitShift:6) bitOr:(c4 codePoint bitAnd:16r3F). |
|
275 |
codePoint := (codePoint bitShift:6) bitOr:(c5 codePoint bitAnd:16r3F). |
|
276 |
codePoint <= 16r1FFFFF ifTrue:[ |
|
277 |
InvalidEncodingError raiseRequestWith:codePoint. |
|
278 |
]. |
|
279 |
^ Character codePoint:codePoint |
|
6808 | 280 |
]. |
281 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
282 |
(codePoint bitAnd:2r11111110) == 2r11111100 ifTrue:[ |
16074 | 283 |
"/ 1111110x ... 10xxxxxx - any number of bits |
284 |
codePoint := c1 codePoint bitAnd:16r01. |
|
285 |
||
286 |
c2 := aStream peek. |
|
287 |
[c2 notNil and:[(c2 codePoint bitAnd:2r11000000) == 2r10000000]] whileTrue:[ |
|
288 |
codePoint := (codePoint bitShift:6) bitOr:(c2 codePoint bitAnd:16r3F). |
|
289 |
aStream next. |
|
290 |
c2 := aStream peek. |
|
291 |
]. |
|
292 |
codePoint <= 16r3FFFFFF ifTrue:[ |
|
293 |
InvalidEncodingError raiseRequestWith:codePoint. |
|
294 |
]. |
|
295 |
^ Character codePoint:codePoint |
|
6808 | 296 |
]. |
297 |
||
11325
b2ba4174deb8
Raise InvalidEncodingError when utf8 decode fails
Stefan Vogel <sv@exept.de>
parents:
11321
diff
changeset
|
298 |
InvalidEncodingError raiseRequestWith:codePoint. |
6808 | 299 |
^ c1 |
300 |
||
301 |
" |
|
9153 | 302 |
Character utf8DecodeFrom:'a' readStream |
303 |
Character utf8DecodeFrom:#[195 188] asString readStream |
|
304 |
" |
|
6808 | 305 |
|
306 |
"test: |
|
307 |
||
308 |
|utf8Encoding original readBack| |
|
309 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
310 |
1 to:16rFFFF do:[:codePoint | |
16074 | 311 |
original := Character value:codePoint. |
312 |
utf8Encoding := original asString utf8Encoded. |
|
313 |
readBack := Character utf8DecodeFrom:(utf8Encoding readStream). |
|
314 |
readBack codePoint = codePoint ifFalse:[ |
|
315 |
self halt |
|
316 |
] |
|
6808 | 317 |
] |
318 |
" |
|
319 |
! |
|
320 |
||
1 | 321 |
value:anInteger |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
322 |
"return a character with codePoint anInteger - backward compatibility" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
323 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
324 |
^ self codePoint:anInteger |
5945 | 325 |
! ! |
326 |
||
2214 | 327 |
!Character class methodsFor:'accessing untypeable characters'! |
328 |
||
15689 | 329 |
controlCharacter:char |
330 |
"Answer the Character representing ctrl-char. |
|
331 |
ctrl-a -> 1; ctrl-@ -> 0" |
|
332 |
||
333 |
char == $@ ifTrue:[^ self codePoint:0]. |
|
334 |
self assert:char isLetter. |
|
335 |
^ self codePoint:(char asLowercase - $a + 1) |
|
336 |
||
337 |
" |
|
338 |
self controlCharacter:$@ |
|
339 |
self controlCharacter:$d |
|
340 |
" |
|
341 |
! |
|
342 |
||
2214 | 343 |
endOfInput |
11144 | 344 |
"Answer the Character representing ctrl-d (Unix-EOF)." |
9153 | 345 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
346 |
^ self codePoint:4 |
2214 | 347 |
! |
348 |
||
349 |
leftParenthesis |
|
8097 | 350 |
"Answer the Character representing a left parenthesis." |
9153 | 351 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
352 |
^ self codePoint:40 |
2214 | 353 |
! |
354 |
||
355 |
period |
|
8097 | 356 |
"Answer the Character representing a carriage period." |
9153 | 357 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
358 |
^ self codePoint:46 |
2214 | 359 |
! |
360 |
||
361 |
poundSign |
|
11144 | 362 |
"Answer the Character representing a pound sign (hash)." |
9153 | 363 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
364 |
^ self codePoint:35 |
2214 | 365 |
! |
366 |
||
367 |
rightParenthesis |
|
8097 | 368 |
"Answer the Character representing a right parenthesis." |
9153 | 369 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
370 |
^ self codePoint:41 |
2214 | 371 |
! ! |
372 |
||
2124 | 373 |
!Character class methodsFor:'constants'! |
699 | 374 |
|
375 |
backspace |
|
376 |
"return the backspace character" |
|
377 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
378 |
^ Character codePoint:8 |
699 | 379 |
! |
380 |
||
381 |
bell |
|
382 |
"return the bell character" |
|
383 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
384 |
^ Character codePoint:7 |
699 | 385 |
! |
386 |
||
387 |
cr |
|
9153 | 388 |
"return the lineEnd character |
699 | 389 |
- actually (in unix) this is a newline character" |
390 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
391 |
^ Character codePoint:10 |
699 | 392 |
! |
393 |
||
9153 | 394 |
del |
699 | 395 |
"return the delete character" |
396 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
397 |
^ Character codePoint:16r7F |
699 | 398 |
! |
399 |
||
400 |
doubleQuote |
|
401 |
"return the double-quote character" |
|
402 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
403 |
^ Character codePoint:34 |
699 | 404 |
! |
405 |
||
406 |
esc |
|
407 |
"return the escape character" |
|
408 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
409 |
^ Character codePoint:27 |
699 | 410 |
! |
411 |
||
10428 | 412 |
etx |
413 |
"return the end-of-text character" |
|
414 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
415 |
^ Character codePoint:3 |
10428 | 416 |
! |
417 |
||
7688 | 418 |
euro |
7689 | 419 |
"The Euro currency sign (notice: not all fonts support it). |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
420 |
The Unicode encoding is U+20AC" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
421 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
422 |
^ Character codePoint:16r20AC |
7689 | 423 |
|
424 |
" |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
425 |
Transcript font:(Font family:'courier' size:12 encoding:'iso10646-1'). |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
426 |
Transcript showCR:Character euro |
7976 | 427 |
" |
428 |
" |
|
7689 | 429 |
0 to:255 do:[:i | |
14684 | 430 |
Transcript |
431 |
show:'| '; show:((i printStringRadix:16) leftPaddedTo:2); |
|
432 |
show:' | '; show:(i printStringPaddedTo:3); |
|
433 |
show:' | '; show:(Character value:i); |
|
434 |
cr. |
|
7689 | 435 |
] |
436 |
" |
|
7688 | 437 |
! |
438 |
||
699 | 439 |
excla |
440 |
"return the exclamation-mark character" |
|
441 |
^ $!! |
|
1 | 442 |
! |
443 |
||
699 | 444 |
ff |
445 |
"return the form-feed character" |
|
446 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
447 |
^ Character codePoint:12 |
699 | 448 |
! |
449 |
||
450 |
lf |
|
451 |
"return the newline/linefeed character" |
|
452 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
453 |
^ Character codePoint:10 |
699 | 454 |
! |
1 | 455 |
|
4340
523ef8410fad
added #linefeed - squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4337
diff
changeset
|
456 |
linefeed |
523ef8410fad
added #linefeed - squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4337
diff
changeset
|
457 |
"squeak compatibility: return the newline/linefeed character" |
523ef8410fad
added #linefeed - squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4337
diff
changeset
|
458 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
459 |
^ Character codePoint:10 |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
460 |
! |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
461 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
462 |
maxImmediateCodePoint |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
463 |
"return the maximum codePoint until which the characters are shared" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
464 |
%{ /* NOCONTEXT */ |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
465 |
RETURN(__mkSmallInteger(MAX_IMMEDIATE_CHARACTER)); |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
466 |
%}. |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
467 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
468 |
" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
469 |
self maxImmediateCodePoint |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
470 |
" |
4340
523ef8410fad
added #linefeed - squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4337
diff
changeset
|
471 |
! |
523ef8410fad
added #linefeed - squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4337
diff
changeset
|
472 |
|
9153 | 473 |
maxValue |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
474 |
"return the maximum codePoint a character may have" |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
475 |
|
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
476 |
^ 16r3FFFFFFF |
699 | 477 |
! |
478 |
||
479 |
newPage |
|
480 |
"return the form-feed character" |
|
481 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
482 |
^ Character codePoint:12 |
699 | 483 |
! |
484 |
||
485 |
nl |
|
486 |
"return the newline character" |
|
68 | 487 |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
488 |
^ Character codePoint:10 |
699 | 489 |
! |
490 |
||
6324 | 491 |
null |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
492 |
^ Character codePoint:0 |
6324 | 493 |
! |
494 |
||
699 | 495 |
quote |
496 |
"return the single-quote character" |
|
497 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
498 |
^ Character codePoint:39 |
699 | 499 |
! |
500 |
||
9153 | 501 |
return |
699 | 502 |
"return the return character. |
503 |
In ST/X, this is different from cr - for Unix reasons." |
|
504 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
505 |
^ Character codePoint:13 |
699 | 506 |
! |
507 |
||
508 |
space |
|
509 |
"return the blank character" |
|
510 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
511 |
^ Character codePoint:32 |
699 | 512 |
! |
513 |
||
514 |
tab |
|
515 |
"return the tabulator character" |
|
516 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
517 |
^ Character codePoint:9 |
1 | 518 |
! ! |
519 |
||
2124 | 520 |
!Character class methodsFor:'primitive input'! |
1 | 521 |
|
522 |
fromUser |
|
357 | 523 |
"return a character from the keyboard (C's standard input stream) |
1 | 524 |
- this should only be used for emergency evaluators and the like." |
525 |
||
526 |
%{ /* NOCONTEXT */ |
|
527 |
int c; |
|
528 |
||
529 |
c = getchar(); |
|
530 |
if (c < 0) { |
|
9153 | 531 |
RETURN (nil); |
1 | 532 |
} |
1133 | 533 |
RETURN ( __MKCHARACTER(c & 0xFF) ); |
5433 | 534 |
%}. |
535 |
^ Stdin next |
|
1 | 536 |
! ! |
537 |
||
2124 | 538 |
!Character class methodsFor:'queries'! |
3 | 539 |
|
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
540 |
allCharacters |
17249 | 541 |
"added for squeak compatibility: return a collection of all singleton chars. |
542 |
Notice, for memory efficiency reasons, only some of the low-codepoint characters |
|
543 |
are actually kept as singletons. less frequently used character instances are created on the fly, |
|
544 |
as wide string elements are accessed (and hopefully garbage collected sooner or later)" |
|
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
545 |
|
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
546 |
^ CharacterTable |
9153 | 547 |
|
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
548 |
" |
9153 | 549 |
Character allCharacters |
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
550 |
" |
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
551 |
! |
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
552 |
|
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
553 |
hasSharedInstances |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
554 |
"return true if this class has shared instances, that is, instances |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
555 |
with the same value are identical. |
9148 | 556 |
Although not always shared (TwoByte CodePoint-Characters), these should be treated |
557 |
so, to be independent of the number of the underlying implementation" |
|
2672
dc3662188b2c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2561
diff
changeset
|
558 |
|
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
559 |
^ true |
2672
dc3662188b2c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2561
diff
changeset
|
560 |
! |
dc3662188b2c
added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2561
diff
changeset
|
561 |
|
3 | 562 |
isBuiltInClass |
1271 | 563 |
"return true if this class is known by the run-time-system. |
564 |
Here, true is returned for myself, false for subclasses." |
|
3 | 565 |
|
566 |
^ self == Character |
|
1271 | 567 |
|
568 |
"Modified: 23.4.1996 / 15:56:39 / cg" |
|
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
569 |
! |
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
570 |
|
8206 | 571 |
isLegalUnicodeCodePoint:anInteger |
572 |
"answer true, if anInteger is a valid unicode code point" |
|
573 |
||
9153 | 574 |
"Range 16rD800 - 16rDFFF is reserved for the |
8207
12131fc77a99
#isLegalUnicodeCodePoint: - Fix comment
Stefan Vogel <sv@exept.de>
parents:
8206
diff
changeset
|
575 |
lower and upper substitution page for UCS-16" |
8206 | 576 |
(anInteger >= 16rD800) ifTrue:[ |
9153 | 577 |
(anInteger <= 16rDFFF) ifTrue:[ |
578 |
^ false. |
|
579 |
]. |
|
580 |
(anInteger == 16rFFFE) ifTrue:[ |
|
581 |
^ false. |
|
582 |
]. |
|
583 |
(anInteger == 16rFFFF) ifTrue:[ |
|
584 |
^ false. |
|
585 |
]. |
|
8206 | 586 |
]. |
587 |
^ true |
|
588 |
! |
|
589 |
||
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
590 |
separators |
17249 | 591 |
"return a collection of separator chars. |
592 |
Added for squeak compatibility" |
|
593 |
||
594 |
Separators isNil ifTrue:[ |
|
18215 | 595 |
Separators := Array |
596 |
with:Character space |
|
597 |
with:Character return |
|
598 |
"/ with:Character cr |
|
599 |
with:Character tab |
|
600 |
with:Character lf |
|
601 |
with:Character ff |
|
17249 | 602 |
]. |
603 |
^ Separators |
|
9153 | 604 |
|
4337
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
605 |
" |
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
606 |
Character separators |
07fad5b7af9b
added #allCharacters & #separators for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents:
4037
diff
changeset
|
607 |
" |
3 | 608 |
! ! |
609 |
||
7261 | 610 |
!Character methodsFor:'Compatibility-Dolphin'! |
6324 | 611 |
|
7351
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
612 |
isAlphaNumeric |
11956 | 613 |
"Compatibility method - do not use in new code. |
614 |
Return true, if I am a letter or a digit |
|
7351
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
615 |
Please use isLetterOrDigit for compatibility reasons (which is ANSI)." |
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
616 |
|
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
617 |
^ self isLetterOrDigit |
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
618 |
! |
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
619 |
|
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
620 |
isAlphabetic |
11956 | 621 |
"Compatibility method - do not use in new code. |
622 |
Return true, if I am a letter. |
|
7351
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
623 |
Please use isLetter for compatibility reasons (which is ANSI)." |
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
624 |
|
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
625 |
^ self isLetter |
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
626 |
! |
1f805a32d551
comments in isAlphaNumeric and isAlphabetic
Claus Gittinger <cg@exept.de>
parents:
7300
diff
changeset
|
627 |
|
6324 | 628 |
isControl |
11956 | 629 |
"Compatibility method - do not use in new code. |
630 |
Return true if I am a control character (i.e. ascii value < 32)" |
|
7353 | 631 |
|
632 |
^ self isControlCharacter |
|
6324 | 633 |
! |
634 |
||
635 |
isHexDigit |
|
7354 | 636 |
"return true if I am a valid hexadecimal digit" |
637 |
||
6324 | 638 |
^ '0123456789abcdefABCDEF' includes:self |
7354 | 639 |
|
640 |
" |
|
641 |
$a isHexDigit |
|
642 |
" |
|
6324 | 643 |
! |
644 |
||
645 |
isPunctuation |
|
11956 | 646 |
"Compatibility method - do not use in new code. |
647 |
The code below is not unicode aware" |
|
7897 | 648 |
|
6327 | 649 |
^ (asciivalue between:16r21 and:16r40) |
650 |
or:[ (asciivalue between:16r5B and:16r60) |
|
651 |
or:[ (asciivalue between:123 and:126) |
|
652 |
or:[ (asciivalue between:161 and:191) |
|
653 |
or:[ (asciivalue == 215 ) |
|
654 |
or:[ (asciivalue == 247 ) ]]]]] |
|
6324 | 655 |
! ! |
656 |
||
1 | 657 |
!Character methodsFor:'accessing'! |
658 |
||
8097 | 659 |
codePoint |
660 |
"return the codePoint of myself. |
|
9153 | 661 |
Traditionally, this was named 'asciiValue'; |
8097 | 662 |
however, characters are not limited to 8bit characters." |
663 |
||
664 |
^ asciivalue |
|
665 |
! |
|
666 |
||
1 | 667 |
instVarAt:index put:anObject |
54 | 668 |
"catch instvar access - asciivalue may not be changed" |
1 | 669 |
|
670 |
self error:'Characters may not be modified' |
|
671 |
! ! |
|
672 |
||
699 | 673 |
!Character methodsFor:'arithmetic'! |
1 | 674 |
|
675 |
+ aMagnitude |
|
9153 | 676 |
"Return the Character that is <aMagnitude> higher than the receiver. |
1 | 677 |
Wrap if the resulting value is not a legal Character value. (JS)" |
678 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
679 |
^ Character codePoint:((asciivalue + aMagnitude asInteger) \\ 16r3FFFFFFF) |
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
680 |
|
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
681 |
" |
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
682 |
$A + 5 |
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
683 |
" |
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
684 |
|
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
685 |
"Modified: 27.6.1996 / 12:34:51 / cg" |
1 | 686 |
! |
687 |
||
688 |
- aMagnitude |
|
9153 | 689 |
"Return the Character that is <aMagnitude> lower than the receiver. |
68 | 690 |
Wrap if the resulting value is not a legal Character value. (JS) |
9153 | 691 |
claus: |
692 |
modified to return the difference as integer, if the argument |
|
693 |
is another character. If the argument is a number, a character is |
|
694 |
returned." |
|
1 | 695 |
|
68 | 696 |
aMagnitude isCharacter ifTrue:[ |
9153 | 697 |
^ asciivalue - aMagnitude asInteger |
68 | 698 |
]. |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
699 |
^ Character codePoint:((asciivalue - aMagnitude asInteger) \\ 16r3FFFFFFF) |
68 | 700 |
|
701 |
" |
|
9153 | 702 |
$z - $a |
68 | 703 |
$d - 3 |
704 |
" |
|
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
705 |
|
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
706 |
"Modified: 27.6.1996 / 12:35:34 / cg" |
1 | 707 |
! |
708 |
||
709 |
// aMagnitude |
|
9153 | 710 |
"Return the Character who's value is the receiver divided by <aMagnitude>. |
1 | 711 |
Wrap if the resulting value is not a legal Character value. (JS)" |
712 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
713 |
^ Character codePoint:(asciivalue // aMagnitude asInteger \\ 16r3FFFFFFF) |
1 | 714 |
! |
715 |
||
716 |
\\ aMagnitude |
|
9153 | 717 |
"Return the Character who's value is the receiver modulo <aMagnitude>. |
1 | 718 |
Wrap if the resulting value is not a legal Character value. (JS)" |
719 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
720 |
^ Character codePoint:(asciivalue \\ aMagnitude asInteger \\ 16r3FFFFFFF) |
1 | 721 |
! ! |
722 |
||
699 | 723 |
|
724 |
!Character methodsFor:'comparing'! |
|
725 |
||
8143 | 726 |
< aMagnitude |
7799 | 727 |
"return true, if the arguments asciiValue is greater than the receiver's" |
699 | 728 |
|
8143 | 729 |
^ (asciivalue < aMagnitude asInteger) |
699 | 730 |
! |
731 |
||
8143 | 732 |
<= aMagnitude |
7799 | 733 |
"return true, if the arguments asciiValue is greater or equal to the receiver's" |
699 | 734 |
|
8143 | 735 |
^ (asciivalue <= aMagnitude asInteger) |
699 | 736 |
! |
737 |
||
738 |
= aCharacter |
|
739 |
"return true, if the argument, aCharacter is the same character |
|
8143 | 740 |
Redefined to take care of character sizes > 8bit." |
699 | 741 |
|
742 |
self == aCharacter ifTrue:[^ true]. |
|
743 |
aCharacter isCharacter ifFalse:[^ false]. |
|
8143 | 744 |
^ asciivalue = aCharacter codePoint |
745 |
||
746 |
" |
|
18215 | 747 |
$A = (Character value:65) |
748 |
$A = (Character codePoint:65) |
|
749 |
$A = ($B-1) |
|
750 |
$A = 65 |
|
8143 | 751 |
" |
699 | 752 |
! |
753 |
||
8143 | 754 |
> aMagnitude |
7799 | 755 |
"return true, if the arguments asciiValue is less than the receiver's" |
699 | 756 |
|
8143 | 757 |
^ (asciivalue > aMagnitude asInteger) |
699 | 758 |
! |
759 |
||
8143 | 760 |
>= aMagnitude |
7799 | 761 |
"return true, if the arguments asciiValue is less or equal to the receiver's" |
699 | 762 |
|
8143 | 763 |
^ (asciivalue >= aMagnitude asInteger) |
699 | 764 |
! |
765 |
||
5540 | 766 |
hash |
767 |
"return an integer useful for hashing" |
|
768 |
||
769 |
^ asciivalue |
|
770 |
! |
|
771 |
||
699 | 772 |
identityHash |
773 |
"return an integer useful for hashing on identity" |
|
774 |
||
9153 | 775 |
%{ |
8100 | 776 |
INT __codePoint; |
777 |
||
778 |
__codePoint = __smallIntegerVal(__INST(asciivalue)); |
|
779 |
||
780 |
if (__codePoint <= MAX_IMMEDIATE_CHARACTER) { |
|
9153 | 781 |
RETURN ( __mkSmallInteger(__codePoint + 4096) ); |
8100 | 782 |
} |
783 |
%}. |
|
784 |
||
699 | 785 |
^ super identityHash |
8100 | 786 |
|
787 |
" |
|
788 |
$a identityHash. |
|
789 |
(Character value:1234) identityHash |
|
790 |
" |
|
699 | 791 |
! |
792 |
||
793 |
sameAs:aCharacter |
|
794 |
"return true, if the argument, aCharacter is the same character, |
|
795 |
ignoring case differences." |
|
796 |
||
797 |
self == aCharacter ifTrue:[^ true]. |
|
798 |
^ self asLowercase = aCharacter asLowercase |
|
14663 | 799 |
|
800 |
" |
|
801 |
(Character value:345) sameAs:(Character value:345) |
|
802 |
" |
|
699 | 803 |
! |
804 |
||
805 |
~= aCharacter |
|
806 |
"return true, if the argument, aCharacter is not the same character |
|
8143 | 807 |
Redefined to take care of character sizes > 8bit." |
699 | 808 |
|
809 |
self == aCharacter ifTrue:[^ false]. |
|
810 |
aCharacter isCharacter ifFalse:[^ true]. |
|
8097 | 811 |
^ (asciivalue ~~ aCharacter codePoint) |
699 | 812 |
! ! |
813 |
||
814 |
!Character methodsFor:'converting'! |
|
815 |
||
816 |
asCharacter |
|
817 |
"usually sent to integers, but redefined here to allow integers |
|
818 |
and characters to be used commonly without a need for a test." |
|
819 |
||
820 |
^ self |
|
821 |
||
822 |
" |
|
9153 | 823 |
32 asCharacter |
699 | 824 |
" |
825 |
! |
|
826 |
||
827 |
asInteger |
|
8143 | 828 |
"the same as #codePoint. |
829 |
Use #asInteger, if you need protocol compatibility with Numbers etc.. |
|
830 |
Use #codePoint in any other case for better stc optimization" |
|
699 | 831 |
|
832 |
^ asciivalue |
|
833 |
! |
|
834 |
||
835 |
asLowercase |
|
8010 | 836 |
"return a character with same letter as the receiver, but in lowercase. |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
837 |
Returns the receiver if it is already lowercase or if there is no lowercase equivalent. |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
838 |
CAVEAT: |
9153 | 839 |
for now, this method is only correct for unicode characters up to u+1d6ff (Unicode3.1). |
840 |
(which is more than mozilla does, btw. ;-)" |
|
7989
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
841 |
|
8010 | 842 |
%{ |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
843 |
#ifdef __SCHTEAM__ |
18215 | 844 |
{ |
845 |
char ch = self.charValue("[asLowercase]"); |
|
846 |
||
847 |
ch = java.lang.Character.toLowerCase(ch); |
|
848 |
return context._RETURN(STCharacter._new(ch)); |
|
849 |
} |
|
850 |
/* NOTREACHED */ |
|
851 |
#else |
|
14684 | 852 |
static int __mapping[] = { |
9153 | 853 |
/* From To Every Diff */ |
8010 | 854 |
0x0041, ((0x19 << 8) | 0x01), 0x0020 , |
855 |
0x00c0, ((0x16 << 8) | 0x01), 0x0020 , |
|
856 |
0x00d8, ((0x06 << 8) | 0x01), 0x0020 , |
|
857 |
0x0100, ((0x2e << 8) | 0x02), 0x0001 , |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
858 |
0x0130, ((0x00 << 8) | 0x00), -199 , |
8010 | 859 |
0x0132, ((0x04 << 8) | 0x02), 0x0001 , |
860 |
0x0139, ((0x0e << 8) | 0x02), 0x0001 , |
|
861 |
0x014a, ((0x2c << 8) | 0x02), 0x0001 , |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
862 |
0x0178, ((0x00 << 8) | 0x00), -121 , |
8010 | 863 |
0x0179, ((0x04 << 8) | 0x02), 0x0001 , |
864 |
0x0181, ((0x00 << 8) | 0x00), 0x00d2 , |
|
865 |
0x0182, ((0x02 << 8) | 0x02), 0x0001 , |
|
866 |
0x0186, ((0x00 << 8) | 0x00), 0x00ce , |
|
867 |
0x0187, ((0x00 << 8) | 0x00), 0x0001 , |
|
868 |
0x0189, ((0x01 << 8) | 0x01), 0x00cd , |
|
869 |
0x018b, ((0x00 << 8) | 0x00), 0x0001 , |
|
870 |
0x018e, ((0x00 << 8) | 0x00), 0x004f , |
|
871 |
0x018f, ((0x00 << 8) | 0x00), 0x00ca , |
|
872 |
0x0190, ((0x00 << 8) | 0x00), 0x00cb , |
|
873 |
0x0191, ((0x00 << 8) | 0x00), 0x0001 , |
|
874 |
0x0193, ((0x00 << 8) | 0x00), 0x00cd , |
|
875 |
0x0194, ((0x00 << 8) | 0x00), 0x00cf , |
|
876 |
0x0196, ((0x00 << 8) | 0x00), 0x00d3 , |
|
877 |
0x0197, ((0x00 << 8) | 0x00), 0x00d1 , |
|
878 |
0x0198, ((0x00 << 8) | 0x00), 0x0001 , |
|
879 |
0x019c, ((0x00 << 8) | 0x00), 0x00d3 , |
|
880 |
0x019d, ((0x00 << 8) | 0x00), 0x00d5 , |
|
881 |
0x019f, ((0x00 << 8) | 0x00), 0x00d6 , |
|
882 |
0x01a0, ((0x04 << 8) | 0x02), 0x0001 , |
|
883 |
0x01a6, ((0x00 << 8) | 0x00), 0x00da , |
|
884 |
0x01a7, ((0x00 << 8) | 0x00), 0x0001 , |
|
885 |
0x01a9, ((0x00 << 8) | 0x00), 0x00da , |
|
886 |
0x01ac, ((0x00 << 8) | 0x00), 0x0001 , |
|
887 |
0x01ae, ((0x00 << 8) | 0x00), 0x00da , |
|
888 |
0x01af, ((0x00 << 8) | 0x00), 0x0001 , |
|
889 |
0x01b1, ((0x01 << 8) | 0x01), 0x00d9 , |
|
890 |
0x01b3, ((0x02 << 8) | 0x02), 0x0001 , |
|
891 |
0x01b7, ((0x00 << 8) | 0x00), 0x00db , |
|
892 |
0x01b8, ((0x04 << 8) | 0x04), 0x0001 , |
|
893 |
0x01c4, ((0x00 << 8) | 0x00), 0x0002 , |
|
894 |
0x01c5, ((0x00 << 8) | 0x00), 0x0001 , |
|
895 |
0x01c7, ((0x00 << 8) | 0x00), 0x0002 , |
|
896 |
0x01c8, ((0x00 << 8) | 0x00), 0x0001 , |
|
897 |
0x01ca, ((0x00 << 8) | 0x00), 0x0002 , |
|
898 |
0x01cb, ((0x10 << 8) | 0x02), 0x0001 , |
|
899 |
0x01de, ((0x10 << 8) | 0x02), 0x0001 , |
|
900 |
0x01f1, ((0x00 << 8) | 0x00), 0x0002 , |
|
901 |
0x01f2, ((0x02 << 8) | 0x02), 0x0001 , |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
902 |
0x01f6, ((0x00 << 8) | 0x00), -97 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
903 |
0x01f7, ((0x00 << 8) | 0x00), -56 , |
8010 | 904 |
0x01f8, ((0x26 << 8) | 0x02), 0x0001 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
905 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
906 |
0x0220, ((0x00 << 8) | 0x00), -130 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
907 |
#endif |
8010 | 908 |
0x0222, ((0x10 << 8) | 0x02), 0x0001 , |
909 |
0x0386, ((0x00 << 8) | 0x00), 0x0026 , |
|
910 |
0x0388, ((0x02 << 8) | 0x01), 0x0025 , |
|
911 |
0x038c, ((0x00 << 8) | 0x00), 0x0040 , |
|
912 |
0x038e, ((0x01 << 8) | 0x01), 0x003f , |
|
913 |
0x0391, ((0x10 << 8) | 0x01), 0x0020 , |
|
914 |
0x03a3, ((0x08 << 8) | 0x01), 0x0020 , |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
915 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
916 |
0x03d8, ((0x00 << 8) | 0x00), 1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
917 |
#endif |
8010 | 918 |
0x03da, ((0x14 << 8) | 0x02), 0x0001 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
919 |
0x03f4, ((0x00 << 8) | 0x00), -60 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
920 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
921 |
0x03f7, ((0x03 << 8) | 0x03), 1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
922 |
0x03f9, ((0x00 << 8) | 0x00), -7 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
923 |
#endif |
8010 | 924 |
0x0400, ((0x0f << 8) | 0x01), 0x0050 , |
925 |
0x0410, ((0x1f << 8) | 0x01), 0x0020 , |
|
926 |
0x0460, ((0x20 << 8) | 0x02), 0x0001 , |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
927 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
928 |
0x048a, ((0x00 << 8) | 0x00), 1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
929 |
#endif |
8010 | 930 |
0x048c, ((0x32 << 8) | 0x02), 0x0001 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
931 |
#ifdef UNICODE_3_2 |
8010 | 932 |
0x04c1, ((0x02 << 8) | 0x02), 0x0001 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
933 |
#else |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
934 |
0x04c1, ((0x04 << 8) | 0x02), 0x0001 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
935 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
936 |
#ifdef UNICODE_3_2 |
8010 | 937 |
0x04c7, ((0x04 << 8) | 0x04), 0x0001 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
938 |
#else |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
939 |
0x04c7, ((0x04 << 8) | 0x02), 0x0001 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
940 |
0x04cd, ((0x00 << 8) | 0x00), 0x0001 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
941 |
#endif |
8010 | 942 |
0x04d0, ((0x24 << 8) | 0x02), 0x0001 , |
943 |
0x04f8, ((0x00 << 8) | 0x00), 0x0001 , |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
944 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
945 |
0x0500, ((0x0E << 8) | 0x02), 1 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
946 |
#endif |
8010 | 947 |
0x0531, ((0x25 << 8) | 0x01), 0x0030 , |
948 |
0x1e00, ((0x94 << 8) | 0x02), 0x0001 , |
|
949 |
0x1ea0, ((0x58 << 8) | 0x02), 0x0001 , |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
950 |
0x1f08, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
951 |
0x1f18, ((0x05 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
952 |
0x1f28, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
953 |
0x1f38, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
954 |
0x1f48, ((0x05 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
955 |
0x1f59, ((0x06 << 8) | 0x02), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
956 |
0x1f68, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
957 |
0x1f88, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
958 |
0x1f98, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
959 |
0x1fa8, ((0x07 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
960 |
0x1fb8, ((0x01 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
961 |
0x1fba, ((0x01 << 8) | 0x01), -74 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
962 |
0x1fbc, ((0x00 << 8) | 0x00), -9 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
963 |
0x1fc8, ((0x03 << 8) | 0x01), -86 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
964 |
0x1fcc, ((0x00 << 8) | 0x00), -9 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
965 |
0x1fd8, ((0x01 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
966 |
0x1fda, ((0x01 << 8) | 0x01), -100 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
967 |
0x1fe8, ((0x01 << 8) | 0x01), -8 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
968 |
0x1fea, ((0x01 << 8) | 0x01), -112 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
969 |
0x1fec, ((0x00 << 8) | 0x00), -7 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
970 |
0x1ff8, ((0x01 << 8) | 0x01), -128 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
971 |
0x1ffa, ((0x01 << 8) | 0x01), -126 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
972 |
0x1ffc, ((0x00 << 8) | 0x00), -9 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
973 |
0x2126, ((0x00 << 8) | 0x00), -7517 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
974 |
0x212a, ((0x00 << 8) | 0x00), -8383 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
975 |
0x212b, ((0x00 << 8) | 0x00), -8262 , |
8010 | 976 |
0x2160, ((0x0f << 8) | 0x01), 0x0010 , |
977 |
0x24b6, ((0x19 << 8) | 0x01), 0x001a , |
|
9153 | 978 |
0xff21, ((0x19 << 8) | 0x01), 0x0020 , |
979 |
0x10400, ((0x27 << 8) | 0x01), 0x0028 |
|
8010 | 980 |
}; |
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
981 |
|
14684 | 982 |
REGISTER unsigned INT __codePoint; |
8308 | 983 |
REGISTER int * __p; |
8010 | 984 |
|
985 |
__codePoint = __intVal(__INST(asciivalue)); |
|
8106
ee222c1314e6
cannot make pointer arith with a void *
Claus Gittinger <cg@exept.de>
parents:
8100
diff
changeset
|
986 |
for (__p = __mapping; (char *)__p < ((char *)__mapping) + sizeof(__mapping); __p += 3) { |
9153 | 987 |
unsigned rangeStart, rangeSize, rangeEnd, mod; |
988 |
||
989 |
rangeStart = (unsigned)__p[0]; |
|
990 |
if (__codePoint < rangeStart) break; |
|
991 |
||
992 |
rangeSize = ((unsigned)__p[1]) >> 8; |
|
993 |
rangeEnd = rangeStart + rangeSize; |
|
994 |
if (__codePoint <= rangeEnd) { |
|
995 |
mod = __p[1] & 0xFF; |
|
996 |
if ((mod == 0) || (((__codePoint - rangeStart) % mod) == 0)) { |
|
997 |
OBJ newChar; |
|
998 |
unsigned newCodePoint; |
|
999 |
||
1000 |
newCodePoint = __codePoint + __p[2]; |
|
1001 |
if (newCodePoint <= MAX_IMMEDIATE_CHARACTER) { |
|
1002 |
RETURN (__MKCHARACTER(newCodePoint)) ; |
|
1003 |
} |
|
1004 |
newChar = __MKUCHARACTER(newCodePoint) ; |
|
1005 |
if (newChar == nil) goto allocationError; |
|
1006 |
RETURN (newChar) ; |
|
1007 |
} |
|
1008 |
} |
|
8010 | 1009 |
} |
1010 |
RETURN (self); |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1011 |
allocationError: ; |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
1012 |
#endif /* ! __SCHTEAM__ */ |
8010 | 1013 |
%}. |
1014 |
^ ObjectMemory allocationFailureSignal raise. |
|
1491
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1015 |
|
a42ae3fbb756
fixed asLowercase / asUppercase for national characters
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1016 |
" |
9153 | 1017 |
$A asLowercase |
1018 |
$a asLowercase |
|
1019 |
(Character value:16r01F5) asUppercase asLowercase |
|
1020 |
(Character value:16r0205) asUppercase asLowercase |
|
1021 |
(Character value:16r03B1) asUppercase asLowercase |
|
1022 |
(Character value:16r1E00) asLowercase |
|
1023 |
" |
|
699 | 1024 |
! |
1025 |
||
1026 |
asString |
|
1027 |
"return a string of len 1 with myself as contents" |
|
1028 |
||
1029 |
%{ /* NOCONTEXT */ |
|
1030 |
char buffer[2]; |
|
1031 |
OBJ s; |
|
14684 | 1032 |
unsigned INT val; |
699 | 1033 |
|
15262
5047292c9107
all stx macros begin with double underline (eg. __qClass instead of _qClass)
Claus Gittinger <cg@exept.de>
parents:
14684
diff
changeset
|
1034 |
val = __intVal(__characterVal(self)); |
995
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
1035 |
if (val <= 0xFF) { |
9153 | 1036 |
buffer[0] = (char) val; |
1037 |
buffer[1] = '\0'; |
|
1038 |
s = __MKSTRING_L(buffer, 1); |
|
1039 |
if (s != nil) { |
|
1040 |
RETURN (s); |
|
1041 |
} |
|
699 | 1042 |
} |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1043 |
if (val <= 0xFFFF) { |
9153 | 1044 |
s = __MKEMPTYU16STRING(1); |
1045 |
if (s != nil) { |
|
1046 |
__Unicode16StringInstPtr(s)->s_element[0] = val; |
|
1047 |
RETURN (s); |
|
1048 |
} |
|
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1049 |
} |
699 | 1050 |
%}. |
7951 | 1051 |
asciivalue > 16rFF ifTrue:[ |
9153 | 1052 |
asciivalue > 16rFFFF ifTrue:[ |
1053 |
^ (Unicode32String new:1) at:1 put:self; yourself |
|
1054 |
]. |
|
1055 |
^ (Unicode16String new:1) at:1 put:self; yourself |
|
995
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
1056 |
]. |
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
1057 |
|
5407 | 1058 |
^ (String new:1) at:1 put:self; yourself. |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1059 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1060 |
" |
9153 | 1061 |
(Character value:16rB5) asString |
1062 |
(Character value:16r1B5) asString |
|
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1063 |
" |
699 | 1064 |
! |
1065 |
||
1066 |
asSymbol |
|
17184 | 1067 |
"Return a unique symbol with the name taken from the receiver's characters. |
9229 | 1068 |
Here, a single character symbol is returned." |
699 | 1069 |
|
1070 |
^ Symbol internCharacter:self |
|
1071 |
! |
|
1072 |
||
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1073 |
asTitlecase |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1074 |
"return a character with same letter as the receiver, but in titlecase. |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1075 |
Returns the receiver if it is already titlecase or if there is no titlecase equivalent." |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1076 |
|
8026 | 1077 |
" |
9153 | 1078 |
For example, in Unicode, character U+01F3 is LATIN SMALL LETTER DZ. |
1079 |
(Let us write this compound character using ASCII as 'dz'.) |
|
1080 |
This character uppercases to character U+01F1, LATIN CAPITAL LETTER DZ. |
|
1081 |
(Which is basically 'DZ'.) |
|
1082 |
But it titlecases to to character U+01F2, LATIN CAPITAL LETTER D WITH SMALL LETTER Z. |
|
8026 | 1083 |
(Which we can write 'Dz'.) |
1084 |
||
1085 |
character uppercase titlecase |
|
1086 |
--------- --------- --------- |
|
1087 |
dz DZ Dz |
|
1088 |
" |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1089 |
|ch| |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1090 |
|
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1091 |
%{ |
14684 | 1092 |
static unsigned short __mapping[] = { |
9153 | 1093 |
0x01C4, 0x01C5, |
1094 |
0x01C6, 0x01C5, |
|
1095 |
0x01C7, 0x01C8, |
|
1096 |
0x01C9, 0x01C8, |
|
1097 |
0x01CA, 0x01CB, |
|
1098 |
0x01CC, 0x01CB, |
|
14684 | 1099 |
0x01F1, 0x01F2, |
1100 |
0x01F3, 0x01F2, |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1101 |
}; |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1102 |
|
14684 | 1103 |
REGISTER unsigned INT __codePoint; |
8885 | 1104 |
REGISTER unsigned short *__p; |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1105 |
|
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1106 |
__codePoint = __intVal(__INST(asciivalue)); |
8106
ee222c1314e6
cannot make pointer arith with a void *
Claus Gittinger <cg@exept.de>
parents:
8100
diff
changeset
|
1107 |
for (__p = __mapping; (char *)__p < ((char *)__mapping) + sizeof(__mapping); __p += 2) { |
9153 | 1108 |
if ((__codePoint == __p[0]) || (__codePoint == __p[1])) { |
1109 |
short newCodePoint; |
|
1110 |
OBJ newChar; |
|
1111 |
||
1112 |
newCodePoint = __p[1]; |
|
1113 |
if (newCodePoint == __codePoint) { |
|
1114 |
RETURN (self); |
|
1115 |
} |
|
1116 |
if (newCodePoint <= MAX_IMMEDIATE_CHARACTER) { |
|
1117 |
RETURN (__MKCHARACTER(newCodePoint)) ; |
|
1118 |
} |
|
1119 |
newChar = __MKUCHARACTER(newCodePoint) ; |
|
1120 |
if (newChar == nil) goto getOutOfHere; |
|
1121 |
RETURN (newChar) ; |
|
1122 |
} |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1123 |
} |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1124 |
ch = self; |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1125 |
getOutOfHere: ; |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1126 |
%}. |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1127 |
ch notNil ifTrue:[ |
9153 | 1128 |
^ ch asUppercase. |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1129 |
]. |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1130 |
|
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1131 |
^ ObjectMemory allocationFailureSignal raise. |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1132 |
|
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1133 |
" |
9153 | 1134 |
$A asTitlecase |
1135 |
$a asTitlecase |
|
1136 |
(Character value:16r01F1) asTitlecase |
|
1137 |
" |
|
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1138 |
! |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1139 |
|
6029 | 1140 |
asUnicodeString |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1141 |
"return a unicode string of len 1 with myself as contents. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1142 |
This will vanish, as we now (rel5.2.x) use Unicode as default." |
6029 | 1143 |
|
7951 | 1144 |
asciivalue > 16rFFFF ifTrue:[ |
9153 | 1145 |
^ (Unicode32String new:1) at:1 put:self; yourself. |
7951 | 1146 |
]. |
1147 |
^ (Unicode16String new:1) at:1 put:self; yourself. |
|
6029 | 1148 |
! |
1149 |
||
699 | 1150 |
asUppercase |
8010 | 1151 |
"return a character with same letter as the receiver, but in uppercase. |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1152 |
Returns the receiver if it is already uppercase or if there is no uppercase equivalent. |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1153 |
CAVEAT: |
9153 | 1154 |
for now, this method is only correct for unicode characters up to u+1d6ff (Unicode3.1). |
1155 |
(which is more than mozilla does, btw. ;-)" |
|
7990
2f78c1d609c7
asUppercase / asLowercase for UFF00..UFFFF
Claus Gittinger <cg@exept.de>
parents:
7989
diff
changeset
|
1156 |
|
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1157 |
%{ |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
1158 |
#ifdef __SCHTEAM__ |
18215 | 1159 |
{ |
1160 |
char ch = self.charValue("[asUppercase]"); |
|
1161 |
||
1162 |
ch = java.lang.Character.toUpperCase(ch); |
|
1163 |
return context._RETURN(STCharacter._new(ch)); |
|
1164 |
} |
|
1165 |
/* NOTREACHED */ |
|
1166 |
#else |
|
14684 | 1167 |
static int __mapping[] = { |
9153 | 1168 |
/* From To Every Diff */ |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1169 |
0x0061, ((0x19 << 8) | 0x01), -32 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1170 |
0x00b5, ((0x00 << 8) | 0x3b), 0x02e7 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1171 |
0x00e0, ((0x16 << 8) | 0x01), -32 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1172 |
0x00f8, ((0x06 << 8) | 0x01), -32 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1173 |
0x00ff, ((0x00 << 8) | 0x01), 0x0079 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1174 |
0x0101, ((0x2e << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1175 |
0x0131, ((0x00 << 8) | 0x02), -232 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1176 |
0x0133, ((0x04 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1177 |
0x013a, ((0x0e << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1178 |
0x014b, ((0x2c << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1179 |
0x017a, ((0x04 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1180 |
0x017f, ((0x00 << 8) | 0x01), -300 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1181 |
0x0183, ((0x02 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1182 |
0x0188, ((0x04 << 8) | 0x04), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1183 |
0x0192, ((0x00 << 8) | 0x06), -1 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1184 |
0x0195, ((0x00 << 8) | 0x03), 0x0061 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1185 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1186 |
0x0199, ((0x04 << 8) | 0x08), -1 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1187 |
0x019e, ((0x00 << 8) | 0x00), 130 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1188 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1189 |
0x0199, ((0x08 << 8) | 0x08), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1190 |
0x01a3, ((0x02 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1191 |
0x01a8, ((0x05 << 8) | 0x05), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1192 |
0x01b0, ((0x04 << 8) | 0x04), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1193 |
0x01b6, ((0x03 << 8) | 0x03), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1194 |
0x01bd, ((0x00 << 8) | 0x04), -1 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1195 |
0x01bf, ((0x00 << 8) | 0x02), 0x0038 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1196 |
0x01c5, ((0x00 << 8) | 0x06), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1197 |
0x01c6, ((0x00 << 8) | 0x01), -2 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1198 |
0x01c8, ((0x00 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1199 |
0x01c9, ((0x00 << 8) | 0x01), -2 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1200 |
0x01cb, ((0x00 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1201 |
0x01cc, ((0x00 << 8) | 0x01), -2 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1202 |
0x01ce, ((0x0e << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1203 |
0x01dd, ((0x00 << 8) | 0x01), -79 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1204 |
0x01df, ((0x10 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1205 |
0x01f2, ((0x00 << 8) | 0x03), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1206 |
0x01f3, ((0x00 << 8) | 0x01), -2 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1207 |
0x01f5, ((0x04 << 8) | 0x04), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1208 |
0x01fb, ((0x24 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1209 |
0x0223, ((0x10 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1210 |
0x0253, ((0x00 << 8) | 0x20), -210 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1211 |
0x0254, ((0x00 << 8) | 0x01), -206 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1212 |
0x0256, ((0x01 << 8) | 0x01), -205 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1213 |
0x0259, ((0x00 << 8) | 0x02), -202 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1214 |
0x025b, ((0x00 << 8) | 0x02), -203 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1215 |
0x0260, ((0x00 << 8) | 0x05), -205 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1216 |
0x0263, ((0x00 << 8) | 0x03), -207 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1217 |
0x0268, ((0x00 << 8) | 0x05), -209 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1218 |
0x0269, ((0x06 << 8) | 0x06), -211 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1219 |
0x0272, ((0x00 << 8) | 0x03), -213 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1220 |
0x0275, ((0x00 << 8) | 0x03), -214 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1221 |
0x0280, ((0x03 << 8) | 0x03), -218 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1222 |
0x0288, ((0x00 << 8) | 0x05), -218 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1223 |
0x028a, ((0x01 << 8) | 0x01), -217 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1224 |
0x0292, ((0x00 << 8) | 0x07), -219 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1225 |
0x0345, ((0x00 << 8) | 0xb3), 0x0054 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1226 |
0x03ac, ((0x00 << 8) | 0x67), -38 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1227 |
0x03ad, ((0x02 << 8) | 0x01), -37 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1228 |
0x03b1, ((0x10 << 8) | 0x01), -32 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1229 |
0x03c2, ((0x00 << 8) | 0x01), -31 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1230 |
0x03c3, ((0x08 << 8) | 0x01), -32 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1231 |
0x03cc, ((0x00 << 8) | 0x01), -64 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1232 |
0x03cd, ((0x01 << 8) | 0x01), -63 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1233 |
0x03d0, ((0x00 << 8) | 0x02), -62 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1234 |
0x03d1, ((0x00 << 8) | 0x01), -57 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1235 |
0x03d5, ((0x00 << 8) | 0x04), -47 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1236 |
0x03d6, ((0x00 << 8) | 0x01), -54 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1237 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1238 |
0x03d9, ((0x00 << 8) | 0x00), -1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1239 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1240 |
0x03db, ((0x14 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1241 |
0x03f0, ((0x00 << 8) | 0x01), -86 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1242 |
0x03f1, ((0x00 << 8) | 0x01), -80 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1243 |
#ifdef UNICODE_3_2 |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1244 |
0x03f2, ((0x00 << 8) | 0x01), -79 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1245 |
#else |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1246 |
0x03f2, ((0x00 << 8) | 0x00), 7 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1247 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1248 |
0x03f5, ((0x00 << 8) | 0x00), -96 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1249 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1250 |
0x03f8, ((0x03 << 8) | 0x03), -1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1251 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1252 |
0x0430, ((0x1f << 8) | 0x01), -32 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1253 |
0x0450, ((0x0f << 8) | 0x01), -80 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1254 |
0x0461, ((0x20 << 8) | 0x02), -1 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1255 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1256 |
0x048b, ((0x00 << 8) | 0x00), -1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1257 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1258 |
0x048d, ((0x32 << 8) | 0x02), -1 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1259 |
#ifdef UNICODE_3_2 |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1260 |
0x04c2, ((0x02 << 8) | 0x02), -1 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1261 |
#else |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1262 |
0x04c2, ((0x04 << 8) | 0x02), -1 , /* Unicode4.0 - not in X fonts - sigh */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1263 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1264 |
#ifdef UNICODE_3_2 |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1265 |
0x04c8, ((0x04 << 8) | 0x04), -1 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1266 |
#else |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1267 |
0x04c8, ((0x04 << 8) | 0x02), -1 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1268 |
0x04ce, ((0x00 << 8) | 0x00), -1 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1269 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1270 |
0x04d1, ((0x24 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1271 |
0x04f9, ((0x00 << 8) | 0x04), -1 , |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1272 |
#ifndef UNICODE_3_2 |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1273 |
0x0501, ((0x0E << 8) | 0x02), -1 , |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1274 |
#endif |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1275 |
0x0561, ((0x25 << 8) | 0x01), -48 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1276 |
0x1e01, ((0x94 << 8) | 0x02), -1 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1277 |
0x1e9b, ((0x00 << 8) | 0x06), -59 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1278 |
0x1ea1, ((0x58 << 8) | 0x02), -1 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1279 |
0x1f00, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1280 |
0x1f10, ((0x05 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1281 |
0x1f20, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1282 |
0x1f30, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1283 |
0x1f40, ((0x05 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1284 |
0x1f51, ((0x06 << 8) | 0x02), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1285 |
0x1f60, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1286 |
0x1f70, ((0x01 << 8) | 0x01), 0x004a , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1287 |
0x1f72, ((0x03 << 8) | 0x01), 0x0056 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1288 |
0x1f76, ((0x01 << 8) | 0x01), 0x0064 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1289 |
0x1f78, ((0x01 << 8) | 0x01), 0x0080 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1290 |
0x1f7a, ((0x01 << 8) | 0x01), 0x0070 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1291 |
0x1f7c, ((0x01 << 8) | 0x01), 0x007e , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1292 |
0x1f80, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1293 |
0x1f90, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1294 |
0x1fa0, ((0x07 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1295 |
0x1fb0, ((0x01 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1296 |
0x1fb3, ((0x00 << 8) | 0x02), 0x0009 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1297 |
0x1fbe, ((0x00 << 8) | 0x0b), -7205 , |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1298 |
0x1fc3, ((0x00 << 8) | 0x05), 0x0009 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1299 |
0x1fd0, ((0x01 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1300 |
0x1fe0, ((0x01 << 8) | 0x01), 0x0008 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1301 |
0x1fe5, ((0x00 << 8) | 0x04), 0x0007 , |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1302 |
0x1ff3, ((0x00 << 8) | 0x0e), 0x0009 , |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1303 |
0x2170, ((0x0f << 8) | 0x01), -16 , |
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1304 |
0x24d0, ((0x19 << 8) | 0x01), -26 , |
9153 | 1305 |
0xff41, ((0x19 << 8) | 0x01), -32 , |
1306 |
0x10428, ((0x27 << 8) | 0x01), -40 |
|
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1307 |
}; |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1308 |
|
14684 | 1309 |
REGISTER unsigned INT __codePoint; |
8308 | 1310 |
REGISTER int *__p; |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1311 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1312 |
__codePoint = __intVal(__INST(asciivalue)); |
8106
ee222c1314e6
cannot make pointer arith with a void *
Claus Gittinger <cg@exept.de>
parents:
8100
diff
changeset
|
1313 |
for (__p = __mapping; (char *)__p < ((char *)__mapping) + sizeof(__mapping); __p += 3) { |
9153 | 1314 |
unsigned rangeStart, rangeSize, rangeEnd, mod; |
1315 |
||
1316 |
rangeStart = (unsigned)__p[0]; |
|
14684 | 1317 |
if (rangeStart > __codePoint) break; |
9153 | 1318 |
|
1319 |
rangeSize = ((unsigned)__p[1]) >> 8; |
|
1320 |
rangeEnd = rangeStart + rangeSize; |
|
1321 |
if (__codePoint <= rangeEnd) { |
|
1322 |
mod = __p[1] & 0xFF; |
|
1323 |
if ((mod == 0) || (((__codePoint - rangeStart) % mod) == 0)) { |
|
1324 |
OBJ newChar; |
|
1325 |
unsigned newCodePoint; |
|
1326 |
||
1327 |
newCodePoint = __codePoint + __p[2]; |
|
1328 |
if (newCodePoint <= MAX_IMMEDIATE_CHARACTER) { |
|
1329 |
RETURN (__MKCHARACTER(newCodePoint)) ; |
|
1330 |
} |
|
1331 |
newChar = __MKUCHARACTER(newCodePoint) ; |
|
1332 |
if (newChar == nil) goto allocationError; |
|
1333 |
RETURN (newChar) ; |
|
1334 |
} |
|
1335 |
} |
|
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1336 |
} |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1337 |
RETURN (self); |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1338 |
allocationError: ; |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
1339 |
#endif /* ! __SCHTEAM__ */ |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1340 |
%}. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1341 |
^ ObjectMemory allocationFailureSignal raise. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1342 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1343 |
" |
9153 | 1344 |
$A asLowercase |
1345 |
$a asUppercase |
|
1346 |
(Character value:16r01F5) asUppercase |
|
1347 |
(Character value:16r0205) asUppercase |
|
1348 |
(Character value:16r03B1) asUppercase |
|
1349 |
" |
|
8010 | 1350 |
! |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1351 |
|
8010 | 1352 |
digitValue |
11653 | 1353 |
"return my digitValue for any base (up to 37)" |
8010 | 1354 |
|
8143 | 1355 |
|code "{ Class: SmallInteger }" | |
1356 |
||
1357 |
code := asciivalue. |
|
1358 |
(code between:($0 codePoint) and:($9 codePoint)) ifTrue:[ |
|
14684 | 1359 |
^ code - $0 codePoint |
8010 | 1360 |
]. |
8143 | 1361 |
(code between:($a codePoint) and:($z codePoint)) ifTrue:[ |
14684 | 1362 |
^ code + (10 - $a codePoint) |
9153 | 1363 |
]. |
8143 | 1364 |
(code between:($A codePoint) and:($Z codePoint)) ifTrue:[ |
14684 | 1365 |
^ code + (10 - $A codePoint) |
9153 | 1366 |
]. |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1367 |
|
8010 | 1368 |
"remove error below for X3J20 conformance ... " |
1369 |
self error:'bad character'. |
|
1370 |
" " |
|
1371 |
^ -1 |
|
1372 |
! |
|
1373 |
||
11653 | 1374 |
digitValueRadix:base |
1375 |
"return my digitValue for base. |
|
1376 |
Return nil, if it is not a valid character for that base" |
|
1377 |
||
1378 |
|code "{ Class: SmallInteger }" | |
|
1379 |
||
1380 |
code := asciivalue. |
|
1381 |
base < 10 ifTrue:[ |
|
14684 | 1382 |
(code between:($0 codePoint) and:($0 codePoint + base - 1)) ifTrue:[ |
1383 |
^ code - $0 codePoint |
|
1384 |
]. |
|
1385 |
^ nil. |
|
11653 | 1386 |
]. |
1387 |
(code between:($0 codePoint) and:($9 codePoint)) ifTrue:[ |
|
14684 | 1388 |
^ code - $0 codePoint |
11653 | 1389 |
]. |
1390 |
base <= 10 ifTrue:[ |
|
14684 | 1391 |
^ nil. |
11653 | 1392 |
]. |
1393 |
(code between:($a codePoint) and:($a codePoint + base - 1 - 10)) ifTrue:[ |
|
14684 | 1394 |
^ code + (10 - $a codePoint) |
11653 | 1395 |
]. |
1396 |
(code between:($A codePoint) and:($A codePoint + base - 1 - 10)) ifTrue:[ |
|
14684 | 1397 |
^ code + (10 - $A codePoint) |
11653 | 1398 |
]. |
1399 |
^ nil |
|
1400 |
||
1401 |
" |
|
14684 | 1402 |
self assert:($0 digitValueRadix:10) == 0. |
11653 | 1403 |
self assert:($9 digitValueRadix:10) == 9. |
1404 |
self assert:($a digitValueRadix:10) == nil. |
|
1405 |
self assert:($a digitValueRadix:11) == 10. |
|
1406 |
self assert:($A digitValueRadix:11) == 10. |
|
1407 |
self assert:($a digitValueRadix:16) == 10. |
|
1408 |
self assert:($A digitValueRadix:16) == 10. |
|
1409 |
self assert:($f digitValueRadix:16) == 15. |
|
1410 |
self assert:($F digitValueRadix:16) == 15. |
|
1411 |
self assert:($g digitValueRadix:16) == nil. |
|
1412 |
self assert:($G digitValueRadix:16) == nil. |
|
1413 |
self assert:($g digitValueRadix:17) == 16. |
|
1414 |
self assert:($G digitValueRadix:17) == 16. |
|
1415 |
" |
|
1416 |
! |
|
1417 |
||
8010 | 1418 |
literalArrayEncoding |
1419 |
"encode myself as an array literal, from which a copy of the receiver |
|
1420 |
can be reconstructed with #decodeAsLiteralArray." |
|
1421 |
||
1422 |
^ self |
|
1423 |
||
1424 |
"Created: / 27.10.1997 / 14:40:37 / cg" |
|
1425 |
! |
|
1426 |
||
1427 |
to:aMagnitude |
|
9153 | 1428 |
"Return an Interval over the characters from the receiver to <aMagnitude>. |
8010 | 1429 |
Wrap <aMagnitude> if it is not a legal Character value. (JS)" |
1430 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1431 |
^ Interval from:self to:(aMagnitude \\ 16r3FFFFFFF) |
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1432 |
! |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1433 |
|
13499 | 1434 |
to:aMagnitude by:inc |
1435 |
"Return an Interval over the characters from the receiver to <aMagnitude>. |
|
1436 |
Wrap <aMagnitude> if it is not a legal Character value. (JS)" |
|
1437 |
||
1438 |
^ Interval from:self to:(aMagnitude \\ 16r3FFFFFFF) by:inc |
|
1439 |
||
1440 |
"Created: / 04-07-2011 / 19:35:15 / cg" |
|
1441 |
! |
|
1442 |
||
5847 | 1443 |
utf8Encoded |
11321 | 1444 |
"convert a character to its UTF-8 encoding. |
5847 | 1445 |
this returns a String" |
1446 |
||
1447 |
|s| |
|
1448 |
||
7897 | 1449 |
asciivalue <= 16r7F ifTrue:[ |
14684 | 1450 |
^ self asString. |
7897 | 1451 |
]. |
1452 |
||
8222
f2c454a9a038
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
8207
diff
changeset
|
1453 |
s := WriteStream on:(String new:6). |
11321 | 1454 |
s nextPutUtf8:self. |
5847 | 1455 |
^ s contents |
9153 | 1456 |
|
5847 | 1457 |
" |
14684 | 1458 |
'ä' utf8Encoded |
5847 | 1459 |
" |
699 | 1460 |
! ! |
1461 |
||
1462 |
!Character methodsFor:'copying'! |
|
1463 |
||
15984 | 1464 |
, aStringOrCharacter |
1465 |
"return a string containing the concatenation of the receiver character |
|
1466 |
and the argument, a string or character. |
|
1467 |
Added for symetry, as we allow string,char also char,string should be allowed" |
|
1468 |
||
16074 | 1469 |
%{ |
1470 |
OBJ s; |
|
1471 |
unsigned INT val; |
|
1472 |
||
1473 |
// fast code for common cases |
|
1474 |
val = __intVal(__characterVal(self)); |
|
1475 |
if (val <= 0xFF) { |
|
18215 | 1476 |
if (__isCharacter(aStringOrCharacter)) { |
1477 |
unsigned INT val2 = __intVal(__characterVal(aStringOrCharacter)); |
|
1478 |
||
1479 |
if (val2 <= 0xFF) { |
|
1480 |
char buffer[2]; |
|
1481 |
||
1482 |
buffer[0] = val; |
|
1483 |
buffer[1] = val2; |
|
1484 |
s = __MKSTRING_L(buffer, 2); |
|
1485 |
if (s != nil) { |
|
1486 |
RETURN (s); |
|
1487 |
} |
|
1488 |
} |
|
1489 |
} else { |
|
1490 |
if (__isString(aStringOrCharacter)) { |
|
1491 |
int strSize = __stringSize(aStringOrCharacter); |
|
1492 |
||
1493 |
s = __MKEMPTYSTRING(strSize+1); |
|
1494 |
if (s != nil) { |
|
1495 |
__StringInstPtr(s)->s_element[0] = val; |
|
1496 |
memcpy(__StringInstPtr(s)->s_element+1, __stringVal(aStringOrCharacter), strSize+1); // copies 0-byte too |
|
1497 |
RETURN (s); |
|
1498 |
} |
|
1499 |
} |
|
1500 |
} |
|
16074 | 1501 |
} |
1502 |
%}. |
|
15984 | 1503 |
^ self asString , aStringOrCharacter |
1504 |
||
1505 |
" |
|
1506 |
$. , $: |
|
1507 |
$. , 'abc' , $. |
|
16074 | 1508 |
|
1509 |
Time millisecondsToRun:[ 10000000 timesRepeat:[ $a , $b ]] |
|
1510 |
Time millisecondsToRun:[ 10000000 timesRepeat:[ $a , 'b' ]] |
|
1511 |
Time millisecondsToRun:[ 10000000 timesRepeat:[ 'a' , 'b' ]] |
|
1512 |
Time millisecondsToRun:[ 10000000 timesRepeat:[ 'a' , $b ]] |
|
15984 | 1513 |
" |
1514 |
! |
|
1515 |
||
699 | 1516 |
copy |
1517 |
"return a copy of myself |
|
1518 |
reimplemented since characters are unique" |
|
1519 |
||
1520 |
^ self |
|
1521 |
! |
|
1522 |
||
10948 | 1523 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
699 | 1524 |
"return a deep copy of myself |
4728 | 1525 |
reimplemented since characters are immutable" |
699 | 1526 |
|
1527 |
^ self |
|
1528 |
! |
|
1529 |
||
1530 |
shallowCopy |
|
1531 |
"return a shallow copy of myself |
|
4728 | 1532 |
reimplemented since characters are immutable" |
699 | 1533 |
|
1534 |
^ self |
|
1535 |
! |
|
1536 |
||
1537 |
simpleDeepCopy |
|
1538 |
"return a deep copy of myself |
|
4728 | 1539 |
reimplemented since characters are immutable" |
699 | 1540 |
|
1541 |
^ self |
|
1542 |
! ! |
|
1543 |
||
5471
a57eeb01c5ab
General encoding method (#encodeOn:with:)
Stefan Vogel <sv@exept.de>
parents:
5452
diff
changeset
|
1544 |
!Character methodsFor:'encoding'! |
a57eeb01c5ab
General encoding method (#encodeOn:with:)
Stefan Vogel <sv@exept.de>
parents:
5452
diff
changeset
|
1545 |
|
6508 | 1546 |
rot13 |
9153 | 1547 |
"Usenet: from `rotate alphabet 13 places'] |
6508 | 1548 |
The simple Caesar-cypher encryption that replaces each English |
9153 | 1549 |
letter with the one 13 places forward or back along the alphabet, |
6508 | 1550 |
so that 'The butler did it!!' becomes 'Gur ohgyre qvq vg!!' |
9153 | 1551 |
Most Usenet news reading and posting programs include a rot13 feature. |
6508 | 1552 |
It is used to enclose the text in a sealed wrapper that the reader must choose |
9153 | 1553 |
to open -- e.g., for posting things that might offend some readers, or spoilers. |
6508 | 1554 |
A major advantage of rot13 over rot(N) for other N is that it |
1555 |
is self-inverse, so the same code can be used for encoding and decoding." |
|
1556 |
||
11864 | 1557 |
^ self rot:13 |
6508 | 1558 |
|
1559 |
" |
|
9153 | 1560 |
$h rot13 |
1561 |
$h rot13 rot13 |
|
7715
0e69a830f5d8
use #and: - not #& you lazy bone, you
Claus Gittinger <cg@exept.de>
parents:
7689
diff
changeset
|
1562 |
'The butler did it!!' rot13 -> 'Gur ohgyre qvq vg!!' |
0e69a830f5d8
use #and: - not #& you lazy bone, you
Claus Gittinger <cg@exept.de>
parents:
7689
diff
changeset
|
1563 |
'The butler did it!!' rot13 rot13 -> 'The butler did it!!' |
6508 | 1564 |
" |
11864 | 1565 |
! |
1566 |
||
1567 |
rot:n |
|
1568 |
"Usenet: from `rotate alphabet N places'] |
|
1569 |
The simple Caesar-cypher encryption that replaces each English |
|
1570 |
letter with the one N places forward or back along the alphabet, |
|
1571 |
so that 'The butler did it!!' becomes 'Gur ohgyre qvq vg!!' by rot:13 |
|
1572 |
Most Usenet news reading and posting programs include a rot13 feature. |
|
1573 |
It is used to enclose the text in a sealed wrapper that the reader must choose |
|
1574 |
to open -- e.g., for posting things that might offend some readers, or spoilers. |
|
1575 |
A major advantage of rot13 over rot(N) for other N is that it |
|
1576 |
is self-inverse, so the same code can be used for encoding and decoding." |
|
1577 |
||
1578 |
(self isLetter) ifTrue:[ |
|
14684 | 1579 |
self isLowercase ifTrue:[ |
1580 |
^ 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz' at:(self-$a+1+n) |
|
1581 |
]. |
|
1582 |
^ 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ' at:(self-$A+1+n) |
|
11864 | 1583 |
]. |
1584 |
^ self |
|
1585 |
||
1586 |
" |
|
1587 |
'The butler did it!!' rot:13 -> 'Gur ohgyre qvq vg!!' |
|
1588 |
('The butler did it!!' rot:13) rot:13 -> 'The butler did it!!' |
|
1589 |
" |
|
5471
a57eeb01c5ab
General encoding method (#encodeOn:with:)
Stefan Vogel <sv@exept.de>
parents:
5452
diff
changeset
|
1590 |
! ! |
a57eeb01c5ab
General encoding method (#encodeOn:with:)
Stefan Vogel <sv@exept.de>
parents:
5452
diff
changeset
|
1591 |
|
10428 | 1592 |
|
8143 | 1593 |
!Character methodsFor:'obsolete'! |
1594 |
||
1595 |
asciiValue |
|
1596 |
"return the asciivalue of myself. |
|
1597 |
The name 'asciiValue' is a historic leftover: |
|
9153 | 1598 |
characters are not limited to 8bit characters. |
8143 | 1599 |
So the actual value returned is a codePoint (i.e. full potential for 31bit encoding). |
1600 |
PP has removed this method with 4.1 and providing asInteger instead. |
|
1601 |
ANSI defines #codePoint, please use this method" |
|
1602 |
||
1603 |
<resource:#obsolete> |
|
1604 |
||
1605 |
^ asciivalue |
|
1606 |
||
1607 |
"Modified: 27.6.1996 / 12:34:34 / cg" |
|
1608 |
! ! |
|
1609 |
||
699 | 1610 |
!Character methodsFor:'printing & storing'! |
1611 |
||
14117 | 1612 |
displayOn:aGCOrStream |
14120
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
1613 |
"Compatibility |
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
1614 |
append a printed desription on some stream (Dolphin, Squeak) |
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
1615 |
OR: |
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
1616 |
display the receiver in a graphicsContext at 0@0 (ST80). |
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
1617 |
This method allows for any object to be displayed in some view |
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
1618 |
(although the fallBack is to display its printString ...)" |
699 | 1619 |
|
14117 | 1620 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
1621 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
|
16744 | 1622 |
(aGCOrStream isStream) ifFalse:[ |
18215 | 1623 |
^ super displayOn:aGCOrStream |
14117 | 1624 |
]. |
1625 |
||
1626 |
self storeOn:aGCOrStream. |
|
1627 |
aGCOrStream nextPutAll:' "16r'. |
|
1628 |
asciivalue printOn:aGCOrStream base:16. |
|
1629 |
aGCOrStream nextPut:$". |
|
699 | 1630 |
! |
1631 |
||
1632 |
isLiteral |
|
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1633 |
"return true, if the receiver can be used as a literal constant in ST syntax |
699 | 1634 |
(i.e. can be used in constant arrays)" |
1635 |
||
1636 |
^ true |
|
1637 |
! |
|
1638 |
||
1639 |
||
5746
cf5e42cb72ef
do not overwrite the standard printing conventions
Claus Gittinger <cg@exept.de>
parents:
5566
diff
changeset
|
1640 |
"print myself on stdout. |
9153 | 1641 |
This method does NOT (by purpose) use the stream classes and |
5746
cf5e42cb72ef
do not overwrite the standard printing conventions
Claus Gittinger <cg@exept.de>
parents:
5566
diff
changeset
|
1642 |
will therefore work even in case of emergency (but only, if Stdout is nil)." |
699 | 1643 |
|
1644 |
%{ /* NOCONTEXT */ |
|
1645 |
||
5746
cf5e42cb72ef
do not overwrite the standard printing conventions
Claus Gittinger <cg@exept.de>
parents:
5566
diff
changeset
|
1646 |
if (@global(Stdout) == nil) { |
9153 | 1647 |
putchar(__intVal(__INST(asciivalue))); |
1648 |
RETURN(self); |
|
5746
cf5e42cb72ef
do not overwrite the standard printing conventions
Claus Gittinger <cg@exept.de>
parents:
5566
diff
changeset
|
1649 |
} |
5452
71fd110c347a
allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents:
5433
diff
changeset
|
1650 |
%}. |
71fd110c347a
allow print, printCR during early initialization
Claus Gittinger <cg@exept.de>
parents:
5433
diff
changeset
|
1651 |
super print |
699 | 1652 |
! |
1653 |
||
1654 |
printOn:aStream |
|
1655 |
"print myself on aStream" |
|
1656 |
||
1657 |
aStream nextPut:self |
|
1658 |
! |
|
1659 |
||
1660 |
printString |
|
1661 |
"return a string to print me" |
|
1662 |
||
1663 |
^ self asString |
|
1664 |
! |
|
1665 |
||
1666 |
storeOn:aStream |
|
1667 |
"store myself on aStream" |
|
1668 |
||
1669 |
|special| |
|
1670 |
||
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1671 |
(asciivalue between:33 and:127) ifTrue:[ |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1672 |
aStream nextPut:$$; nextPut:self |
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1673 |
] ifFalse:[ |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1674 |
(self == Character space) ifTrue:[ |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1675 |
special := #space |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1676 |
] ifFalse:[ |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1677 |
(self == Character cr) ifTrue:[ |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1678 |
special := #cr. |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1679 |
] ifFalse:[ |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1680 |
(self == Character tab) ifTrue:[ |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1681 |
special := #tab. |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1682 |
] ifFalse:[ |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1683 |
(self == Character esc) ifTrue:[ |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1684 |
special := #esc. |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1685 |
] |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1686 |
] |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1687 |
] |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1688 |
]. |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1689 |
special notNil ifTrue:[ |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1690 |
aStream nextPutAll:'(Character '; nextPutAll:special; nextPut:$). |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1691 |
^ self |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1692 |
]. |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1693 |
aStream nextPutAll:'(Character codePoint:16r'. |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1694 |
asciivalue printOn:aStream base:16. |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
1695 |
aStream nextPut:$) |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1696 |
]. |
995
b018368b3a94
asString to 16-bit char should return a twoByteString
Claus Gittinger <cg@exept.de>
parents:
819
diff
changeset
|
1697 |
|
3190
81ffb25d1d86
Use #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
3072
diff
changeset
|
1698 |
"Modified: / 23.2.1996 / 23:27:32 / cg" |
81ffb25d1d86
Use #printOn: instead of #printString
Stefan Vogel <sv@exept.de>
parents:
3072
diff
changeset
|
1699 |
"Modified: / 20.1.1998 / 14:10:46 / stefan" |
699 | 1700 |
! ! |
1701 |
||
7257 | 1702 |
!Character methodsFor:'private-accessing'! |
699 | 1703 |
|
8100 | 1704 |
setCodePoint:anInteger |
9153 | 1705 |
"very private - set the codePoint. |
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1706 |
- use this only for newly created characters with codes > MAX_IMMEDIATE_CHARACTER. |
9153 | 1707 |
DANGER alert: |
1708 |
funny things happen, if this is applied to |
|
10936
9381620deb4d
use #codePoint: instead of #value:
Stefan Vogel <sv@exept.de>
parents:
10428
diff
changeset
|
1709 |
one of the shared characters with codePoints 0..MAX_IMMEDIATE_CHARACTER." |
699 | 1710 |
|
1711 |
asciivalue := anInteger |
|
1712 |
! ! |
|
1713 |
||
8004
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1714 |
!Character methodsFor:'queries'! |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1715 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1716 |
bitsPerCharacter |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1717 |
"return the number of bits I require for storage" |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1718 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1719 |
asciivalue <= 16rFF ifTrue:[^ 8]. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1720 |
asciivalue <= 16rFFFF ifTrue:[^ 16]. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1721 |
^ 32 |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1722 |
! |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1723 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1724 |
stringSpecies |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1725 |
"return the type of string that is needed to store me" |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1726 |
|
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1727 |
asciivalue <= 16rFF ifTrue:[^ String]. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1728 |
asciivalue <= 16rFFFF ifTrue:[^ Unicode16String]. |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1729 |
^ Unicode32String |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1730 |
! ! |
a09a6a745e65
asLowercase/asUppercase and friends care for 16-bit chars
Claus Gittinger <cg@exept.de>
parents:
7997
diff
changeset
|
1731 |
|
1 | 1732 |
!Character methodsFor:'testing'! |
1733 |
||
54 | 1734 |
isCharacter |
1735 |
"return true, if the receiver is some kind of character" |
|
1736 |
||
1737 |
^ true |
|
1738 |
! |
|
1739 |
||
3667 | 1740 |
isControlCharacter |
8097 | 1741 |
"return true if I am a control character (i.e. ascii value < 32 or == 16rFF)" |
3667 | 1742 |
|
1743 |
%{ /* NOCONTEXT */ |
|
1744 |
#ifdef NON_ASCII /* i.e. EBCDIC ;-) */ |
|
8097 | 1745 |
# error not yet implemented - fails when compiled |
3667 | 1746 |
#else |
14684 | 1747 |
REGISTER INT val; |
3667 | 1748 |
|
1749 |
val = __intVal(__INST(asciivalue)); |
|
8097 | 1750 |
if (val < ' ' || val == 0xFF) { |
9153 | 1751 |
RETURN ( true ); |
3667 | 1752 |
} |
1753 |
#endif |
|
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1754 |
RETURN (false); |
3667 | 1755 |
%}. |
1756 |
||
1757 |
" |
|
1758 |
(Character value:1) isControlCharacter |
|
1759 |
$a isControlCharacter |
|
1760 |
" |
|
1761 |
! |
|
1762 |
||
1 | 1763 |
isDigit |
1764 |
"return true, if I am a digit (i.e. $0 .. $9)" |
|
1765 |
||
7980 | 1766 |
%{ /* NOCONTEXT */ |
6527 | 1767 |
|
14684 | 1768 |
REGISTER INT val; |
6527 | 1769 |
|
1770 |
val = __intVal(__INST(asciivalue)); |
|
14684 | 1771 |
if ((unsigned INT)(val - '0') <= ('9' - '0')) { |
9153 | 1772 |
RETURN ( true ); |
6527 | 1773 |
} |
1774 |
RETURN ( false ); |
|
1775 |
%}. |
|
8097 | 1776 |
^ asciivalue between:$0 codePoint and:$9 codePoint |
1 | 1777 |
! |
1778 |
||
1779 |
isDigitRadix:r |
|
1780 |
"return true, if I am a digit of a base r number" |
|
1781 |
||
9153 | 1782 |
(asciivalue < $0 codePoint) ifTrue:[^ false]. |
1 | 1783 |
(r > 10) ifTrue:[ |
9153 | 1784 |
(asciivalue <= $9 codePoint) ifTrue:[ |
1785 |
^ true |
|
1786 |
]. |
|
1787 |
((asciivalue - $a codePoint) between:0 and:(r - 11)) ifTrue:[ |
|
1788 |
^ true |
|
1789 |
]. |
|
1790 |
^ (asciivalue - $A codePoint) between:0 and:(r - 11) |
|
1 | 1791 |
]. |
8097 | 1792 |
(asciivalue - $0 codePoint) < r ifTrue:[^ true]. |
1 | 1793 |
^ false |
1794 |
! |
|
1795 |
||
699 | 1796 |
isEndOfLineCharacter |
1797 |
"return true if I am a line delimitting character" |
|
1 | 1798 |
|
1799 |
%{ /* NOCONTEXT */ |
|
1800 |
||
14684 | 1801 |
REGISTER INT val; |
1 | 1802 |
|
1133 | 1803 |
val = __intVal(__INST(asciivalue)); |
699 | 1804 |
if ((val == '\n') |
1805 |
|| (val == '\r') |
|
1806 |
|| (val == '\f')) { |
|
9153 | 1807 |
RETURN ( true ); |
54 | 1808 |
} |
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1809 |
RETURN (false); |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1810 |
%}. |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1811 |
^ asciivalue == 16r0A |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1812 |
or:[asciivalue == 16r0D |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1813 |
or:[asciivalue == 16r0C]] |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1814 |
|
1 | 1815 |
! |
1816 |
||
5473
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1817 |
isImmediate |
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1818 |
"return true if I am an immediate object |
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1819 |
i.e. I am represented in the pointer itself and |
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1820 |
no real object header/storage is used me. |
9153 | 1821 |
For VW compatibility, shared characters (i.e. in the range 0..MAX_IMMEDIATE_CHARACTER) |
5473
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1822 |
also return true here" |
9153 | 1823 |
|
8097 | 1824 |
%{ /* NOCONTEXT */ |
1825 |
if (__smallIntegerVal(__INST(asciivalue)) <= MAX_IMMEDIATE_CHARACTER) { |
|
9153 | 1826 |
RETURN ( true ); |
8097 | 1827 |
} |
1828 |
%}. |
|
1829 |
^ false |
|
1830 |
||
1831 |
" |
|
9153 | 1832 |
$a isImmediate. |
1833 |
(Character value:255) isImmediate. |
|
1834 |
(Character value:256) isImmediate. |
|
1835 |
(Character value:1566) isImmediate. |
|
8097 | 1836 |
" |
5473
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1837 |
! |
c48d8c45c740
isImmediate returns true for shared characters
Claus Gittinger <cg@exept.de>
parents:
5471
diff
changeset
|
1838 |
|
1 | 1839 |
isLetter |
7979
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
1840 |
"return true, if I am a letter in the 'a'..'z' range. |
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
1841 |
Use isNationalLetter, if you are interested in those." |
1 | 1842 |
|
7980 | 1843 |
%{ /* NOCONTEXT */ |
1 | 1844 |
|
14684 | 1845 |
REGISTER INT val; |
1 | 1846 |
|
1133 | 1847 |
val = __intVal(__INST(asciivalue)); |
14684 | 1848 |
if ((unsigned INT)(val - 'a') <= ('z' - 'a')) { |
9153 | 1849 |
RETURN ( true ); |
6527 | 1850 |
} |
14684 | 1851 |
if ((unsigned INT)(val - 'A') <= ('Z' - 'A')) { |
9153 | 1852 |
RETURN ( true ); |
6527 | 1853 |
} |
1854 |
RETURN ( false ); |
|
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1855 |
%}. |
8097 | 1856 |
^ (asciivalue between:($a codePoint) and:($z codePoint)) |
1857 |
or:[(asciivalue between:($A codePoint) and:($Z codePoint))] |
|
1 | 1858 |
! |
1859 |
||
154 | 1860 |
isLetterOrDigit |
7979
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
1861 |
"return true, if I am a letter (a..z or A..Z) or a digit (0..9) |
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
1862 |
Use isNationalAlphaNumeric, if you are interested in those." |
1 | 1863 |
|
1864 |
%{ /* NOCONTEXT */ |
|
1865 |
||
14684 | 1866 |
REGISTER INT val; |
1 | 1867 |
|
1133 | 1868 |
val = __intVal(__INST(asciivalue)); |
14684 | 1869 |
if ((unsigned INT)(val - 'a') <= ('z' - 'a')) { |
9153 | 1870 |
RETURN ( true ); |
1 | 1871 |
} |
14684 | 1872 |
if ((unsigned INT)(val - 'A') <= ('Z' - 'A')) { |
9153 | 1873 |
RETURN ( true ); |
1 | 1874 |
} |
14684 | 1875 |
if ((unsigned INT)(val - '0') <= ('9' - '0')) { |
9153 | 1876 |
RETURN ( true ); |
1 | 1877 |
} |
1878 |
RETURN ( false ); |
|
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1879 |
%}. |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
1880 |
^ self isLetter or:[self isDigit] |
1 | 1881 |
! |
1882 |
||
17440 | 1883 |
isLetterOrUnderline |
1884 |
"return true, if I am a letter or $_" |
|
1885 |
||
1886 |
^ self == $_ or:[ self isLetter ] |
|
1887 |
! |
|
1888 |
||
699 | 1889 |
isLowercase |
7979
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
1890 |
"return true, if I am a lower-case letter. |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
1891 |
This one does care for national characters. |
9153 | 1892 |
Caveat: |
14684 | 1893 |
only returns the correct value for codes up to u+1d6ff (Unicode3.1). |
1894 |
(which is more than mozilla does, btw. ;-)" |
|
699 | 1895 |
|
1896 |
%{ /* NOCONTEXT */ |
|
1897 |
||
14684 | 1898 |
REGISTER unsigned INT val; |
7989
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
1899 |
#define TRUE_IF_ODD(x) ((x & 1) ? true : false) |
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
1900 |
#define TRUE_IF_EVEN(x) ((x & 1) ? false : true) |
154 | 1901 |
|
14684 | 1902 |
/* because used so often, this is open coded, instead of table driven */ |
1133 | 1903 |
val = __intVal(__INST(asciivalue)); |
14684 | 1904 |
|
1905 |
/* the most likely case here, outside the switch */ |
|
1906 |
if (val <= 0xFF) { |
|
1907 |
if ((unsigned INT)(val - 'a') <= ('z' - 'a')) { |
|
1908 |
RETURN ( true ); |
|
1909 |
} |
|
1910 |
||
1911 |
/* iso8859 puts national lower case characters at e0 .. ff */ |
|
1912 |
if ((val >= 0xDF) && (val <= 0xFF)) { |
|
1913 |
if (val != 0xF7) { |
|
1914 |
RETURN(true); |
|
1915 |
} |
|
1916 |
} |
|
1917 |
if (val == 0xAA) RETURN(true); /* FEMININE ORDINAL INDICATOR (high a-underline) */ |
|
1918 |
if (val == 0xB5) RETURN(true); /* MICRO SIGN */ |
|
1919 |
if (val == 0xBA) RETURN(true); /* MASCULINE ORDINAL INDICATOR (high o-underline) */ |
|
1920 |
RETURN (false); |
|
1921 |
} |
|
1922 |
||
7989
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
1923 |
switch (val >> 8) { |
14684 | 1924 |
case 0x01: |
1925 |
if (val <= 0x0137) { RETURN (TRUE_IF_ODD(val)); } |
|
1926 |
if (val <= 0x0148) { RETURN (TRUE_IF_EVEN(val)); } |
|
1927 |
if (val <= 0x0178) { RETURN (TRUE_IF_ODD(val)); } |
|
1928 |
if (val <= 0x017E) { RETURN (TRUE_IF_EVEN(val)); } |
|
1929 |
if (val <= 0x0180) { RETURN (true); } |
|
1930 |
if (val < 0x01CD) { |
|
1931 |
if (val == 0x0181) { RETURN (false); } |
|
1932 |
if (val <= 0x0185) { |
|
1933 |
RETURN (TRUE_IF_ODD(val)); |
|
1934 |
} |
|
1935 |
if (val == 0x0188) { RETURN (true); } |
|
1936 |
if (val == 0x018C) { RETURN (true); } |
|
1937 |
if (val == 0x018D) { RETURN (true); } |
|
1938 |
if (val == 0x0192) { RETURN (true); } |
|
1939 |
if (val == 0x0195) { RETURN (true); } |
|
1940 |
if (val == 0x0199) { RETURN (true); } |
|
1941 |
if (val == 0x019A) { RETURN (true); } |
|
1942 |
if (val == 0x019B) { RETURN (true); } |
|
1943 |
if (val == 0x019E) { RETURN (true); } |
|
1944 |
if (val <= 0x01A0) { RETURN (false); } |
|
1945 |
if (val <= 0x01A6) { RETURN (TRUE_IF_ODD(val)); } |
|
1946 |
if (val <= 0x01AA) { RETURN (TRUE_IF_EVEN(val)); } |
|
1947 |
if (val <= 0x01AE) { RETURN (TRUE_IF_ODD(val)); } |
|
1948 |
if (val == 0x01B2) { RETURN (false); } |
|
1949 |
if (val <= 0x01B6) { RETURN (TRUE_IF_EVEN(val)); } |
|
1950 |
if (val == 0x01B9) { RETURN (true); } |
|
1951 |
if (val == 0x01BA) { RETURN (true); } |
|
1952 |
if (val == 0x01BD) { RETURN (true); } |
|
1953 |
if (val == 0x01BE) { RETURN (true); } |
|
1954 |
if (val == 0x01BF) { RETURN (true); } |
|
1955 |
if (val == 0x01C6) { RETURN (true); } |
|
1956 |
if (val == 0x01C9) { RETURN (true); } |
|
1957 |
if (val == 0x01CC) { RETURN (true); } |
|
1958 |
RETURN (false); |
|
1959 |
} |
|
1960 |
if (val <= 0x01DC) { RETURN (TRUE_IF_EVEN(val)); } |
|
1961 |
if (val <= 0x01EF) { RETURN (TRUE_IF_ODD(val)); } |
|
1962 |
if (val == 0x01F0) { RETURN (true); } |
|
1963 |
if (val == 0x01F1) { RETURN (false); } |
|
1964 |
if (val == 0x01F2) { RETURN (false); } |
|
1965 |
if (val == 0x01F3) { RETURN (true); } |
|
1966 |
if (val <= 0x01F6) { RETURN (TRUE_IF_ODD(val)); } |
|
1967 |
if (val == 0x01F7) { RETURN (false); } |
|
1968 |
RETURN (TRUE_IF_ODD(val)); |
|
1969 |
||
1970 |
case 0x02: |
|
1971 |
if (val <= 0x0233) { RETURN (TRUE_IF_ODD(val)); } |
|
1972 |
if (val <= 0x0236) { RETURN (true); } |
|
1973 |
if (val < 0x0250) { RETURN (false); } |
|
1974 |
if (val < 0x02B0) { RETURN (true); } |
|
1975 |
RETURN (false); |
|
1976 |
||
1977 |
||
1978 |
case 0x03: |
|
1979 |
if (val == 0x0390) { RETURN (true); } |
|
1980 |
if (val <= 0x03AB) { RETURN (false); } |
|
1981 |
if (val <= 0x03D1) { RETURN (true); } |
|
1982 |
if (val == 0x03D5) { RETURN (true); } |
|
1983 |
if (val == 0x03D6) { RETURN (true); } |
|
1984 |
if (val < 0x03D7) { RETURN (false); } |
|
1985 |
if (val <= 0x03EF) { RETURN (TRUE_IF_ODD(val)); } |
|
1986 |
if (val <= 0x03F3) { RETURN (true); } |
|
1987 |
if (val == 0x03F5) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1988 |
#ifndef UNICODE_3_2 |
14684 | 1989 |
if (val == 0x03F8) { RETURN (true); } |
1990 |
if (val == 0x03FB) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
1991 |
#endif |
14684 | 1992 |
RETURN (false); |
1993 |
||
1994 |
case 0x04: |
|
1995 |
if (val <= 0x042F) { RETURN (false); } |
|
1996 |
if (val <= 0x045F) { RETURN (true); } |
|
1997 |
if (val <= 0x0481) { RETURN (TRUE_IF_ODD(val)); } |
|
1998 |
if (val < 0x048A) { RETURN (false); } |
|
1999 |
if (val <= 0x04C0) { RETURN (TRUE_IF_ODD(val)); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2000 |
#ifdef UNICODE_3_2 |
14684 | 2001 |
if (val == 0x04C5) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2002 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2003 |
#ifdef UNICODE_3_2 |
14684 | 2004 |
if (val <= 0x04C8) { RETURN (TRUE_IF_EVEN(val)); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2005 |
#else |
14684 | 2006 |
if (val <= 0x04CA) { RETURN (TRUE_IF_EVEN(val)); } |
2007 |
if (val == 0x04CD) { RETURN (false); } |
|
2008 |
if (val == 0x04CE) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2009 |
#endif |
14684 | 2010 |
if (val == 0x04CB) { RETURN (false); } |
2011 |
if (val == 0x04CC) { RETURN (true); } |
|
2012 |
RETURN (TRUE_IF_ODD(val)); |
|
2013 |
||
2014 |
case 0x05: |
|
2015 |
if (val <= 0x050F) { RETURN (TRUE_IF_ODD(val)); } |
|
2016 |
if (val < 0x0561) { RETURN (false); } |
|
2017 |
if (val <= 0x0587) { RETURN (true); } |
|
2018 |
RETURN (false); |
|
2019 |
||
2020 |
case 0x1D: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2021 |
#ifndef UNICODE_3_2 |
14684 | 2022 |
if (val <= 0x1D2B) { RETURN (true); } |
2023 |
if (val <= 0x1D61) { RETURN (false); } |
|
2024 |
if (val <= 0x1D70) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2025 |
#endif |
14684 | 2026 |
RETURN (false); |
2027 |
||
2028 |
case 0x1E: |
|
2029 |
if (val < 0x1E96) { RETURN (TRUE_IF_ODD(val)); } |
|
2030 |
if (val <= 0x1E9F) { RETURN (true); } |
|
2031 |
RETURN (TRUE_IF_ODD(val)); |
|
2032 |
||
2033 |
case 0x1F: |
|
2034 |
if (val <= 0x1F6F) { |
|
2035 |
if (val & 0x0008) { RETURN (false); } |
|
2036 |
RETURN (true); |
|
2037 |
} |
|
2038 |
if (val <= 0x1F87) { RETURN (true); } |
|
2039 |
if (val < 0x1FB8) { |
|
2040 |
if (val & 0x0008) { RETURN (false); } |
|
2041 |
RETURN (true); |
|
2042 |
} |
|
2043 |
if (val == 0x1FBE) { RETURN (true); } |
|
2044 |
if (val == 0x1FD4) { RETURN (false); } |
|
2045 |
if (val == 0x1FC5) { RETURN (false); } |
|
2046 |
if (val == 0x1FD5) { RETURN (false); } |
|
2047 |
if (val == 0x1FC1) { RETURN (false); } |
|
2048 |
if (val == 0x1FF1) { RETURN (false); } |
|
2049 |
if (val == 0x1FC0) { RETURN (false); } |
|
2050 |
if (val == 0x1FF0) { RETURN (false); } |
|
2051 |
if (((val & 0x000F) >= 0x0000) && ((val & 0x000F) <= 0x0007)) { RETURN (true); } |
|
2052 |
RETURN (false); |
|
2053 |
||
2054 |
case 0x20: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2055 |
#ifndef UNICODE_3_2 |
14684 | 2056 |
if (val == 0x2071) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2057 |
#endif |
14684 | 2058 |
if (val == 0x207F) { RETURN (true); } |
2059 |
RETURN (false); |
|
2060 |
||
2061 |
case 0x21: |
|
2062 |
if (val == 0x210A) { RETURN (true); } |
|
2063 |
if (val < 0x210E) { RETURN (false); } |
|
2064 |
if (val <= 0x210F) { RETURN (true); } |
|
2065 |
if (val == 0x2113) { RETURN (true); } |
|
2066 |
if (val == 0x212F) { RETURN (true); } |
|
2067 |
if (val == 0x2134) { RETURN (true); } |
|
2068 |
if (val == 0x2139) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2069 |
#ifndef UNICODE_3_2 |
14684 | 2070 |
if (val == 0x213D) { RETURN (true); } |
2071 |
if (val <= 0x2145) { RETURN (false); } |
|
2072 |
if (val <= 0x2149) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2073 |
#endif |
14684 | 2074 |
RETURN (false); |
2075 |
||
2076 |
case 0xFB: |
|
2077 |
if (val <= 0xFB1C) { RETURN (true); } |
|
2078 |
RETURN (false); |
|
2079 |
||
2080 |
case 0xFF: |
|
2081 |
if ((val >= 0xFF41) && (val <= 0xFF5A)) { RETURN (true); } |
|
2082 |
RETURN (false); |
|
2083 |
||
2084 |
case 0x104: |
|
2085 |
if (val <= 0x10427) { RETURN (false); } |
|
2086 |
if (val <= 0x1044D) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2087 |
#ifdef UNICODE_3_2 |
14684 | 2088 |
if (val <= 0x1044D) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2089 |
#else |
14684 | 2090 |
if (val <= 0x1044F) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2091 |
#endif |
14684 | 2092 |
RETURN (false); |
2093 |
||
2094 |
case 0x1D4: |
|
2095 |
case 0x1D5: |
|
2096 |
case 0x1D6: |
|
2097 |
if (val <= 0x1D419) { RETURN (false); } |
|
2098 |
if (val < 0x1D6be) { |
|
2099 |
if (((val - 0x1D41A) % 52) <= 25) { RETURN (true); } |
|
2100 |
RETURN (false); |
|
2101 |
} |
|
2102 |
if (val < 0x1D6c2) { RETURN (false); } |
|
2103 |
if (val < 0x1D6db) { RETURN (true); } |
|
2104 |
if (val == 0x1D6db) { RETURN (false); } |
|
2105 |
if (val < 0x1D6e2) { RETURN (true); } |
|
2106 |
if (val <= 0x1D6fb) { RETURN (false); } |
|
2107 |
RETURN (true); |
|
13558 | 2108 |
|
2109 |
#ifdef UNICODE_4 |
|
14684 | 2110 |
case 0x1D7: |
2111 |
if (val <= 0x1D71b) { RETURN (true); } |
|
2112 |
if (val <= 0x1D735) { RETURN (false); } |
|
2113 |
if (val <= 0x1D755) { RETURN (true); } |
|
2114 |
if (val <= 0x1D76f) { RETURN (false); } |
|
2115 |
if (val <= 0x1D78F) { RETURN (true); } |
|
2116 |
||
2117 |
RETURN (false); |
|
13558 | 2118 |
#endif |
699 | 2119 |
} |
7989
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
2120 |
#undef TRUE_IF_ODD |
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
2121 |
#undef TRUE_IF_EVEN |
7907420b2fab
asUppercase / asLowercase for U0100..U04FF
Claus Gittinger <cg@exept.de>
parents:
7988
diff
changeset
|
2122 |
RETURN (false); |
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2123 |
%}. |
13558 | 2124 |
|
2125 |
"Modified: / 05-08-2011 / 18:56:33 / cg" |
|
154 | 2126 |
! |
2127 |
||
699 | 2128 |
isPrintable |
2129 |
"return true, if the receiver is a useful printable character |
|
2130 |
(see fileBrowsers showFile:-method on how it can be used)" |
|
1 | 2131 |
|
699 | 2132 |
(asciivalue between:32 and:127) ifTrue:[^ true]. |
6398 | 2133 |
asciivalue == 12 ifTrue:[^ true]. "/ FF |
2134 |
asciivalue == 13 ifTrue:[^ true]. "/ CR |
|
2135 |
asciivalue == 9 ifTrue:[^ true]. "/ TAB |
|
2136 |
asciivalue == 10 ifTrue:[^ true]. "/ NL |
|
2840 | 2137 |
|
8097 | 2138 |
(asciivalue between:16rA0 and:16rBF) ifTrue:[^ true]. "/ ISO-8859 |
2139 |
^ self isNationalAlphaNumeric |
|
2840 | 2140 |
|
2141 |
"Modified: 7.8.1997 / 17:05:24 / cg" |
|
1 | 2142 |
! |
2143 |
||
2144 |
isSeparator |
|
2145 |
"return true if I am a space, cr, tab, nl, or newPage" |
|
2146 |
||
2147 |
%{ /* NOCONTEXT */ |
|
2148 |
||
14684 | 2149 |
REGISTER INT val; |
1 | 2150 |
|
1133 | 2151 |
val = __intVal(__INST(asciivalue)); |
328 | 2152 |
#ifndef NON_ASCII /* i.e. EBCDIC ;-) */ |
2153 |
if (val <= ' ') |
|
2154 |
#endif |
|
9153 | 2155 |
if ((val == ' ') |
2156 |
|| (val == '\n') |
|
2157 |
|| (val == '\t') |
|
2158 |
|| (val == '\r') |
|
2159 |
|| (val == '\f')) { |
|
2160 |
RETURN ( true ); |
|
2161 |
} |
|
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2162 |
RETURN (false); |
9153 | 2163 |
%}. |
5423
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2164 |
^ (asciivalue == 16r20) |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2165 |
or:[asciivalue == 16r0D |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2166 |
or:[asciivalue == 16r0A |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2167 |
or:[asciivalue == 16r09 |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2168 |
or:[asciivalue == 16r0C]]]] |
e33decc83182
non-primitive fallBack code added
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
2169 |
|
1 | 2170 |
! |
2171 |
||
699 | 2172 |
isUppercase |
7979
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
2173 |
"return true, if I am an upper-case letter. |
8022
d901d41171a5
isXXX and asXXX are now valid up to U+1d6FF
Claus Gittinger <cg@exept.de>
parents:
8012
diff
changeset
|
2174 |
This one does care for national characters. |
9153 | 2175 |
Caveat: |
2176 |
only returns the correct value for codes up to u+1d6ff (Unicode3.1). |
|
2177 |
(which is more than mozilla does, btw. ;-)" |
|
1 | 2178 |
|
2179 |
%{ /* NOCONTEXT */ |
|
7988
cb1c920e67eb
isUppercase / isLowercase unicode changes
Claus Gittinger <cg@exept.de>
parents:
7987
diff
changeset
|
2180 |
#define TRUE_IF_ODD(x) ((x & 1) ? true : false) |
cb1c920e67eb
isUppercase / isLowercase unicode changes
Claus Gittinger <cg@exept.de>
parents:
7987
diff
changeset
|
2181 |
#define TRUE_IF_EVEN(x) ((x & 1) ? false : true) |
1 | 2182 |
|
14684 | 2183 |
/* because used so often, this is open coded, instead of table driven */ |
2184 |
REGISTER unsigned INT val; |
|
1 | 2185 |
|
1133 | 2186 |
val = __intVal(__INST(asciivalue)); |
7979
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
2187 |
|
14684 | 2188 |
/* the most likely case here, outside the switch */ |
2189 |
if (val <= 0xFF) { |
|
2190 |
if ((unsigned INT)(val - 'A') <= ('Z' - 'A')) { |
|
2191 |
RETURN ( true ); |
|
2192 |
} |
|
2193 |
/* iso8859 puts national upper case characters at c0 .. df */ |
|
2194 |
if ((val >= 0xC0) && (val <= 0xDE)) { |
|
2195 |
if (val != 0xD7) { |
|
2196 |
RETURN(true); |
|
2197 |
} |
|
2198 |
} |
|
2199 |
RETURN (false); |
|
2200 |
} |
|
2201 |
||
7988
cb1c920e67eb
isUppercase / isLowercase unicode changes
Claus Gittinger <cg@exept.de>
parents:
7987
diff
changeset
|
2202 |
switch (val >> 8) { |
9153 | 2203 |
case 0x01: |
2204 |
if (val <= 0x0137) { RETURN (TRUE_IF_EVEN(val)); } |
|
2205 |
if (val <= 0x0148) { RETURN (TRUE_IF_ODD(val)); } |
|
2206 |
if (val <= 0x0178) { RETURN (TRUE_IF_EVEN(val)); } |
|
2207 |
if (val <= 0x017E) { RETURN (TRUE_IF_ODD(val)); } |
|
2208 |
if (val < 0x01CD) { |
|
2209 |
if (val == 0x0180) { RETURN (false); } |
|
2210 |
if (val == 0x0181) { RETURN (true); } |
|
2211 |
if (val <= 0x0186) { |
|
2212 |
RETURN (TRUE_IF_EVEN(val)); |
|
2213 |
} |
|
2214 |
if (val <= 0x0189) { |
|
2215 |
RETURN (TRUE_IF_ODD(val)); |
|
2216 |
} |
|
2217 |
if (val <= 0x018B) { RETURN (true); } |
|
2218 |
if (val <= 0x018D) { RETURN (false); } |
|
2219 |
if (val <= 0x0191) { RETURN (true); } |
|
2220 |
if (val == 0x0193) { RETURN (true); } |
|
2221 |
if (val == 0x0194) { RETURN (true); } |
|
2222 |
if (val == 0x0196) { RETURN (true); } |
|
2223 |
if (val == 0x0197) { RETURN (true); } |
|
2224 |
if (val == 0x0198) { RETURN (true); } |
|
2225 |
if (val == 0x019C) { RETURN (true); } |
|
2226 |
if (val == 0x019D) { RETURN (true); } |
|
2227 |
if (val == 0x019F) { RETURN (true); } |
|
2228 |
if (val < 0x01A0) { RETURN (false); } |
|
2229 |
if (val <= 0x01A6) { RETURN (TRUE_IF_EVEN(val)); } |
|
2230 |
if (val <= 0x01AA) { RETURN (TRUE_IF_ODD(val)); } |
|
2231 |
if (val <= 0x01AE) { RETURN (TRUE_IF_EVEN(val)); } |
|
2232 |
if (val == 0x01B2) { RETURN (true); } |
|
2233 |
if (val <= 0x01B7) { RETURN (TRUE_IF_ODD(val)); } |
|
2234 |
if (val == 0x01B8) { RETURN (true); } |
|
2235 |
if (val == 0x01BC) { RETURN (true); } |
|
2236 |
if (val == 0x01C4) { RETURN (true); } |
|
2237 |
if (val == 0x01C7) { RETURN (true); } |
|
8308 | 2238 |
#if 0 |
9153 | 2239 |
if (val == 0x01C8) { RETURN (true); } |
8308 | 2240 |
#endif |
9153 | 2241 |
if (val == 0x01CA) { RETURN (true); } |
8308 | 2242 |
#if 0 |
9153 | 2243 |
if (val == 0x01CB) { RETURN (true); } |
8308 | 2244 |
#endif |
9153 | 2245 |
RETURN (false); /* WRONG !!! */ |
2246 |
} |
|
2247 |
if (val <= 0x01DC) { RETURN (TRUE_IF_ODD(val)); } |
|
2248 |
if (val <= 0x01EF) { RETURN (TRUE_IF_EVEN(val)); } |
|
2249 |
if (val == 0x01F0) { RETURN (false); } |
|
2250 |
if (val == 0x01F1) { RETURN (true); } |
|
2251 |
if (val == 0x01F2) { RETURN (false); } |
|
2252 |
if (val == 0x01F3) { RETURN (false); } |
|
2253 |
if (val == 0x01F4) { RETURN (true); } |
|
2254 |
if (val == 0x01F5) { RETURN (false); } |
|
2255 |
if (val == 0x01F6) { RETURN (true); } |
|
2256 |
if (val == 0x01F7) { RETURN (true); } |
|
2257 |
RETURN (TRUE_IF_EVEN(val)); |
|
2258 |
||
2259 |
case 0x02: |
|
2260 |
if (val <= 0x0233) { RETURN (TRUE_IF_EVEN(val)); } |
|
2261 |
RETURN (false); |
|
2262 |
||
2263 |
case 0x03: |
|
2264 |
if (val < 0x0386) { RETURN (false); } |
|
2265 |
if (val == 0x0387) { RETURN (false); } |
|
2266 |
if (val == 0x0390) { RETURN (false); } |
|
2267 |
if (val <= 0x03AB) { RETURN (true); } |
|
2268 |
if (val <= 0x03D1) { RETURN (false); } |
|
2269 |
if (val <= 0x03D4) { RETURN (true); } |
|
2270 |
if (val <= 0x03D7) { RETURN (false); } |
|
2271 |
if (val <= 0x03EF) { RETURN (TRUE_IF_EVEN(val)); } |
|
2272 |
if (val == 0x03F4) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2273 |
#ifndef UNICODE_3_2 |
9153 | 2274 |
if (val == 0x03F7) { RETURN (true); } |
2275 |
if (val == 0x03F9) { RETURN (true); } |
|
2276 |
if (val == 0x03Fa) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2277 |
#endif |
9153 | 2278 |
RETURN (false); |
2279 |
||
2280 |
case 0x04: |
|
2281 |
if (val <= 0x042F) { RETURN (true); } |
|
2282 |
if (val <= 0x045F) { RETURN (false); } |
|
2283 |
if (val <= 0x0481) { RETURN (TRUE_IF_EVEN(val)); } |
|
2284 |
if (val < 0x048A) { RETURN (false); } |
|
2285 |
if (val <= 0x04C0) { RETURN (TRUE_IF_EVEN(val)); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2286 |
#ifdef UNICODE_3_2 |
9153 | 2287 |
if (val == 0x04C5) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2288 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2289 |
#ifdef UNICODE_3_2 |
9153 | 2290 |
if (val <= 0x04C8) { RETURN (TRUE_IF_ODD(val)); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2291 |
#else |
9153 | 2292 |
if (val <= 0x04CA) { RETURN (TRUE_IF_ODD(val)); } |
2293 |
if (val == 0x04CD) { RETURN (true); } |
|
2294 |
if (val == 0x04CE) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2295 |
#endif |
9153 | 2296 |
if (val == 0x04CB) { RETURN (true); } |
2297 |
if (val == 0x04CC) { RETURN (false); } |
|
2298 |
RETURN (TRUE_IF_EVEN(val)); |
|
2299 |
||
2300 |
case 0x05: |
|
2301 |
if (val <= 0x050F) { RETURN (TRUE_IF_EVEN(val)); } |
|
2302 |
if (val < 0x0531) { RETURN (false); } |
|
2303 |
if (val <= 0x0556) { RETURN (true); } |
|
2304 |
RETURN (false); |
|
2305 |
||
2306 |
case 0x10: |
|
2307 |
if (val < 0x10A0) { RETURN (false); } |
|
2308 |
if (val <= 0x10CF) { RETURN (true); } |
|
2309 |
RETURN (false); |
|
2310 |
||
2311 |
case 0x1E: |
|
2312 |
if (val < 0x1E96) { RETURN (TRUE_IF_EVEN(val)); } |
|
2313 |
if (val < 0x1EA0) { RETURN (false); } |
|
2314 |
RETURN (TRUE_IF_EVEN(val)); |
|
2315 |
||
2316 |
case 0x1F: |
|
2317 |
if (val <= 0x1F6F) { |
|
2318 |
if (val & 0x0008) { RETURN (true); } |
|
2319 |
} |
|
2320 |
if (val <= 0x1F87) { RETURN (false); } |
|
2321 |
if (val < 0x1FB8) { RETURN (false); } |
|
2322 |
if (val < 0x1FBC) { RETURN (true); } |
|
2323 |
if (val == 0x1FEC) { RETURN (true); } |
|
2324 |
if (((val & 0x000F) >= 0x0008) && ((val & 0x000F) <= 0x000B)) { RETURN (true); } |
|
2325 |
RETURN (false); |
|
2326 |
||
2327 |
case 0x21: |
|
2328 |
if (val == 0x2102) { RETURN (true); } |
|
2329 |
if (val == 0x2107) { RETURN (true); } |
|
2330 |
if (val < 0x210B) { RETURN (false); } |
|
2331 |
if (val < 0x210E) { RETURN (true); } |
|
2332 |
if (val == 0x2110) { RETURN (true); } |
|
2333 |
if (val == 0x2111) { RETURN (true); } |
|
2334 |
if (val == 0x2112) { RETURN (true); } |
|
2335 |
if (val == 0x2115) { RETURN (true); } |
|
2336 |
if (val == 0x2119) { RETURN (true); } |
|
2337 |
if (val == 0x211A) { RETURN (true); } |
|
2338 |
if (val == 0x211B) { RETURN (true); } |
|
2339 |
if (val == 0x211C) { RETURN (true); } |
|
2340 |
if (val == 0x211D) { RETURN (true); } |
|
2341 |
if (val < 0x2124) { RETURN (false); } |
|
2342 |
if (val <= 0x212A) { RETURN (TRUE_IF_EVEN(val)); } |
|
2343 |
if (val == 0x212B) { RETURN (true); } |
|
2344 |
if (val == 0x212C) { RETURN (true); } |
|
2345 |
if (val == 0x212D) { RETURN (true); } |
|
2346 |
if (val == 0x2130) { RETURN (true); } |
|
2347 |
if (val == 0x2131) { RETURN (true); } |
|
2348 |
if (val == 0x2133) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2349 |
#ifndef UNICODE_3_2 |
9153 | 2350 |
if (val == 0x213E) { RETURN (true); } |
2351 |
if (val == 0x213F) { RETURN (true); } |
|
2352 |
if (val == 0x2145) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2353 |
#endif |
9153 | 2354 |
RETURN (false); |
2355 |
||
2356 |
case 0xFF: |
|
2357 |
if ((val >= 0xFF21) && (val <= 0xFF3A)) { RETURN (true); } |
|
2358 |
RETURN (false); |
|
2359 |
||
2360 |
case 0x104: |
|
2361 |
if (val <= 0x10427) { RETURN (true); } |
|
2362 |
RETURN (false); |
|
2363 |
||
2364 |
case 0x1D4: |
|
2365 |
case 0x1D5: |
|
2366 |
case 0x1D6: |
|
2367 |
if (val <= 0x1D419) { RETURN (true); } |
|
2368 |
if (val < 0x1D6be) { |
|
2369 |
if (((val - 0x1D41A) % 52) <= 25) { RETURN (false); } |
|
2370 |
RETURN (true); |
|
2371 |
} |
|
2372 |
if (val < 0x1D6c1) { RETURN (true); } |
|
2373 |
if (val < 0x1D6e2) { RETURN (false); } |
|
2374 |
if (val < 0x1D6fb) { RETURN (true); } |
|
2375 |
||
2376 |
RETURN (false); |
|
7979
7515722ccfb1
isUppercase / isLowercase fix for division character.
Claus Gittinger <cg@exept.de>
parents:
7976
diff
changeset
|
2377 |
} |
7988
cb1c920e67eb
isUppercase / isLowercase unicode changes
Claus Gittinger <cg@exept.de>
parents:
7987
diff
changeset
|
2378 |
RETURN (false); |
7985 | 2379 |
|
9153 | 2380 |
#undef TRUE_IF_ODD |
2381 |
#undef TRUE_IF_EVEN |
|
7988
cb1c920e67eb
isUppercase / isLowercase unicode changes
Claus Gittinger <cg@exept.de>
parents:
7987
diff
changeset
|
2382 |
%} |
1 | 2383 |
! |
2384 |
||
699 | 2385 |
isVowel |
2386 |
"return true, if I am a vowel (lower- or uppercase)" |
|
333 | 2387 |
|
6066 | 2388 |
"/ I know the code is ugly; |
2389 |
"/ better code is: |
|
2390 |
"/ 'aeiou' includes:self asLowercase |
|
2391 |
"/ or: |
|
2392 |
"/ 'aeiouAEIOU' includes:self |
|
2393 |
"/ |
|
2394 |
"/ until I have a smart compiler, I use the shorter (codewise): |
|
2395 |
||
699 | 2396 |
(self == $a) ifTrue:[^ true]. |
2397 |
(self == $e) ifTrue:[^ true]. |
|
2398 |
(self == $i) ifTrue:[^ true]. |
|
2399 |
(self == $o) ifTrue:[^ true]. |
|
2400 |
(self == $u) ifTrue:[^ true]. |
|
2401 |
(self == $A) ifTrue:[^ true]. |
|
2402 |
(self == $E) ifTrue:[^ true]. |
|
2403 |
(self == $I) ifTrue:[^ true]. |
|
2404 |
(self == $O) ifTrue:[^ true]. |
|
2405 |
(self == $U) ifTrue:[^ true]. |
|
2406 |
^ false |
|
1 | 2407 |
! ! |
699 | 2408 |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2409 |
!Character methodsFor:'testing - national'! |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2410 |
|
17188 | 2411 |
asNonDiacritical |
2412 |
"return a new character which represents the receiver without diacritics. |
|
2413 |
This is used with string search and when lists are to be ordered/sorted by base character order. |
|
2414 |
CAVEAT: |
|
18215 | 2415 |
for now, this method is only correct for unicode characters up to u+2FF, |
2416 |
i.e. latin languages" |
|
17188 | 2417 |
|
2418 |
%{ /* NOCONTEXT */ |
|
2419 |
||
2420 |
REGISTER INT val; |
|
2421 |
||
2422 |
/* because used so often, this is open coded, instead of table driven */ |
|
2423 |
val = __intVal(__INST(asciivalue)); |
|
2424 |
switch (val >> 8) { |
|
18215 | 2425 |
case 0x00: |
2426 |
if (val < 0xC0) { RETURN(self); } |
|
2427 |
if (val <= 0xC6) { val = 'A'; break; } |
|
2428 |
if (val == 0xC7) { val = 'C'; break; } |
|
2429 |
if (val <= 0xCB) { val = 'E'; break; } |
|
2430 |
if (val <= 0xCF) { val = 'I'; break; } |
|
2431 |
if (val == 0xD0) { val = 'D'; break; } |
|
2432 |
if (val == 0xD1) { val = 'N'; break; } |
|
2433 |
if (val <= 0xD6) { val = 'O'; break; } |
|
2434 |
if (val == 0xD7) { RETURN(self) } |
|
2435 |
if (val == 0xD8) { val = 'O'; break; } |
|
2436 |
if (val <= 0xDC) { val = 'U'; break; } |
|
2437 |
if (val == 0xDD) { val = 'Y'; break; } |
|
2438 |
||
2439 |
if (val < 0xE0) { RETURN(self) } |
|
2440 |
if (val <= 0xE6) { val = 'a'; break; } |
|
2441 |
if (val == 0xE7) { val = 'c'; break; } |
|
2442 |
if (val <= 0xEB) { val = 'e'; break; } |
|
2443 |
if (val <= 0xEF) { val = 'i'; break; } |
|
2444 |
if (val == 0xF0) { val = 'd'; break; } |
|
2445 |
if (val == 0xF1) { val = 'n'; break; } |
|
2446 |
if (val <= 0xF6) { val = 'o'; break; } |
|
2447 |
if (val == 0xF7) { RETURN(self) } |
|
2448 |
if (val == 0xF8) { val = 'o'; break; } |
|
2449 |
if (val <= 0xFC) { val = 'u'; break; } |
|
2450 |
if (val == 0xFD) { val = 'y'; break; } |
|
2451 |
if (val == 0xFF) { val = 'y'; break; } |
|
2452 |
RETURN (self); |
|
2453 |
||
2454 |
case 0x01: |
|
2455 |
if (val <= 0x105) { val = (val & 1) ? 'a' : 'A'; break; } |
|
2456 |
if (val <= 0x10D) { val = (val & 1) ? 'c' : 'C'; break; } |
|
2457 |
if (val <= 0x111) { val = (val & 1) ? 'd' : 'D'; break; } |
|
2458 |
if (val <= 0x11B) { val = (val & 1) ? 'e' : 'E'; break; } |
|
2459 |
if (val <= 0x123) { val = (val & 1) ? 'g' : 'G'; break; } |
|
2460 |
if (val <= 0x127) { val = (val & 1) ? 'h' : 'H'; break; } |
|
2461 |
if (val <= 0x133) { val = (val & 1) ? 'i' : 'I'; break; } |
|
2462 |
if (val <= 0x137) { val = (val & 1) ? 'k' : 'K'; break; } |
|
2463 |
if (val == 0x138) { val = 'K'; break; } |
|
2464 |
if (val <= 0x142) { val = (val & 1) ? 'L' : 'l'; break; } |
|
2465 |
if (val <= 0x148) { val = (val & 1) ? 'N' : 'n'; break; } |
|
2466 |
if (val <= 0x14B) { val = (val & 1) ? 'n' : 'N'; break; } |
|
2467 |
if (val <= 0x153) { val = (val & 1) ? 'o' : 'O'; break; } |
|
2468 |
if (val <= 0x159) { val = (val & 1) ? 'r' : 'R'; break; } |
|
2469 |
if (val <= 0x161) { val = (val & 1) ? 's' : 'S'; break; } |
|
2470 |
if (val <= 0x167) { val = (val & 1) ? 't' : 'T'; break; } |
|
2471 |
if (val <= 0x173) { val = (val & 1) ? 'u' : 'U'; break; } |
|
2472 |
if (val <= 0x175) { val = (val & 1) ? 'w' : 'W'; break; } |
|
2473 |
if (val <= 0x178) { val = (val & 1) ? 'y' : 'Y'; break; } |
|
2474 |
if (val <= 0x17E) { val = (val & 1) ? 'Z' : 'z'; break; } |
|
2475 |
RETURN (self); |
|
2476 |
||
2477 |
case 0x02: |
|
2478 |
if (val <= 0x203) { val = (val & 1) ? 'a' : 'A'; break; } |
|
2479 |
if (val <= 0x207) { val = (val & 1) ? 'e' : 'E'; break; } |
|
2480 |
if (val <= 0x20B) { val = (val & 1) ? 'i' : 'I'; break; } |
|
2481 |
if (val <= 0x20F) { val = (val & 1) ? 'o' : 'O'; break; } |
|
2482 |
if (val <= 0x213) { val = (val & 1) ? 'r' : 'R'; break; } |
|
2483 |
if (val <= 0x217) { val = (val & 1) ? 'u' : 'U'; break; } |
|
2484 |
if (val <= 0x219) { val = (val & 1) ? 's' : 'S'; break; } |
|
2485 |
if (val <= 0x21B) { val = (val & 1) ? 't' : 'T'; break; } |
|
2486 |
RETURN (self); |
|
2487 |
||
2488 |
case 0x03: |
|
2489 |
// to be done |
|
2490 |
RETURN (self); |
|
2491 |
||
2492 |
case 0x04: |
|
2493 |
// to be done |
|
2494 |
RETURN (self); |
|
17188 | 2495 |
} |
2496 |
if (val <= MAX_IMMEDIATE_CHARACTER) { |
|
18215 | 2497 |
RETURN (__MKCHARACTER(val)) ; |
17188 | 2498 |
} |
2499 |
RETURN (__MKUCHARACTER(val)) ; |
|
2500 |
%} |
|
2501 |
||
2502 |
" |
|
2503 |
$e asNonDiacritical |
|
2504 |
$é asNonDiacritical |
|
2505 |
$ä asNonDiacritical |
|
2506 |
$å asNonDiacritical |
|
2507 |
" |
|
2508 |
! |
|
2509 |
||
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2510 |
isNationalAlphaNumeric |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2511 |
"return true, if the receiver is a letter or digit in the |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2512 |
current language (Language variable)" |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2513 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2514 |
self isNationalLetter ifTrue:[^ true]. |
9153 | 2515 |
^ self isNationalDigit |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2516 |
! |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2517 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2518 |
isNationalDigit |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2519 |
"return true, if the receiver is a digit. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2520 |
This assumes unicode encoding. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2521 |
WARNING: this method is not complete." |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2522 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2523 |
|codePoint "{ Class SmallInteger }"| |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2524 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2525 |
codePoint := asciivalue. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2526 |
|
9153 | 2527 |
codePoint <= 16rFF ifTrue:[ "/ u00xx - unicode latin1 page |
2528 |
(codePoint between:($0 codePoint) and:($9 codePoint)) ifTrue:[^ true]. |
|
2529 |
^ false |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2530 |
]. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2531 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2532 |
(codePoint between:16rFF10 and:16rFF19) ifTrue:[ ^ true]. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2533 |
^ false. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2534 |
! |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2535 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2536 |
isNationalLetter |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2537 |
"return true, if the receiver is a letter. |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2538 |
CAVEAT: |
9153 | 2539 |
for now, this method is only correct for unicode characters up to u+1d6ff (Unicode3.1). |
2540 |
(which is more than mozilla does, btw. ;-)" |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2541 |
|
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2542 |
%{ /* NOCONTEXT */ |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2543 |
|
14684 | 2544 |
REGISTER INT val; |
2545 |
||
2546 |
/* because used so often, this is open coded, instead of table driven */ |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2547 |
val = __intVal(__INST(asciivalue)); |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2548 |
switch (val >> 8) { |
9153 | 2549 |
case 0x00: |
14684 | 2550 |
if ((unsigned INT)(val - 'A') <= ('Z' - 'A')) { |
9153 | 2551 |
RETURN ( true ); |
2552 |
} |
|
14684 | 2553 |
if ((unsigned INT)(val - 'a') <= ('z' - 'a')) { |
9153 | 2554 |
RETURN ( true ); |
2555 |
} |
|
2556 |
if (val == 0xAA) { RETURN (true); } |
|
2557 |
if (val == 0xB5) { RETURN (true); } |
|
2558 |
if (val == 0xBA) { RETURN (true); } |
|
2559 |
if (val < 0xC0) { RETURN (false); } |
|
2560 |
if (val == 0xD7) { RETURN (false); } |
|
2561 |
if (val == 0xF7) { RETURN (false); } |
|
2562 |
RETURN (true); |
|
2563 |
||
2564 |
case 0x01: |
|
2565 |
RETURN (true); |
|
2566 |
||
2567 |
case 0x02: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2568 |
#ifdef UNICODE_3_2 |
9153 | 2569 |
if (val <= 0x2B8) { RETURN (true); } |
2570 |
if (val == 0x2B9) { RETURN (false); } |
|
2571 |
if (val == 0x2BA) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2572 |
#else |
9153 | 2573 |
if (val <= 0x2BA) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2574 |
#endif |
9153 | 2575 |
if (val <= 0x2C1) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2576 |
#ifndef UNICODE_3_2 |
9153 | 2577 |
if (val <= 0x2C5) { RETURN (false); } |
2578 |
if (val <= 0x2CF) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2579 |
#endif |
9153 | 2580 |
if (val == 0x2D0) { RETURN (true); } |
2581 |
if (val == 0x2D1) { RETURN (true); } |
|
2582 |
if (val <= 0x2DF) { RETURN (false); } |
|
2583 |
if (val <= 0x2E4) { RETURN (true); } |
|
2584 |
if (val == 0x2EE) { RETURN (true); } |
|
2585 |
RETURN (false); |
|
2586 |
||
2587 |
case 0x03: |
|
2588 |
if (val == 0x37A) { RETURN (true); } |
|
2589 |
if (val <= 0x385) { RETURN (false); } |
|
2590 |
if (val == 0x387) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2591 |
#ifndef UNICODE_3_2 |
9153 | 2592 |
if (val == 0x3F6) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2593 |
#endif |
9153 | 2594 |
RETURN (true); |
2595 |
||
2596 |
case 0x04: |
|
2597 |
if (val <= 0x481) { RETURN (true); } |
|
2598 |
if (val <= 0x486) { RETURN (false); } |
|
2599 |
if (val == 0x487) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2600 |
#ifdef UNICODE_3_2 |
9153 | 2601 |
if (val <= 0x48A) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2602 |
#else |
9153 | 2603 |
if (val <= 0x489) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2604 |
#endif |
9153 | 2605 |
RETURN (true); |
2606 |
||
2607 |
case 0x05: |
|
2608 |
if (val <= 0x50f) { RETURN (true); } |
|
2609 |
if (val <= 0x530) { RETURN (false); } |
|
2610 |
if (val <= 0x556) { RETURN (true); } |
|
2611 |
if (val <= 0x558) { RETURN (false); } |
|
2612 |
if (val <= 0x559) { RETURN (true); } |
|
2613 |
if (val <= 0x55F) { RETURN (false); } |
|
2614 |
if (val <= 0x587) { RETURN (true); } |
|
2615 |
if (val <= 0x5cf) { RETURN (false); } |
|
2616 |
if (val <= 0x5f2) { RETURN (true); } |
|
2617 |
RETURN (false); |
|
2618 |
||
2619 |
case 0x06: |
|
2620 |
if (val <= 0x620) { RETURN (false); } |
|
2621 |
if (val <= 0x64A) { RETURN (true); } |
|
2622 |
if (val <= 0x66D) { RETURN (false); } |
|
2623 |
if (val == 0x670) { RETURN (false); } |
|
2624 |
if (val <= 0x6D3) { RETURN (true); } |
|
2625 |
if (val == 0x6D5) { RETURN (true); } |
|
2626 |
if (val == 0x6E5) { RETURN (true); } |
|
2627 |
if (val == 0x6E6) { RETURN (true); } |
|
2628 |
if (val == 0x6EE) { RETURN (true); } |
|
2629 |
if (val == 0x6EF) { RETURN (true); } |
|
2630 |
if (val == 0x6FA) { RETURN (true); } |
|
2631 |
if (val == 0x6FB) { RETURN (true); } |
|
2632 |
if (val == 0x6FC) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2633 |
#ifndef UNICODE_3_2 |
9153 | 2634 |
if (val == 0x6FF) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2635 |
#endif |
9153 | 2636 |
RETURN (false); |
2637 |
||
2638 |
case 0x07: |
|
2639 |
if (val <= 0x70F) { RETURN (false); } |
|
2640 |
if (val == 0x711) { RETURN (false); } |
|
2641 |
if (val <= 0x72F) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2642 |
#ifdef UNICODE_3_2 |
9153 | 2643 |
if (val <= 0x74d) { RETURN (false); } |
2644 |
if (val <= 0x74e) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2645 |
#else |
9153 | 2646 |
if (val <= 0x74c) { RETURN (false); } |
2647 |
if (val <= 0x74f) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2648 |
#endif |
9153 | 2649 |
if (val <= 0x77F) { RETURN (false); } |
2650 |
if (val <= 0x7a5) { RETURN (true); } |
|
2651 |
if (val <= 0x7af) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2652 |
#ifndef UNICODE_3_2 |
9153 | 2653 |
if (val == 0x7B1) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2654 |
#endif |
9153 | 2655 |
RETURN (false); |
2656 |
||
2657 |
case 0x09: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2658 |
#ifdef UNICODE_3_2 |
9153 | 2659 |
if (val <= 0x904) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2660 |
#else |
9153 | 2661 |
if (val <= 0x903) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2662 |
#endif |
9153 | 2663 |
if (val <= 0x93B) { RETURN (true); } |
2664 |
if (val == 0x93D) { RETURN (true); } |
|
2665 |
if (val == 0x950) { RETURN (true); } |
|
2666 |
if (val <= 0x957) { RETURN (false); } |
|
2667 |
if (val <= 0x961) { RETURN (true); } |
|
2668 |
if (val <= 0x984) { RETURN (false); } |
|
2669 |
if (val <= 0x9BB) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2670 |
#ifndef UNICODE_3_2 |
9153 | 2671 |
if (val == 0x9BD) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2672 |
#endif |
9153 | 2673 |
if (val <= 0x9DB) { RETURN (false); } |
2674 |
if (val <= 0x9E1) { RETURN (true); } |
|
2675 |
if (val <= 0x9EF) { RETURN (false); } |
|
2676 |
if (val <= 0x9F1) { RETURN (true); } |
|
2677 |
RETURN (false); |
|
2678 |
||
2679 |
case 0x0A: |
|
2680 |
if (val <= 0xa04) { RETURN (false); } |
|
2681 |
if (val <= 0xa3B) { RETURN (true); } |
|
2682 |
if (val <= 0xa58) { RETURN (false); } |
|
2683 |
if (val <= 0xa65) { RETURN (true); } |
|
2684 |
if (val <= 0xa71) { RETURN (false); } |
|
2685 |
if (val <= 0xa80) { RETURN (true); } |
|
2686 |
if (val <= 0xa84) { RETURN (false); } |
|
2687 |
if (val <= 0xaBB) { RETURN (true); } |
|
2688 |
if (val == 0xaBD) { RETURN (true); } |
|
2689 |
if (val <= 0xaCF) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2690 |
#ifndef UNICODE_3_2 |
9153 | 2691 |
if (val == 0xAE2) { RETURN (false); } |
2692 |
if (val == 0xAE3) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2693 |
#endif |
9153 | 2694 |
if (val <= 0xaE5) { RETURN (true); } |
2695 |
RETURN (false); |
|
2696 |
||
2697 |
case 0x0B: |
|
2698 |
if (val <= 0xB04) { RETURN (false); } |
|
2699 |
if (val <= 0xb3B) { RETURN (true); } |
|
2700 |
if (val == 0xb3d) { RETURN (true); } |
|
2701 |
if (val <= 0xb5B) { RETURN (false); } |
|
2702 |
if (val <= 0xb65) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2703 |
#ifndef UNICODE_3_2 |
9153 | 2704 |
if (val == 0xB71) { RETURN (true); } |
2705 |
if (val == 0xB83) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2706 |
#endif |
9153 | 2707 |
if (val <= 0xb84) { RETURN (false); } |
2708 |
if (val <= 0xbBB) { RETURN (true); } |
|
2709 |
RETURN (false); |
|
2710 |
||
2711 |
case 0x0c: |
|
2712 |
if (val <= 0xc04) { RETURN (false); } |
|
2713 |
if (val <= 0xc3d) { RETURN (true); } |
|
2714 |
if (val <= 0xc5f) { RETURN (false); } |
|
2715 |
if (val <= 0xc65) { RETURN (true); } |
|
2716 |
if (val <= 0xc84) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2717 |
#ifndef UNICODE_3_2 |
9153 | 2718 |
if (val == 0xcbc) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2719 |
#endif |
9153 | 2720 |
if (val <= 0xcbd) { RETURN (true); } |
2721 |
if (val <= 0xcdc) { RETURN (false); } |
|
2722 |
if (val <= 0xce5) { RETURN (true); } |
|
2723 |
RETURN (false); |
|
2724 |
||
2725 |
case 0x0d: |
|
2726 |
if (val <= 0xd04) { RETURN (false); } |
|
2727 |
if (val <= 0xd3d) { RETURN (true); } |
|
2728 |
if (val <= 0xd5f) { RETURN (false); } |
|
2729 |
if (val <= 0xd65) { RETURN (true); } |
|
2730 |
if (val <= 0xd84) { RETURN (false); } |
|
2731 |
if (val <= 0xdc9) { RETURN (true); } |
|
2732 |
RETURN (false); |
|
2733 |
||
2734 |
case 0x0E: |
|
2735 |
if (val == 0xE31) { RETURN (false); } |
|
2736 |
if (val <= 0xE33) { RETURN (true); } |
|
2737 |
if (val <= 0xE3F) { RETURN (false); } |
|
2738 |
if (val <= 0xE46) { RETURN (true); } |
|
2739 |
if (val <= 0xE7f) { RETURN (false); } |
|
2740 |
if (val <= 0xEb0) { RETURN (true); } |
|
2741 |
if (val == 0xEb1) { RETURN (false); } |
|
2742 |
if (val <= 0xEb3) { RETURN (true); } |
|
2743 |
if (val <= 0xEbc) { RETURN (false); } |
|
2744 |
if (val <= 0xEc7) { RETURN (true); } |
|
2745 |
if (val <= 0xEdb) { RETURN (false); } |
|
2746 |
RETURN (true); |
|
2747 |
||
2748 |
case 0x0F: |
|
2749 |
if (val == 0xf00) { RETURN (true); } |
|
2750 |
if (val <= 0xf3F) { RETURN (false); } |
|
2751 |
if (val <= 0xf70) { RETURN (true); } |
|
2752 |
if (val <= 0xf87) { RETURN (false); } |
|
2753 |
if (val <= 0xf8f) { RETURN (true); } |
|
2754 |
RETURN (false); |
|
2755 |
||
2756 |
case 0x10: |
|
2757 |
if (val <= 0x102b) { RETURN (true); } |
|
2758 |
if (val <= 0x104f) { RETURN (false); } |
|
2759 |
if (val <= 0x1055) { RETURN (true); } |
|
2760 |
if (val <= 0x109f) { RETURN (false); } |
|
2761 |
if (val <= 0x10fa) { RETURN (true); } |
|
2762 |
RETURN (false); |
|
2763 |
||
2764 |
case 0x11: |
|
2765 |
case 0x12: |
|
2766 |
RETURN (true); |
|
2767 |
||
2768 |
case 0x13: |
|
2769 |
if (val <= 0x1360) { RETURN (true); } |
|
2770 |
if (val <= 0x139f) { RETURN (false); } |
|
2771 |
RETURN (true); |
|
2772 |
||
2773 |
case 0x14: |
|
2774 |
case 0x15: |
|
2775 |
RETURN (true); |
|
2776 |
||
2777 |
case 0x16: |
|
2778 |
if (val == 0x166d) { RETURN (false); } |
|
2779 |
if (val == 0x166e) { RETURN (false); } |
|
2780 |
if (val == 0x1680) { RETURN (false); } |
|
2781 |
if (val == 0x169b) { RETURN (false); } |
|
2782 |
if (val == 0x169c) { RETURN (false); } |
|
2783 |
if (val <= 0x16ea) { RETURN (true); } |
|
2784 |
RETURN (false); |
|
2785 |
||
2786 |
case 0x17: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2787 |
#ifndef UNICODE_3_2 |
9153 | 2788 |
if (val == 0x1712) { RETURN (false); } |
2789 |
if (val == 0x1713) { RETURN (false); } |
|
2790 |
if (val == 0x1714) { RETURN (false); } |
|
2791 |
if (val == 0x1732) { RETURN (false); } |
|
2792 |
if (val == 0x1733) { RETURN (false); } |
|
2793 |
if (val == 0x1734) { RETURN (false); } |
|
2794 |
if (val == 0x1735) { RETURN (false); } |
|
2795 |
if (val == 0x1736) { RETURN (false); } |
|
2796 |
if (val == 0x1752) { RETURN (false); } |
|
2797 |
if (val == 0x1753) { RETURN (false); } |
|
2798 |
if (val == 0x1772) { RETURN (false); } |
|
2799 |
if (val == 0x1773) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2800 |
#endif |
9153 | 2801 |
if (val <= 0x17b3) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2802 |
#ifndef UNICODE_3_2 |
9153 | 2803 |
if (val == 0x17D7) { RETURN (true); } |
2804 |
if (val == 0x17DC) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2805 |
#endif |
9153 | 2806 |
RETURN (false); |
2807 |
||
2808 |
case 0x18: |
|
2809 |
if (val <= 0x181f) { RETURN (false); } |
|
2810 |
if (val <= 0x18a8) { RETURN (true); } |
|
2811 |
RETURN (false); |
|
2812 |
||
2813 |
case 0x19: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2814 |
#ifndef UNICODE_3_2 |
9153 | 2815 |
if (val <= 0x191F) { RETURN (true); } |
2816 |
if (val <= 0x194F) { RETURN (false); } |
|
2817 |
if (val <= 0x197F) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2818 |
#endif |
9153 | 2819 |
RETURN (false); |
2820 |
||
2821 |
case 0x1d: |
|
2822 |
if (val = 0x1d00) { RETURN (true); } |
|
2823 |
RETURN (false); |
|
2824 |
||
2825 |
case 0x1e: |
|
2826 |
RETURN (true); |
|
2827 |
||
2828 |
case 0x1f: |
|
2829 |
if (val <= 0x1fbc) { RETURN (true); } |
|
2830 |
if (val == 0x1fbe) { RETURN (true); } |
|
2831 |
if (val <= 0x1fc1) { RETURN (false); } |
|
2832 |
if (val <= 0x1fcc) { RETURN (true); } |
|
2833 |
if (val <= 0x1fcf) { RETURN (false); } |
|
2834 |
if (val <= 0x1fdc) { RETURN (true); } |
|
2835 |
if (val <= 0x1fdf) { RETURN (false); } |
|
2836 |
if (val <= 0x1fec) { RETURN (true); } |
|
2837 |
if (val <= 0x1ff1) { RETURN (false); } |
|
2838 |
if (val <= 0x1ffc) { RETURN (true); } |
|
2839 |
RETURN (false); |
|
2840 |
||
2841 |
case 0x20: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2842 |
#ifndef UNICODE_3_2 |
9153 | 2843 |
if (val == 0x2071) { RETURN (true); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2844 |
#endif |
9153 | 2845 |
if (val == 0x207f) { RETURN (true); } |
2846 |
RETURN (false); |
|
2847 |
||
2848 |
case 0x21: |
|
2849 |
if (val == 0x2102) { RETURN (true); } |
|
2850 |
if (val == 0x2107) { RETURN (true); } |
|
2851 |
if (val <= 0x2109) { RETURN (false); } |
|
2852 |
if (val <= 0x2113) { RETURN (true); } |
|
2853 |
if (val == 0x2115) { RETURN (true); } |
|
2854 |
if (val <= 0x2118) { RETURN (false); } |
|
2855 |
if (val <= 0x211d) { RETURN (true); } |
|
2856 |
if (val <= 0x2123) { RETURN (false); } |
|
2857 |
if (val == 0x2125) { RETURN (false); } |
|
2858 |
if (val == 0x2127) { RETURN (false); } |
|
2859 |
if (val == 0x2129) { RETURN (false); } |
|
2860 |
if (val == 0x212E) { RETURN (false); } |
|
2861 |
if (val == 0x2132) { RETURN (false); } |
|
2862 |
if (val == 0x213A) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2863 |
#ifndef UNICODE_3_2 |
9153 | 2864 |
if (val == 0x213B) { RETURN (false); } |
2865 |
if (val <= 0x213F) { RETURN (true); } |
|
2866 |
if (val <= 0x2144) { RETURN (false); } |
|
2867 |
if (val == 0x214A) { RETURN (false); } |
|
2868 |
if (val == 0x214B) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2869 |
#endif |
9153 | 2870 |
if (val <= 0x2152) { RETURN (true); } |
2871 |
RETURN (false); |
|
2872 |
||
2873 |
case 0x30: |
|
2874 |
if (val == 0x3005) { RETURN (true); } |
|
2875 |
if (val == 0x3006) { RETURN (true); } |
|
2876 |
if (val <= 0x3030) { RETURN (false); } |
|
2877 |
if (val <= 0x3035) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2878 |
#ifndef UNICODE_3_2 |
9153 | 2879 |
if (val == 0x303B) { RETURN (true); } |
2880 |
if (val == 0x303C) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2881 |
#endif |
9153 | 2882 |
if (val <= 0x3040) { RETURN (false); } |
2883 |
if (val <= 0x3098) { RETURN (true); } |
|
2884 |
if (val <= 0x309c) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2885 |
#ifndef UNICODE_3_2 |
9153 | 2886 |
if (val == 0x30A0) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2887 |
#endif |
9153 | 2888 |
if (val == 0x30Fb) { RETURN (false); } |
2889 |
RETURN ((true)); |
|
2890 |
||
2891 |
case 0x31: |
|
2892 |
if (val <= 0x318f) { RETURN (true); } |
|
2893 |
if (val <= 0x319F) { RETURN (false); } |
|
2894 |
RETURN ((true)); |
|
2895 |
||
2896 |
case 0x34: |
|
2897 |
RETURN ((true)); |
|
2898 |
||
2899 |
case 0x4d: |
|
2900 |
if (val <= 0x4DB4) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2901 |
#ifndef UNICODE_3_2 |
9153 | 2902 |
if (val <= 0x4DBF) { RETURN (true); } |
2903 |
RETURN (false); |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2904 |
#else |
9153 | 2905 |
RETURN (true); |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2906 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2907 |
|
9153 | 2908 |
case 0x4e: |
2909 |
RETURN ((true)); |
|
2910 |
||
2911 |
case 0x9f: |
|
2912 |
if (val <= 0x9fa4) { RETURN (false); } |
|
2913 |
RETURN (true); |
|
2914 |
||
2915 |
case 0xA0: |
|
2916 |
case 0xA1: |
|
2917 |
case 0xA2: |
|
2918 |
case 0xA3: |
|
2919 |
RETURN (true); |
|
2920 |
||
2921 |
case 0xA4: |
|
2922 |
if (val <= 0xa48f) { RETURN (true); } |
|
2923 |
RETURN (false); |
|
2924 |
||
2925 |
case 0xA5: |
|
2926 |
RETURN (true); |
|
2927 |
||
2928 |
case 0xAC: |
|
2929 |
RETURN (true); |
|
2930 |
||
2931 |
case 0xD7: |
|
2932 |
RETURN (true); |
|
2933 |
||
2934 |
case 0xF9: |
|
2935 |
case 0xFA: |
|
2936 |
RETURN (true); |
|
2937 |
||
2938 |
case 0xFB: |
|
2939 |
if (val == 0xfb1e) { RETURN (false); } |
|
2940 |
if (val == 0xfb29) { RETURN (false); } |
|
2941 |
RETURN (true); |
|
2942 |
||
2943 |
case 0xFC: |
|
2944 |
RETURN (true); |
|
2945 |
||
2946 |
case 0xFD: |
|
2947 |
if (val <= 0xFD3d) { RETURN (true); } |
|
2948 |
if (val <= 0xFD4F) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2949 |
#ifndef UNICODE_3_2 |
9153 | 2950 |
if (val == 0xFDFC) { RETURN (false); } |
2951 |
if (val == 0xFDFD) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2952 |
#endif |
9153 | 2953 |
RETURN (true); |
2954 |
||
2955 |
case 0xFE: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2956 |
#ifndef UNICODE_3_2 |
9153 | 2957 |
if (val <= 0xFE0F) { RETURN (false); } |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2958 |
#endif |
9153 | 2959 |
if (val <= 0xFE1f) { RETURN (true); } |
2960 |
if (val <= 0xFE6F) { RETURN (false); } |
|
2961 |
if (val <= 0xFEFE) { RETURN (true); } |
|
2962 |
RETURN (false); |
|
2963 |
||
2964 |
case 0xFF: |
|
2965 |
if (val <= 0xFF20) { RETURN (false); } |
|
2966 |
if (val <= 0xFF3a) { RETURN (true); } |
|
2967 |
if (val <= 0xFF40) { RETURN (false); } |
|
2968 |
if (val <= 0xFF5a) { RETURN (true); } |
|
2969 |
if (val <= 0xFF65) { RETURN (false); } |
|
2970 |
if (val <= 0xFFdC) { RETURN (true); } |
|
2971 |
RETURN (false); |
|
2972 |
||
2973 |
case 0x100: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2974 |
#ifndef UNICODE_3_2 |
9153 | 2975 |
RETURN (true); |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2976 |
#else |
9153 | 2977 |
RETURN (false); |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2978 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2979 |
|
9153 | 2980 |
case 0x103: |
2981 |
if (val <= 0x1031f) { RETURN (true); } |
|
2982 |
if (val <= 0x1032F) { RETURN (false); } |
|
2983 |
if (val <= 0x10349) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2984 |
#ifndef UNICODE_3_2 |
9153 | 2985 |
if (val <= 0x1037F) { RETURN (false); } |
2986 |
if (val <= 0x1039E) { RETURN (true); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2987 |
#endif |
9153 | 2988 |
RETURN (false); |
2989 |
||
2990 |
case 0x104: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2991 |
#ifndef UNICODE_3_2 |
9153 | 2992 |
if (val <= 0x1049F) { RETURN (true); } |
2993 |
if (val <= 0x104aF) { RETURN (false); } |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2994 |
#endif |
9153 | 2995 |
RETURN (true); |
2996 |
||
2997 |
case 0x108: |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
2998 |
#ifndef UNICODE_3_2 |
9153 | 2999 |
RETURN (true); |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3000 |
#else |
9153 | 3001 |
RETURN (false); |
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3002 |
#endif |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3003 |
|
9153 | 3004 |
case 0x1D4: |
3005 |
case 0x1D5: |
|
3006 |
RETURN (true); |
|
3007 |
||
3008 |
case 0x1D6: |
|
3009 |
if (val == 0x1d6c1) { RETURN (false); } |
|
3010 |
if (val == 0x1d6db) { RETURN (false); } |
|
3011 |
if (val == 0x1d6fb) { RETURN (false); } |
|
3012 |
RETURN (true); |
|
8030
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3013 |
} |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3014 |
RETURN (false); |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3015 |
%} |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3016 |
! ! |
5a4323d0280f
updated to Unicode4.0.0 spec
Claus Gittinger <cg@exept.de>
parents:
8029
diff
changeset
|
3017 |
|
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3018 |
!Character methodsFor:'tracing'! |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3019 |
|
4682 | 3020 |
traceInto:aRequestor level:level from:referrer |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3021 |
"double dispatch into tracer, passing my type implicitely in the selector" |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3022 |
|
4682 | 3023 |
^ aRequestor traceCharacter:self level:level from:referrer |
4655
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3024 |
|
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3025 |
! ! |
b9405ca0bb4e
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4340
diff
changeset
|
3026 |
|
8394
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3027 |
!Character methodsFor:'visiting'! |
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3028 |
|
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3029 |
acceptVisitor:aVisitor with:aParameter |
16727 | 3030 |
"dispatch for visitor pattern; send #visitCharacter:with: to aVisitor" |
8394
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3031 |
|
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3032 |
^ aVisitor visitCharacter:self with:aParameter |
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3033 |
! ! |
da194de43766
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8308
diff
changeset
|
3034 |
|
2124 | 3035 |
!Character class methodsFor:'documentation'! |
699 | 3036 |
|
3037 |
version |
|
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
3038 |
^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.161 2015-04-20 10:48:54 cg Exp $' |
14120
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
3039 |
! |
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
3040 |
|
fdf215af772c
added: #displayOn: (instead of #displaySting)
Stefan Vogel <sv@exept.de>
parents:
14117
diff
changeset
|
3041 |
version_CVS |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18215
diff
changeset
|
3042 |
^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.161 2015-04-20 10:48:54 cg Exp $' |
699 | 3043 |
! ! |