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