Eliot Miranda uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-eem.253.mcz ==================== Summary ==================== Name: Multilingual-eem.253 Author: eem Time: 14 December 2020, 6:53:34.900606 pm UUID: c157caaa-e69e-4431-9d90-6b94f7c76463 Ancestors: Multilingual-nice.252 Fix several osVersion tests on mac OS that fail for Big Sur (11.x). The old code read '10*' match: osVersion which fails on Big Sur, e.g. '1100.1', '1101.0'. The new code tests for the index of the period being > 4. Arguably the old code is obsolete. I'm guessing as to the old format. If in fact it was only three digits then my code is wrong, and should be e.g. Smalltalk osVersion includes: $. Please let me know. One method SimplifiedChineseEnvironment class>>#inputInterpreterClass is simplified, eliminating redundant tests. =============== Diff against Multilingual-nice.252 =============== Item was changed: ----- Method: JapaneseEnvironment class>>defaultEncodingName (in category 'public query') ----- defaultEncodingName + | platformName | - | platformName osVersion | platformName := Smalltalk platformName. - osVersion := Smalltalk osVersion. (#('Win32' 'ZaurusOS') includes: platformName) ifTrue: [^'shift-jis']. + platformName = 'Mac OS' ifTrue: + [^(Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc" - platformName = 'Mac OS' - ifTrue: - [^('10*' match: osVersion) ifTrue: ['utf-8'] ifFalse: ['shift-jis']]. ^'unix' = platformName ifTrue: ['euc-jp'] ifFalse: ['mac-roman']! Item was changed: ----- Method: JapaneseEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') ----- inputInterpreterClass + | platformName encoding | - | platformName osVersion encoding | platformName := Smalltalk platformName. + platformName = 'Win32' ifTrue: + [^self win32VMUsesUnicode + ifTrue: [UTF32JPInputInterpreter] + ifFalse: [WinShiftJISInputInterpreter]]. + platformName = 'Mac OS' ifTrue: + [^((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc" + and: [(Smalltalk getSystemAttribute: 3) isNil]) - osVersion := Smalltalk osVersion. - platformName = 'Win32' - ifTrue: [^ (self win32VMUsesUnicode) ifTrue: [UTF32JPInputInterpreter] ifFalse: [WinShiftJISInputInterpreter]]. - platformName = 'Mac OS' - ifTrue: [^ (('10*' match: osVersion) - and: [(Smalltalk getSystemAttribute: 3) isNil]) ifTrue: [MacUnicodeInputInterpreter] ifFalse: [MacShiftJISInputInterpreter]]. + platformName = 'unix' ifTrue: + [encoding := X11Encoding encoding. + (EUCJPTextConverter encodingNames includes: encoding) ifTrue: + [^UnixEUCJPInputInterpreter]. + (UTF8TextConverter encodingNames includes: encoding) ifTrue: + [^UnixUTF8JPInputInterpreter]. + (ShiftJISTextConverter encodingNames includes: encoding) ifTrue: + [^ MacShiftJISInputInterpreter]]. - platformName = 'unix' - ifTrue: [encoding := X11Encoding encoding. - (EUCJPTextConverter encodingNames includes: encoding) - ifTrue: [^ UnixEUCJPInputInterpreter]. - (UTF8TextConverter encodingNames includes: encoding) - ifTrue: [^ UnixUTF8JPInputInterpreter]. - (ShiftJISTextConverter encodingNames includes: encoding) - ifTrue: [^ MacShiftJISInputInterpreter]]. ^ MacRomanInputInterpreter! Item was changed: ----- Method: JapaneseEnvironment class>>systemConverterClass (in category 'subclass responsibilities') ----- systemConverterClass + | platformName | - | platformName osVersion encoding | platformName := Smalltalk platformName. + platformName = 'Win32' ifTrue: + [^UTF8TextConverter]. + platformName = 'ZaurusOS' ifTrue: + [^ShiftJISTextConverter]. + platformName = 'Mac OS' ifTrue: + [^(Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc" + ifTrue: [UTF8TextConverter] + ifFalse: [ShiftJISTextConverter]]. + platformName = 'unix' ifTrue: + [X11Encoding encoding + ifNil: [^EUCJPTextConverter] + ifNotNil: + [:encoding| + (encoding = 'utf-8') ifTrue: + [^UTF8TextConverter]. + (encoding = 'shiftjis' or: [encoding = 'sjis']) ifTrue: + [^ShiftJISTextConverter]]. + ^EUCJPTextConverter]. - osVersion := Smalltalk osVersion. - platformName = 'Win32' - ifTrue: [^UTF8TextConverter]. - platformName = 'ZaurusOS' - ifTrue: [^ShiftJISTextConverter]. - platformName = 'Mac OS' - ifTrue: - [^('10*' match: osVersion) - ifTrue: [UTF8TextConverter] - ifFalse: [ShiftJISTextConverter]]. - platformName = 'unix' - ifTrue: - [encoding := X11Encoding encoding. - encoding ifNil: [^EUCJPTextConverter]. - (encoding = 'utf-8') - ifTrue: [^UTF8TextConverter]. - (encoding = 'shiftjis' or: [ encoding = 'sjis' ]) - ifTrue: [^ShiftJISTextConverter]. - ^EUCJPTextConverter]. ^MacRomanTextConverter! Item was changed: ----- Method: KoreanEnvironment class>>clipboardInterpreterClass (in category 'subclass responsibilities') ----- clipboardInterpreterClass + | platformName | - | platformName osVersion | platformName := Smalltalk platformName. - osVersion := Smalltalk osVersion. platformName = 'Win32' ifTrue: [^WinKSX1001ClipboardInterpreter]. platformName = 'Mac OS' ifTrue: + [((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc") - [('10*' match: osVersion) ifTrue: [^NoConversionClipboardInterpreter] ifFalse: [^WinKSX1001ClipboardInterpreter]]. platformName = 'unix' ifTrue: [(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding) ifTrue: [^WinKSX1001ClipboardInterpreter] ifFalse: [^NoConversionClipboardInterpreter]]. ^NoConversionClipboardInterpreter! Item was changed: ----- Method: KoreanEnvironment class>>defaultEncodingName (in category 'public query') ----- defaultEncodingName + | platformName | - | platformName osVersion | platformName := Smalltalk platformName. + (#('unix' 'Win32' 'Mac OS' 'ZaurusOS') includes: platformName) ifTrue: + [^'euc-kr']. - osVersion := Smalltalk osVersion. - (#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName) - ifTrue: [^'euc-kr']. - (#('unix') includes: platformName) ifTrue: [^'euc-kr']. ^'mac-roman'! Item was changed: ----- Method: KoreanEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') ----- inputInterpreterClass + | platformName encoding | - | platformName osVersion encoding | platformName := Smalltalk platformName. - osVersion := Smalltalk osVersion. platformName = 'Win32' ifTrue: [^WinKSX1001InputInterpreter]. platformName = 'Mac OS' ifTrue: + [((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc") - [('10*' match: osVersion) ifTrue: [^MacUnicodeInputInterpreter] ifFalse: [^WinKSX1001InputInterpreter]]. platformName = 'unix' ifTrue: [encoding := X11Encoding encoding. (EUCJPTextConverter encodingNames includes: encoding) ifTrue: [^MacRomanInputInterpreter]. (UTF8TextConverter encodingNames includes: encoding) ifTrue: [^MacRomanInputInterpreter]. (ShiftJISTextConverter encodingNames includes: encoding) ifTrue: [^MacRomanInputInterpreter]]. ^MacRomanInputInterpreter! Item was changed: ----- Method: Latin1Environment class>>defaultEncodingName (in category 'subclass responsibilities') ----- defaultEncodingName + (#('unix' 'Win32' 'Mac OS' 'ZaurusOS') includes: Smalltalk platformName) ifTrue: + [^'iso8859-1']. - | platformName osVersion | - platformName := Smalltalk platformName. - osVersion := Smalltalk osVersion. - (#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName) - ifTrue: [^'iso8859-1']. - (#('unix') includes: platformName) ifTrue: [^'iso8859-1']. ^'mac-roman'! Item was changed: ----- Method: Latin1Environment class>>systemConverterClass (in category 'subclass responsibilities') ----- systemConverterClass + | platformName | - | platformName osVersion | platformName := Smalltalk platformName. + platformName = 'Win32' ifTrue: + [^self win32VMUsesUnicode + ifTrue: [UTF8TextConverter] + ifFalse: [ISO88591TextConverter]]. + platformName = 'Mac OS' ifTrue: + [^((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc") + ifTrue: [UTF8TextConverter] + ifFalse: [MacRomanTextConverter]]. + platformName = 'unix' ifTrue: + [^UTF8TextConverter]. + ^MacRomanTextConverter! - osVersion := Smalltalk getSystemAttribute: 1002. - platformName = 'Win32' - ifTrue: [^ (self win32VMUsesUnicode) ifTrue: [UTF8TextConverter] ifFalse: [ISO88591TextConverter]]. - platformName = 'Mac OS' - ifTrue: [^ ('10*' match: Smalltalk osVersion) - ifTrue: [UTF8TextConverter] - ifFalse: [MacRomanTextConverter]]. - platformName = 'unix' - ifTrue: [^ UTF8TextConverter]. - ^ MacRomanTextConverter! Item was changed: ----- Method: Latin2Environment class>>defaultEncodingName (in category 'subclass responsibilities') ----- defaultEncodingName + ^Smalltalk platformName caseOf: { + ['Win32'] -> ['cp-1250']. + ['unix'] -> ['iso8859-2'] + } + otherwise: ['mac-roman']! - | platformName | - platformName := Smalltalk platformName. - (#('Win32') includes: platformName) - ifTrue: [^'cp-1250']. - (#('unix') includes: platformName) ifTrue: [^'iso8859-2']. - ^'mac-roman'! Item was changed: ----- Method: MultiByteFileStream class>>guessDefaultLineEndConvention (in category 'system startup') ----- guessDefaultLineEndConvention "Lets try to guess the line end convention from what we know about the path name delimiter from FileDirectory." + FileDirectory pathNameDelimiter = $: ifTrue: + [^self defaultToCR]. + FileDirectory pathNameDelimiter = $/ ifTrue: + [^(Smalltalk platformName = 'Mac OS' + and: [(Smalltalk osVersion indexOf: $.) <= 4]) "i.e. 9xx.n, not 10xx.n, 11xx.n etc" + ifTrue: [self defaultToCR] + ifFalse: [self defaultToLF]]. + FileDirectory pathNameDelimiter = $\ ifTrue: + [^self defaultToCRLF]. - FileDirectory pathNameDelimiter = $: - ifTrue: [^ self defaultToCR]. - FileDirectory pathNameDelimiter = $/ - ifTrue: [((Smalltalk osVersion) - beginsWith: 'darwin') - ifTrue: [^ self defaultToCR] - ifFalse: [^ self defaultToLF]]. - FileDirectory pathNameDelimiter = $\ - ifTrue: [^ self defaultToCRLF]. "in case we don't know" + ^self defaultToCR! - ^ self defaultToCR! Item was changed: ----- Method: RussianEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') ----- inputInterpreterClass | platformName | platformName := Smalltalk platformName. platformName = 'Win32' ifTrue: [^UTF32RussianInputInterpreter]. platformName = 'Mac OS' + ifTrue: [^ (((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc") - ifTrue: [^ (('10*' match: Smalltalk osVersion) and: [(Smalltalk getSystemAttribute: 3) isNil]) ifTrue: [MacUnicodeInputInterpreter] ifFalse: [MacRomanInputInterpreter]]. platformName = 'unix' ifTrue: [^ UTF32RussianInputInterpreter]. ^ MacRomanInputInterpreter! Item was changed: ----- Method: SimplifiedChineseEnvironment class>>clipboardInterpreterClass (in category 'subclass responsibilities') ----- clipboardInterpreterClass + | platformName | - | platformName osVersion | platformName := Smalltalk platformName. + platformName = 'Win32' ifTrue: + [^WinGB2312ClipboardInterpreter]. + platformName = 'Mac OS' ifTrue: + [^((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc") + ifTrue: [NoConversionClipboardInterpreter] + ifFalse: [WinGB2312ClipboardInterpreter]]. + platformName = 'unix' ifTrue: + [^(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding) + ifTrue: [MacShiftJISClipboardInterpreter] + ifFalse: [NoConversionClipboardInterpreter]]. - osVersion := Smalltalk osVersion. - platformName = 'Win32' ifTrue: [^WinGB2312ClipboardInterpreter]. - platformName = 'Mac OS' - ifTrue: - [('10*' match: osVersion) - ifTrue: [^NoConversionClipboardInterpreter] - ifFalse: [^WinGB2312ClipboardInterpreter]]. - platformName = 'unix' - ifTrue: - [(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding) - ifTrue: [^MacShiftJISClipboardInterpreter] - ifFalse: [^NoConversionClipboardInterpreter]]. ^NoConversionClipboardInterpreter! Item was changed: ----- Method: SimplifiedChineseEnvironment class>>defaultEncodingName (in category 'public query') ----- defaultEncodingName + | platformName | - | platformName osVersion | platformName := Smalltalk platformName. + (#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName) ifTrue: + [^'gb2312']. + 'unix' = platformName ifTrue: + [^'euc-cn']. - osVersion := Smalltalk osVersion. - (#('Win32' 'Mac OS' 'ZaurusOS') includes: platformName) - ifTrue: [^'gb2312']. - (#('unix') includes: platformName) ifTrue: [^'euc-cn']. ^'mac-roman'! Item was changed: ----- Method: SimplifiedChineseEnvironment class>>inputInterpreterClass (in category 'subclass responsibilities') ----- inputInterpreterClass + | platformName | - | platformName osVersion encoding | platformName := Smalltalk platformName. + platformName = 'Win32' ifTrue: + [^WinGB2312InputInterpreter]. + platformName = 'Mac OS' ifTrue: + [^((Smalltalk osVersion indexOf: $.) > 4 "i.e. not 9xx.n, but 10xx.n, 11xx.n etc") + ifTrue: [MacUnicodeInputInterpreter] + ifFalse: [WinGB2312InputInterpreter]]. - osVersion := Smalltalk osVersion. - platformName = 'Win32' ifTrue: [^WinGB2312InputInterpreter]. - platformName = 'Mac OS' - ifTrue: - [('10*' match: osVersion) - ifTrue: [^MacUnicodeInputInterpreter] - ifFalse: [^WinGB2312InputInterpreter]]. - platformName = 'unix' - ifTrue: - [encoding := X11Encoding encoding. - (EUCJPTextConverter encodingNames includes: encoding) - ifTrue: [^MacRomanInputInterpreter]. - (UTF8TextConverter encodingNames includes: encoding) - ifTrue: [^MacRomanInputInterpreter]. - (ShiftJISTextConverter encodingNames includes: encoding) - ifTrue: [^MacRomanInputInterpreter]]. ^MacRomanInputInterpreter! |
Free forum by Nabble | Edit this page |