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