author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 19 Jan 2012 11:46:00 +0000 | |
branch | jv |
changeset 17911 | a99f15c5efa5 |
parent 17910 | 8d796ca8bd1d |
child 17940 | 985e22966acb |
permissions | -rw-r--r-- |
8148 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
||
8081 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
15 |
"{ NameSpace: CharacterEncoderImplementations }" |
|
16 |
||
17 |
TwoByteEncoder subclass:#JIS0208_to_JIS7 |
|
18 |
instanceVariableNames:'' |
|
19 |
classVariableNames:'Jis7KanjiEscapeSequence Jis7RomanEscapeSequence |
|
20 |
JisISO2022EscapeSequence Jis7KanjiOldEscapeSequence' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Collections-Text-Encodings' |
|
23 |
! |
|
24 |
||
25 |
!JIS0208_to_JIS7 class methodsFor:'documentation'! |
|
26 |
||
8148 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
8081 | 41 |
examples |
42 |
" |
|
43 |
Encoding (jis0208 to jis-7) |
|
44 |
|t| |
|
45 |
||
46 |
t := JIS0208_to_JIS7 decodeString:'hello'. |
|
47 |
JIS0208_to_JIS7 encodeString:t. |
|
48 |
||
49 |
||
50 |
||
51 |
Decoding (jis-7 to jis0208): |
|
52 |
||
53 |
JIS0208_to_JIS7 decodeString:'hello' |
|
54 |
||
55 |
ending with a crippled escape: |
|
56 |
||
57 |
|s| |
|
58 |
s := 'hello' copyWith:Character esc. |
|
59 |
JIS0208_to_JIS7 decodeString:s |
|
60 |
||
61 |
|s| |
|
62 |
s := 'hello' copyWith:Character esc. |
|
63 |
s := s copyWith:$A. |
|
64 |
JIS0208_to_JIS7 decodeString:s |
|
65 |
||
66 |
|s| |
|
67 |
s := 'hello' copyWith:Character esc. |
|
68 |
s := s copyWith:$$. |
|
69 |
JIS0208_to_JIS7 decodeString:s |
|
70 |
||
71 |
|s| |
|
72 |
s := 'hello' copyWith:Character esc. |
|
73 |
s := s copyWith:$$. |
|
74 |
s := s copyWith:$A. |
|
75 |
JIS0208_to_JIS7 decodeString:s |
|
76 |
||
77 |
ending with a KANJI-in, but no more chars: |
|
78 |
||
79 |
|s| |
|
80 |
s := 'hello' copyWith:Character esc. |
|
81 |
s := s copyWith:$$. |
|
82 |
s := s copyWith:$B. |
|
83 |
JIS0208_to_JIS7 decodeString:s |
|
84 |
||
85 |
ending with a KANJI-in, followed by $3 (KO): |
|
86 |
||
87 |
|s| |
|
88 |
s := 'hello' copyWith:Character esc. |
|
89 |
s := s copyWith:$$. |
|
90 |
s := s copyWith:$B. |
|
91 |
s := s , '$3'. |
|
92 |
JIS0208_to_JIS7 decodeString:s |
|
93 |
||
94 |
ending with a KANJI-in, followed by $3$l$OF| (KO RE HA NI): |
|
95 |
||
96 |
|s| |
|
97 |
s := 'hello' copyWith:Character esc. |
|
98 |
s := s copyWith:$$. |
|
99 |
s := s copyWith:$B. |
|
100 |
s := s , '$3$l$OF|'. |
|
101 |
JIS0208_to_JIS7 decodeString:s |
|
102 |
||
103 |
a KO in between: |
|
104 |
||
105 |
|s| |
|
106 |
s := 'hello' copyWith:Character esc. |
|
107 |
s := s copyWith:$$. |
|
108 |
s := s copyWith:$B. |
|
109 |
s := s , '$3'. |
|
110 |
s := s copyWith:Character esc. |
|
111 |
s := s copyWith:$(. |
|
112 |
s := s copyWith:$B. |
|
113 |
s := s , 'hello'. |
|
114 |
JIS0208_to_JIS7 decodeString:s |
|
115 |
||
116 |
I dont know what that means ;-): |
|
117 |
||
118 |
|s t l| |
|
119 |
s := 'kterm ' copyWith:Character esc. |
|
120 |
s := s copyWith:$$. |
|
121 |
s := s copyWith:$B. |
|
122 |
s := s , '$N4A;zC<Kv%(%_%e%l!!<%?'. |
|
123 |
s := s copyWith:Character esc. |
|
124 |
s := s copyWith:$(. |
|
125 |
s := s copyWith:$B. |
|
126 |
s := s , ' kterm'. |
|
127 |
t := JIS0208_to_JIS7 decodeString:s. |
|
128 |
||
129 |
l := Label new. |
|
130 |
l label:t. |
|
131 |
l font:(Font family:'k14' face:nil style:nil size:nil). |
|
132 |
l font:(Font family:'gothic' size:17). |
|
133 |
l font:(Font family:'mincho' size:23). |
|
134 |
l realize |
|
135 |
" |
|
136 |
! ! |
|
137 |
||
138 |
!JIS0208_to_JIS7 class methodsFor:'queries'! |
|
139 |
||
140 |
nameOfDecodedCode |
|
141 |
"I encode jis0208 into jis7 and vice versa" |
|
142 |
||
143 |
^ #'jis0208' |
|
144 |
! ! |
|
145 |
||
146 |
!JIS0208_to_JIS7 methodsFor:'encoding & decoding'! |
|
147 |
||
148 |
decode:aCode |
|
149 |
self shouldNotImplement "/ no single byte conversion possible |
|
150 |
! |
|
151 |
||
152 |
decodeString:aString |
|
153 |
"given a string in JIS7 encoding, |
|
154 |
return a new string containing the same characters, in JIS0208 encoding. |
|
155 |
The argument is interpreted as a JIS7 or ISO2022-JP encoded singleByte string. |
|
156 |
There are various JIS encodings around (New-JIS, Old-JIS, NEC-JIS and ISO2022); |
|
157 |
this one understands New-JIS, ISO2022 and treats Old-JIS just the same. |
|
158 |
This conversion is only needed to convert strings as read from some external file. |
|
159 |
||
160 |
If you work a lot with jis7 encoded textFiles, |
|
161 |
this is a first-class candidate for a primitive." |
|
162 |
||
163 |
|newString |
|
164 |
sz "{ Class: SmallInteger }" |
|
165 |
dstIdx "{ Class: SmallInteger }" |
|
166 |
start "{ Class: SmallInteger }" |
|
167 |
stop "{ Class: SmallInteger }" |
|
168 |
n1 n2 n3 |
|
169 |
b1 "{ Class: SmallInteger }" |
|
170 |
b2 "{ Class: SmallInteger }" |
|
171 |
val "{ Class: SmallInteger }" |
|
172 |
singleBytes katakana c| |
|
173 |
||
174 |
sz := aString size. |
|
175 |
newString := JISEncodedString new:sz. |
|
176 |
sz ~~ 0 ifTrue:[ |
|
177 |
dstIdx := 1. |
|
178 |
start := 1. |
|
179 |
singleBytes := true. |
|
180 |
katakana := false. |
|
181 |
||
182 |
[true] whileTrue:[ |
|
183 |
"/ |
|
184 |
"/ scan for next escape" |
|
185 |
"/ |
|
186 |
stop := aString indexOf:(Character esc) startingAt:start. |
|
187 |
stop == 0 ifTrue:[ |
|
188 |
stop := sz + 1. |
|
189 |
] ifFalse:[ |
|
190 |
(stop + 2) > sz ifTrue:[ |
|
191 |
stop := sz + 1. |
|
192 |
] |
|
193 |
]. |
|
194 |
singleBytes ifTrue:[ |
|
195 |
start to:(stop - 1) do:[:i | |
|
196 |
c := aString at:i. |
|
197 |
newString at:dstIdx put:c. |
|
198 |
dstIdx := dstIdx + 1. |
|
199 |
]. |
|
200 |
] ifFalse:[ |
|
201 |
start to:(stop - 2) by:2 do:[:i | |
|
8103
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
202 |
b1 := (aString at:i) codePoint. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
203 |
b2 := (aString at:i+1) codePoint. |
8081 | 204 |
val := (b1 bitShift:8) bitOr:b2. |
205 |
newString at:dstIdx put:(Character value:val). |
|
206 |
dstIdx := dstIdx + 1. |
|
207 |
] |
|
208 |
]. |
|
209 |
||
210 |
stop > sz ifTrue:[ |
|
211 |
^ newString copyFrom:1 to:dstIdx - 1. |
|
212 |
]. |
|
213 |
start := stop. |
|
214 |
||
215 |
"/ |
|
216 |
"/ found an escape (at start) |
|
217 |
"/ - check for KI (<ESC> '$' 'B') or OLD-JIS-KI (<ESC> '$' '@') |
|
218 |
"/ and KO(ASCII) (<ESC> '(' 'B') or KO(ROMAN) (<ESC> '(' 'J') |
|
219 |
"/ |
|
220 |
n1 := aString at:start. |
|
221 |
n2 := aString at:(start + 1). |
|
222 |
n3 := aString at:(start + 2). |
|
223 |
katakana := false. |
|
224 |
||
225 |
(n2 == $$ and:[n3 == $B ]) ifTrue:[ |
|
226 |
singleBytes := false. |
|
227 |
] ifFalse:[ |
|
228 |
(n2 == $$ and:[n3 == $@ ]) ifTrue:[ |
|
229 |
singleBytes := false. |
|
230 |
] ifFalse:[ |
|
231 |
(n2 == $( and:[n3 == $B ]) ifTrue:[ |
|
232 |
singleBytes := true. |
|
233 |
] ifFalse:[ |
|
234 |
(n2 == $( and:[n3 == $J ]) ifTrue:[ |
|
235 |
singleBytes := true. |
|
236 |
] ifFalse:[ |
|
237 |
(n2 == $( and:[n3 == $I ]) ifTrue:[ |
|
238 |
singleBytes := true. |
|
239 |
katakana := true. |
|
240 |
] ifFalse:[ |
|
241 |
singleBytes ifTrue:[ |
|
242 |
newString at:dstIdx put:n1. |
|
243 |
newString at:(dstIdx + 1) put:n2. |
|
244 |
newString at:(dstIdx + 2) put:n3. |
|
245 |
dstIdx := dstIdx + 3. |
|
246 |
] ifFalse:[ |
|
247 |
DecodingError |
|
248 |
raiseWith:aString |
|
249 |
errorString:'JIS7 decoding failed (not JIS7 encoded ?)'. |
|
250 |
newString at:dstIdx put:n1. |
|
251 |
newString at:(dstIdx + 1) put:n2. |
|
252 |
newString at:(dstIdx + 2) put:n3. |
|
253 |
dstIdx := dstIdx + 3. |
|
254 |
] |
|
255 |
] |
|
256 |
] |
|
257 |
] |
|
258 |
] |
|
259 |
]. |
|
260 |
start := start + 3. |
|
261 |
start > sz ifTrue:[ |
|
262 |
^ newString copyFrom:1 to:dstIdx-1. |
|
263 |
] |
|
264 |
] |
|
265 |
]. |
|
266 |
^ newString |
|
267 |
! |
|
268 |
||
269 |
encode:aCode |
|
270 |
self shouldNotImplement "/ no single byte conversion possible |
|
271 |
! |
|
272 |
||
273 |
encodeString:aJISString |
|
274 |
"return a new string with aJISStrings characters as JIS7 encoded 7bit string, |
|
275 |
The receiver must be a JIS encoded character string. |
|
276 |
The resulting string is only useful to be stored on some external file, |
|
277 |
not for being used inside ST/X. |
|
278 |
||
279 |
If you work a lot with jis7 encoded textFiles, |
|
280 |
this is a first-class candidate for a primitive." |
|
281 |
||
282 |
|sz "{ Class:SmallInteger }" |
|
283 |
b1 "{ Class:SmallInteger }" |
|
284 |
val romans out inSingleByteMode c kanji roman val2| |
|
285 |
||
286 |
inSingleByteMode := true. |
|
8122 | 287 |
kanji := CharacterEncoder jis7KanjiEscapeSequence. |
288 |
roman := CharacterEncoder jis7RomanEscapeSequence. |
|
8081 | 289 |
|
8122 | 290 |
romans := CharacterEncoderImplementations::JIS0208 romanTable. |
8081 | 291 |
|
292 |
sz := aJISString size. |
|
293 |
sz == 0 ifTrue:[^ '']. |
|
294 |
||
295 |
out := WriteStream on:(String new:(sz * 2)). |
|
296 |
||
297 |
1 to:sz do:[:srcIndex | |
|
8103
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
298 |
c := aJISString at:srcIndex. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
299 |
b1 := c codePoint. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
300 |
b1 < 33 ifTrue:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
301 |
"/ a control character |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
302 |
inSingleByteMode ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
303 |
out nextPutAll:roman. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
304 |
inSingleByteMode := true |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
305 |
]. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
306 |
out nextPut:c. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
307 |
] ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
308 |
"/ check for a roman character |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
309 |
"/ the two numbers below are romanTable min and romanTable max |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
310 |
(b1 between:16r2121 and:16r2573) ifTrue:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
311 |
val := romans indexOf:b1. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
312 |
val2 := val - 1 + 32. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
313 |
(val ~~ 0 and:[val2 <= 16r7F]) ifTrue:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
314 |
inSingleByteMode ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
315 |
out nextPutAll:roman. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
316 |
inSingleByteMode := true |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
317 |
]. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
318 |
out nextPut:(Character value:val2) |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
319 |
] ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
320 |
inSingleByteMode ifTrue:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
321 |
out nextPutAll:kanji. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
322 |
inSingleByteMode := false |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
323 |
]. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
324 |
out nextPut:(Character value:(b1 bitShift:-8)). |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
325 |
out nextPut:(Character value:(b1 bitAnd:16rFF)). |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
326 |
]. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
327 |
] ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
328 |
b1 <= 255 ifTrue:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
329 |
"/ mhmh - unrepresentable roman (national chars) |
8081 | 330 |
"/ b1 >= 160 ifTrue:[ |
331 |
"/ ('no rep for ' , b1 printString) printNL. |
|
332 |
"/ ]. |
|
8103
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
333 |
"/ there are non-japanese characters in there... |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
334 |
"/ assume that is OK (leave as is) ... |
8081 | 335 |
"/ EncodingFailedError |
336 |
"/ raiseWith:aJISString |
|
337 |
"/ errorString:'JIS7 encoding failed (contains 8-bit characters ?)'. |
|
338 |
||
8103
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
339 |
inSingleByteMode ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
340 |
out nextPutAll:roman. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
341 |
inSingleByteMode := true |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
342 |
]. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
343 |
out nextPut:c |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
344 |
] ifFalse:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
345 |
inSingleByteMode ifTrue:[ |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
346 |
out nextPutAll:kanji. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
347 |
inSingleByteMode := false |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
348 |
]. |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
349 |
out nextPut:(Character value:(b1 bitShift:-8)). |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
350 |
out nextPut:(Character value:(b1 bitAnd:16rFF)). |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
351 |
] |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
352 |
] |
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
353 |
]. |
8081 | 354 |
]. |
355 |
inSingleByteMode ifFalse:[ |
|
8103
794d8e3f11d8
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
8081
diff
changeset
|
356 |
out nextPutAll:roman. |
8081 | 357 |
]. |
358 |
^ out contents |
|
359 |
||
360 |
"simple: |
|
361 |
||
362 |
JIS0208_to_JIS7 encodeString:(JISEncodedString encodeRomans:'hello') |
|
363 |
" |
|
364 |
! ! |
|
365 |
||
8163 | 366 |
!JIS0208_to_JIS7 methodsFor:'queries'! |
367 |
||
368 |
nameOfEncoding |
|
369 |
^ #'jis7' |
|
370 |
! ! |
|
371 |
||
8081 | 372 |
!JIS0208_to_JIS7 class methodsFor:'documentation'! |
373 |
||
374 |
version |
|
17892 | 375 |
^ '$Header: /cvs/stx/stx/libbasic/Encoder_JIS0208_to_JIS7.st,v 1.7 2004/03/12 09:15:11 ca Exp $' |
17846 | 376 |
! ! |
17892 | 377 |
|
17910 | 378 |
|
17911 | 379 |