TwoByteString.st
author Claus Gittinger <cg@exept.de>
Fri, 21 May 1999 12:10:11 +0200
changeset 4217 32983e39bb9e
parent 1382 93c125a594c3
child 4219 4f96dd118e81
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
235
d8e62525bfdf *** empty log message ***
claus
parents: 97
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
4217
32983e39bb9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
    13
CharacterArray variableWordSubclass:#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
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
89
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    20
!TwoByteString class methodsFor:'documentation'!
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    21
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    22
copyright
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    23
"
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    24
 COPYRIGHT (c) 1993 by Claus Gittinger
235
d8e62525bfdf *** empty log message ***
claus
parents: 97
diff changeset
    25
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
89
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    27
 This software is furnished under a license and may be used
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    28
 only in accordance with the terms of that license and with the
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    30
 be provided or otherwise made available to, or used by, any
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    31
 other person.  No title to or ownership of the software is
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    32
 hereby transferred.
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    33
"
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    34
!
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    35
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    36
documentation
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    37
"
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    38
    TwoByteStrings are like strings, but storing 16bits per character.
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    39
    The integration of them into the system is not completed ....
1290
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
    40
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
    41
    [author:]
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
    42
        Claus Gittinger
1309
24c98ca4a56d commentary
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    43
24c98ca4a56d commentary
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    44
    [see also:]
1382
93c125a594c3 xref in doku
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
    45
        Text JISEncodedString
1309
24c98ca4a56d commentary
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    46
        StringCollection
89
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    47
"
1214
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
    48
! !
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
    49
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
    50
!TwoByteString class methodsFor:'initialization'!
996
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    51
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    52
initialize
1253
7265cbaa8ec9 commentary
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
    53
    "initialize the class - private"
7265cbaa8ec9 commentary
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
    54
996
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    55
    self flags:(Behavior flagWords)
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    56
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    57
    "
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    58
     TwoByteString initialize
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
    59
    "
1214
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
    60
1253
7265cbaa8ec9 commentary
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
    61
    "Modified: 22.4.1996 / 16:14:14 / cg"
89
7be0b86ef80f *** empty log message ***
claus
parents: 73
diff changeset
    62
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    63
a27a279701f8 Initial revision
claus
parents:
diff changeset
    64
!TwoByteString class methodsFor:'instance creation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
a27a279701f8 Initial revision
claus
parents:
diff changeset
    66
basicNew:anInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
    67
    "return a new empty string with anInteger characters"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    68
1024
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    69
    ^ (super basicNew:anInteger) atAllPut:(Character space)
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    70
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    71
    "Modified: 26.2.1996 / 14:38:47 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    72
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
    73
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
!TwoByteString methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    75
a27a279701f8 Initial revision
claus
parents:
diff changeset
    76
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
    77
    "return the character at position index, an Integer
73
a6640cc96199 *** empty log message ***
claus
parents: 63
diff changeset
    78
     - reimplemented here since we return 16-bit characters"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    79
1024
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    80
    |val|
63
1f0cdefb013f *** empty log message ***
claus
parents: 33
diff changeset
    81
1024
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    82
    val := super basicAt:index.
63
1f0cdefb013f *** empty log message ***
claus
parents: 33
diff changeset
    83
    ^ Character value:val
1024
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    84
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    85
    "Modified: 26.2.1996 / 17:02:16 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    86
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
basicAt:index put:aCharacter
1230
c349c4e9e594 commentary
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
    89
    "store the argument, aCharacter at position index, an Integer.
c349c4e9e594 commentary
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
    90
     Returns aCharacter (sigh).
73
a6640cc96199 *** empty log message ***
claus
parents: 63
diff changeset
    91
     - reimplemented here since we store 16-bit characters"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
1024
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    93
    |val|
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    94
63
1f0cdefb013f *** empty log message ***
claus
parents: 33
diff changeset
    95
    val := aCharacter asciiValue.
1024
9a14acfb50ee 16bit coding
Claus Gittinger <cg@exept.de>
parents: 1017
diff changeset
    96
    super basicAt:index put:val.
63
1f0cdefb013f *** empty log message ***
claus
parents: 33
diff changeset
    97
    ^ aCharacter
608
cd5ac440fa95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    98
1230
c349c4e9e594 commentary
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
    99
    "Modified: 19.4.1996 / 11:16:22 / cg"
1014
da30760cfd3e dummy encoding support
Claus Gittinger <cg@exept.de>
parents: 996
diff changeset
   100
! !
da30760cfd3e dummy encoding support
Claus Gittinger <cg@exept.de>
parents: 996
diff changeset
   101
608
cd5ac440fa95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   102
!TwoByteString methodsFor:'queries'!
cd5ac440fa95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   103
1017
2665a2628779 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   104
bitsPerCharacter
1239
91a688ac83de commentary
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   105
    "return the number of bits each character has.
91a688ac83de commentary
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   106
     Here, 16 is returned (storing double byte characters)."
91a688ac83de commentary
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   107
1017
2665a2628779 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   108
    ^ 16
1239
91a688ac83de commentary
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   109
91a688ac83de commentary
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
   110
    "Modified: 20.4.1996 / 23:08:38 / cg"
608
cd5ac440fa95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   111
! !
cd5ac440fa95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   112
631
d43deb0ec558 version at the end
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   113
!TwoByteString class methodsFor:'documentation'!
d43deb0ec558 version at the end
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   114
d43deb0ec558 version at the end
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   115
version
4217
32983e39bb9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
   116
    ^ '$Header: /cvs/stx/stx/libbasic/TwoByteString.st,v 1.28 1999-05-21 10:10:11 cg Exp $'
631
d43deb0ec558 version at the end
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   117
! !
996
560a05298da9 I really store shorts ...
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
   118
TwoByteString initialize!