author | Claus Gittinger <cg@exept.de> |
Fri, 23 Feb 1996 03:20:22 +0100 | |
changeset 996 | 560a05298da9 |
parent 992 | f456f8f7d421 |
child 1014 | da30760cfd3e |
permissions | -rw-r--r-- |
1 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
235 | 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 |
" |
|
12 |
||
256 | 13 |
CharacterArray subclass:#TwoByteString |
992
f456f8f7d421
JIS decode now in CharacterArray
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
14 |
instanceVariableNames:'' |
f456f8f7d421
JIS decode now in CharacterArray
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
15 |
classVariableNames:'' |
f456f8f7d421
JIS decode now in CharacterArray
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
16 |
poolDictionaries:'' |
f456f8f7d421
JIS decode now in CharacterArray
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
17 |
category:'Collections-Text' |
1 | 18 |
! |
19 |
||
89 | 20 |
!TwoByteString class methodsFor:'documentation'! |
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
235 | 25 |
All Rights Reserved |
1 | 26 |
|
89 | 27 |
This software is furnished under a license and may be used |
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
TwoByteStrings are like strings, but storing 16bits per character. |
|
39 |
The integration of them into the system is not completed .... |
|
40 |
" |
|
996 | 41 |
! |
42 |
||
43 |
initialize |
|
44 |
self flags:(Behavior flagWords) |
|
45 |
||
46 |
" |
|
47 |
TwoByteString initialize |
|
48 |
" |
|
89 | 49 |
! ! |
1 | 50 |
|
51 |
!TwoByteString class methodsFor:'instance creation'! |
|
52 |
||
53 |
basicNew:anInteger |
|
54 |
"return a new empty string with anInteger characters" |
|
55 |
||
63 | 56 |
^ (super basicNew:(anInteger*2)) atAllPut:(Character space) |
1 | 57 |
! ! |
58 |
||
59 |
!TwoByteString methodsFor:'accessing'! |
|
60 |
||
61 |
basicAt:index |
|
62 |
"return the character at position index, an Integer |
|
73 | 63 |
- reimplemented here since we return 16-bit characters" |
1 | 64 |
|
63 | 65 |
|val i| |
66 |
||
67 |
i := (index * 2) - 1. |
|
73 | 68 |
"always msb first" |
69 |
val := (super basicAt:(i+1)) + ((super basicAt:i) * 256). |
|
63 | 70 |
^ Character value:val |
1 | 71 |
! |
72 |
||
73 |
basicAt:index put:aCharacter |
|
74 |
"store the argument, aCharacter at position index, an Integer |
|
73 | 75 |
- reimplemented here since we store 16-bit characters" |
1 | 76 |
|
63 | 77 |
|val i| |
78 |
val := aCharacter asciiValue. |
|
79 |
i := (index * 2) - 1. |
|
73 | 80 |
"always msb first" |
81 |
super basicAt:(i+1) put:(val bitAnd:16rFF). |
|
82 |
super basicAt:i put:(val // 256). |
|
63 | 83 |
^ aCharacter |
1 | 84 |
! ! |
608 | 85 |
|
86 |
!TwoByteString methodsFor:'queries'! |
|
87 |
||
88 |
basicSize |
|
89 |
"return the size of the receiver. |
|
90 |
(i.e. the number of characters in this String)" |
|
91 |
||
92 |
^ super basicSize // 2 |
|
93 |
! ! |
|
94 |
||
631 | 95 |
!TwoByteString class methodsFor:'documentation'! |
96 |
||
97 |
version |
|
996 | 98 |
^ '$Header: /cvs/stx/stx/libbasic/TwoByteString.st,v 1.17 1996-02-23 02:20:22 cg Exp $' |
631 | 99 |
! ! |
996 | 100 |
TwoByteString initialize! |