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