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