'From etoys2.3 of 28 November 2007 [latest update: #1820] on 6 December 2007 at 12:20:57 am'! "Change Set: GreekEnviron-yo Date: 5 December 2007 Author: Yoshiki Ohshima An experimental version of Greek support."! ClipboardInterpreter subclass: #CP1253ClipboardInterpreter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! KeyboardInputInterpreter subclass: #CP1253InputInterpreter instanceVariableNames: 'converter' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! ClipboardInterpreter subclass: #ISO88597ClipboardInterpreter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! KeyboardInputInterpreter subclass: #ISO88597InputInterpreter instanceVariableNames: 'converter' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! UTF32InputInterpreter subclass: #UTF32GreekInputInterpreter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! UTF8ClipboardInterpreter subclass: #UTF8GreekClipboardInterpreter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! !CP1253ClipboardInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 3/31/2007 13:04'! fromSystemClipboard: aString | result converter | result := WriteStream on: (String new: aString size). converter := CP1253TextConverter new. aString do: [:each | result nextPut: (converter toSqueak: each macToSqueak) asCharacter. ]. ^ result contents. ! ! !CP1253ClipboardInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 3/31/2007 13:05'! toSystemClipboard: aString | result converter r | aString isAsciiString ifTrue: [^ aString asOctetString]. "optimization" result _ WriteStream on: (String new: aString size). converter _ CP1253TextConverter new. aString do: [:each | r _ converter fromSqueak: each. r charCode < 255 ifTrue: [ result nextPut: r squeakToMac]]. ^ result contents. ! ! !CP1253InputInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 3/31/2007 15:24'! initialize converter _ CP1253TextConverter new. ! ! !CP1253InputInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 12/5/2007 22:42'! nextCharFrom: sensor firstEvt: evtBuf | keyValue | keyValue := evtBuf third. ^ converter toSqueak: keyValue asCharacter macToSqueak. ! ! !CP1253TextConverter methodsFor: 'conversion' stamp: 'yo 3/31/2007 15:36'! nextPut: aCharacter toStream: aStream aStream isBinary ifTrue: [^aCharacter storeBinaryOn: aStream]. aCharacter charCode < 128 ifTrue: [ aStream basicNextPut: aCharacter. ] ifFalse: [ aStream basicNextPut: ((Character value: (self fromSqueak: aCharacter) charCode)). ]. ! ! !CP1253TextConverter methodsFor: 'private' stamp: 'yo 3/31/2007 15:35'! fromSqueak: char ^ Character value: (FromTable at: char charCode ifAbsent: [char asciiValue])! ! !CP1253TextConverter class methodsFor: 'class initialization' stamp: 'yo 3/31/2007 15:21'! initialize " CP1253TextConverter initialize " FromTable _ Dictionary new. FromTable at: 16r80 put: 16r20AC. FromTable at: 16r82 put: 16r201A. FromTable at: 16r83 put: 16r0192. FromTable at: 16r84 put: 16r201E. FromTable at: 16r85 put: 16r2026. FromTable at: 16r86 put: 16r2020. FromTable at: 16r87 put: 16r2021. FromTable at: 16r89 put: 16r2030. FromTable at: 16r8B put: 16r2039. FromTable at: 16r91 put: 16r2018. FromTable at: 16r92 put: 16r2019. FromTable at: 16r93 put: 16r201C. FromTable at: 16r94 put: 16r201D. FromTable at: 16r95 put: 16r2022. FromTable at: 16r96 put: 16r2013. FromTable at: 16r97 put: 16r2014. FromTable at: 16r99 put: 16r2122. FromTable at: 16r9B put: 16r203A. FromTable at: 16rA0 put: 16r00A0. FromTable at: 16rA1 put: 16r0385. FromTable at: 16rA2 put: 16r0386. FromTable at: 16rA3 put: 16r00A3. FromTable at: 16rA4 put: 16r00A4. FromTable at: 16rA5 put: 16r00A5. FromTable at: 16rA6 put: 16r00A6. FromTable at: 16rA7 put: 16r00A7. FromTable at: 16rA8 put: 16r00A8. FromTable at: 16rA9 put: 16r00A9. FromTable at: 16rAB put: 16r00AB. FromTable at: 16rAC put: 16r00AC. FromTable at: 16rAD put: 16r00AD. FromTable at: 16rAE put: 16r00AE. FromTable at: 16rAF put: 16r2015. FromTable at: 16rB0 put: 16r00B0. FromTable at: 16rB1 put: 16r00B1. FromTable at: 16rB2 put: 16r00B2. FromTable at: 16rB3 put: 16r00B3. FromTable at: 16rB4 put: 16r0384. FromTable at: 16rB5 put: 16r00B5. FromTable at: 16rB6 put: 16r00B6. FromTable at: 16rB7 put: 16r00B7. FromTable at: 16rB8 put: 16r0388. FromTable at: 16rB9 put: 16r0389. FromTable at: 16rBA put: 16r038A. FromTable at: 16rBB put: 16r00BB. FromTable at: 16rBC put: 16r038C. FromTable at: 16rBD put: 16r00BD. FromTable at: 16rBE put: 16r038E. FromTable at: 16rBF put: 16r038F. FromTable at: 16rC0 put: 16r0390. FromTable at: 16rC1 put: 16r0391. FromTable at: 16rC2 put: 16r0392. FromTable at: 16rC3 put: 16r0393. FromTable at: 16rC4 put: 16r0394. FromTable at: 16rC5 put: 16r0395. FromTable at: 16rC6 put: 16r0396. FromTable at: 16rC7 put: 16r0397. FromTable at: 16rC8 put: 16r0398. FromTable at: 16rC9 put: 16r0399. FromTable at: 16rCA put: 16r039A. FromTable at: 16rCB put: 16r039B. FromTable at: 16rCC put: 16r039C. FromTable at: 16rCD put: 16r039D. FromTable at: 16rCE put: 16r039E. FromTable at: 16rCF put: 16r039F. FromTable at: 16rD0 put: 16r03A0. FromTable at: 16rD1 put: 16r03A1. FromTable at: 16rD3 put: 16r03A3. FromTable at: 16rD4 put: 16r03A4. FromTable at: 16rD5 put: 16r03A5. FromTable at: 16rD6 put: 16r03A6. FromTable at: 16rD7 put: 16r03A7. FromTable at: 16rD8 put: 16r03A8. FromTable at: 16rD9 put: 16r03A9. FromTable at: 16rDA put: 16r03AA. FromTable at: 16rDB put: 16r03AB. FromTable at: 16rDC put: 16r03AC. FromTable at: 16rDD put: 16r03AD. FromTable at: 16rDE put: 16r03AE. FromTable at: 16rDF put: 16r03AF. FromTable at: 16rE0 put: 16r03B0. FromTable at: 16rE1 put: 16r03B1. FromTable at: 16rE2 put: 16r03B2. FromTable at: 16rE3 put: 16r03B3. FromTable at: 16rE4 put: 16r03B4. FromTable at: 16rE5 put: 16r03B5. FromTable at: 16rE6 put: 16r03B6. FromTable at: 16rE7 put: 16r03B7. FromTable at: 16rE8 put: 16r03B8. FromTable at: 16rE9 put: 16r03B9. FromTable at: 16rEA put: 16r03BA. FromTable at: 16rEB put: 16r03BB. FromTable at: 16rEC put: 16r03BC. FromTable at: 16rED put: 16r03BD. FromTable at: 16rEE put: 16r03BE. FromTable at: 16rEF put: 16r03BF. FromTable at: 16rF0 put: 16r03C0. FromTable at: 16rF1 put: 16r03C1. FromTable at: 16rF2 put: 16r03C2. FromTable at: 16rF3 put: 16r03C3. FromTable at: 16rF4 put: 16r03C4. FromTable at: 16rF5 put: 16r03C5. FromTable at: 16rF6 put: 16r03C6. FromTable at: 16rF7 put: 16r03C7. FromTable at: 16rF8 put: 16r03C8. FromTable at: 16rF9 put: 16r03C9. FromTable at: 16rFA put: 16r03CA. FromTable at: 16rFB put: 16r03CB. FromTable at: 16rFC put: 16r03CC. FromTable at: 16rFD put: 16r03CD. FromTable at: 16rFE put: 16r03CE. ! ! !GreekEnvironment class methodsFor: 'subclass responsibilities' stamp: 'yo 12/5/2007 22:46'! clipboardInterpreterClass | platformName osVersion | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^NoConversionClipboardInterpreter]. platformName = 'Win32' ifTrue: [^self win32VMUsesUnicode ifTrue: [UTF8GreekClipboardInterpreter] ifFalse: [CP1253ClipboardInterpreter]]. platformName = 'unix' ifTrue: [UTF8GreekClipboardInterpreter]. ^ ISO88597ClipboardInterpreter . ! ! !GreekEnvironment class methodsFor: 'subclass responsibilities' stamp: 'yo 3/31/2007 15:22'! defaultEncodingName | platformName osVersion | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8' copy]. (#('Win32') includes: platformName) ifTrue: [^'cp-1253' copy]. (#('unix') includes: platformName) ifTrue: [^'iso8859-7' copy]. ^'mac-roman'! ! !GreekEnvironment class methodsFor: 'subclass responsibilities' stamp: 'yo 12/6/2007 00:20'! fileNameConverterClass (#('Win32') includes: SmalltalkImage current platformName) ifTrue: [^UTF8TextConverter ]. ^ ISO88597TextConverter. ! ! !GreekEnvironment class methodsFor: 'subclass responsibilities' stamp: 'yo 12/6/2007 00:19'! inputInterpreterClass | platformName osVersion | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^ MacRomanInputInterpreter]. platformName = 'Win32' ifTrue: [^ (self win32VMUsesUnicode) ifTrue: [UTF32GreekInputInterpreter] ifFalse: [CP1253InputInterpreter]]. platformName = 'Mac OS' ifTrue: [^ (('10*' match: SmalltalkImage current osVersion) and: [(SmalltalkImage current getSystemAttribute: 3) isNil]) ifTrue: [MacUnicodeInputInterpreter] ifFalse: [MacShiftJISInputInterpreter]]. platformName = 'unix' ifTrue: [UTF32GreekInputInterpreter]. ^ MacRomanInputInterpreter! ! !GreekEnvironment class methodsFor: 'subclass responsibilities' stamp: 'yo 3/31/2007 15:25'! systemConverterClass (#('Win32') includes: SmalltalkImage current platformName) ifTrue: [^CP1253TextConverter ]. ^ ISO88597TextConverter. ! ! !ISO88597ClipboardInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 3/31/2007 13:05'! fromSystemClipboard: aString ^ aString convertFromWithConverter: ISO88597TextConverter new. ! ! !ISO88597ClipboardInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 3/31/2007 13:06'! toSystemClipboard: aString | result converter | aString isAsciiString ifTrue: [^ aString asOctetString]. "optimization" result _ WriteStream on: (String new: aString size). converter _ ISO88597TextConverter new. aString do: [:each | result nextPut: (converter fromSqueak: each).]. ^ result contents. ! ! !ISO88597InputInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 3/31/2007 15:24'! initialize converter _ ISO88597TextConverter new. ! ! !ISO88597InputInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 12/5/2007 22:48'! nextCharFrom: sensor firstEvt: evtBuf | keyValue | keyValue := evtBuf third. ^ converter toSqueak: keyValue asCharacter. ! ! !UTF32GreekInputInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 12/6/2007 00:16'! nextCharFrom: sensor firstEvt: evtBuf | keyValue | keyValue := evtBuf at: 6. keyValue < 256 ifTrue: [^ (Character value: keyValue) squeakToIso]. ^ Character leadingChar: GreekEnvironment leadingChar code: keyValue! ! !UTF8GreekClipboardInterpreter methodsFor: 'as yet unclassified' stamp: 'yo 12/5/2007 22:43'! fromSystemClipboard: aString ^aString convertFromWithConverter: UTF8TextConverter new. ! ! CP1253TextConverter initialize!