'From Squeakland-OLPC of 25 September 2008 [latest update: #2159] on 6 November 2008 at 11:58:49 pm'! KeyboardInputInterpreter subclass: #UnixEUCKRInputInterpreter instanceVariableNames: 'converter' classVariableNames: '' poolDictionaries: '' category: 'Multilingual-TextConversion'! !KoreanEnvironment methodsFor: 'as yet unclassified' stamp: 'janggoon 11/6/2008 23:57'! fontDownloadUrls ^ #('http://squeak.kr/data/' )! ! !KoreanEnvironment class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:08'! clipboardInterpreterClass | platformName osVersion | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^NoConversionClipboardInterpreter]. platformName = 'Win32' ifTrue: [^WinKSX1001ClipboardInterpreter]. platformName = 'Mac OS' ifTrue: [('10*' match: SmalltalkImage current osVersion) ifTrue: [^NoConversionClipboardInterpreter] ifFalse: [^WinKSX1001ClipboardInterpreter]]. platformName = 'unix' ifTrue: [(EUCKRTextConverter encodingNames includes: X11Encoding getEncoding) ifTrue: [^WinKSX1001ClipboardInterpreter] ifFalse: [^NoConversionClipboardInterpreter]]. ^NoConversionClipboardInterpreter! ! !KoreanEnvironment class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:09'! defaultEncodingName | platformName osVersion | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^'utf-8' copy]. (#('Win32' 'ZaurusOS') includes: platformName) ifTrue: [^'euc-kr' copy]. platformName = 'Mac OS' ifTrue: [^ ('10*' match: SmalltalkImage current osVersion) ifTrue: ['utf-8'] ifFalse: ['euc-kr']]. (#('unix') includes: platformName) ifTrue: [^'euc-kr' copy]. ^'mac-roman'! ! !KoreanEnvironment class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:09'! fileNameConverterClass ^ self systemConverterClass! ! !KoreanEnvironment class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:10'! inputInterpreterClass | platformName osVersion encoding | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^MacRomanInputInterpreter]. platformName = 'Win32' ifTrue: [^WinKSX1001InputInterpreter]. platformName = 'Mac OS' ifTrue: [('10*' match: SmalltalkImage current osVersion) ifTrue: [^MacUnicodeInputInterpreter] ifFalse: [^WinKSX1001InputInterpreter]]. platformName = 'unix' ifTrue: [encoding := X11Encoding encoding. (EUCKRTextConverter encodingNames includes: encoding) ifTrue: [^MacRomanInputInterpreter]. (UTF8TextConverter encodingNames includes: encoding) ifTrue: [^MacRomanInputInterpreter]]. ^MacRomanInputInterpreter! ! !KoreanEnvironment class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:11'! leadingChar ^ 7! ! !KoreanEnvironment class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:12'! systemConverterClass | platformName osVersion encoding | platformName := SmalltalkImage current platformName. osVersion := SmalltalkImage current getSystemAttribute: 1002. (platformName = 'Win32' and: [osVersion = 'CE']) ifTrue: [^UTF8TextConverter]. (#('Win32' 'ZaurusOS') includes: platformName) ifTrue: [^EUCKRTextConverter]. platformName = 'Mac OS' ifTrue: [^('10*' match: SmalltalkImage current osVersion) ifTrue: [UTF8TextConverter] ifFalse: [EUCKRTextConverter]]. platformName = 'unix' ifTrue: [encoding := X11Encoding encoding. encoding ifNil: [^EUCKRTextConverter]. (encoding = 'utf-8') ifTrue: [^UTF8TextConverter]. ^EUCKRTextConverter]. ^MacRomanTextConverter! ! !StrikeFontSet class methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:12'! createExternalFontFileForUnicodeKorean: fileName " Smalltalk garbageCollect. StrikeFontSet createExternalFontFileForUnicodeKorean: 'uKoreanFont.out'. " | file array f installDirectory | file _ FileStream newFileNamed: fileName. installDirectory _ Smalltalk at: #M17nInstallDirectory ifAbsent: []. installDirectory _ installDirectory ifNil: [String new] ifNotNil: [installDirectory , FileDirectory pathNameDelimiter asString]. array _ Array with: (StrikeFont newForKoreanFromEFontBDFFile: installDirectory , 'b12.bdf' name: 'Korean10' overrideWith: 'shnmk12.bdf') with: ((StrikeFont newForKoreanFromEFontBDFFile: installDirectory , 'b14.bdf' name: 'Korean12' overrideWith: 'shnmk14.bdf') "fixAscent: 14 andDescent: 1 head: 1") with: ((StrikeFont newForKoreanFromEFontBDFFile: installDirectory , 'b16.bdf' name: 'Korean14' overrideWith: 'hanglg16.bdf') fixAscent: 16 andDescent: 4 head: 4) with: (StrikeFont newForKoreanFromEFontBDFFile: installDirectory , 'b24.bdf' name: 'Korean18' overrideWith: 'hanglm24.bdf'). TextConstants at: #forceFontWriting put: true. f _ ReferenceStream on: file. f nextPut: array. file close. TextConstants removeKey: #forceFontWriting.! ! !UnixEUCKRInputInterpreter methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:05'! initialize converter _ EUCKRTextConverter new. ! ! !UnixEUCKRInputInterpreter methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:06'! nextCharFrom: sensor firstEvt: evtBuf | firstChar secondChar peekEvent keyValue type stream multiChar | keyValue _ evtBuf third. evtBuf fourth = EventKeyChar ifTrue: [type _ #keystroke]. peekEvent _ sensor peekEvent. (peekEvent notNil and: [peekEvent fourth = EventKeyDown]) ifTrue: [ sensor nextEvent. peekEvent _ sensor peekEvent]. (type == #keystroke and: [peekEvent notNil and: [peekEvent first = EventTypeKeyboard and: [peekEvent fourth = EventKeyChar]]]) ifTrue: [ firstChar _ keyValue asCharacter. secondChar _ (peekEvent third) asCharacter. stream _ ReadStream on: (String with: firstChar with: secondChar). multiChar _ converter nextFromStream: stream. multiChar isOctetCharacter ifFalse: [sensor nextEvent]. ^ multiChar]. ^ keyValue asCharacter! ! !WinKSX1001ClipboardInterpreter methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:07'! fromSystemClipboard: aString ^ aString macToSqueak convertFromSystemString. ! ! !WinKSX1001InputInterpreter methodsFor: 'as yet unclassified' stamp: 'janggoon 11/4/2008 22:07'! nextCharFrom: sensor firstEvt: evtBuf | keyValue | keyValue := evtBuf at: 6. keyValue < 256 ifTrue: [^ (Character value: keyValue) squeakToIso]. "Smalltalk systemLanguage charsetClass charFromUnicode: keyValue." ^ Unicode value: keyValue! !