[squeak-dev] Smalltalk platformName in Win64 image >> Win32

Tobias Pape Das.Linux at gmx.de
Tue Jun 26 17:06:12 UTC 2018


> On 26.06.2018, at 18:26, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> 
> Hi John-Reed,
> 
> On Tue, Jun 26, 2018 at 8:33 AM, John-Reed Maffeo <jrmaffeo at gmail.com> wrote:
> The value returned from "Smalltalk platformName" on  the 64 bit 5.2A image is Win32. Does this matter?
> 
> Alas it does :-(.  There is much code in the system that explicitly tests for 'Win32', for example in various implementations of clipboardInterpreterClass.  If the 64-bit VM were to report, more accurately, Win64, then lots of code would break.
> 
> Maybe at a major release we could fix this, but when this issue surfaced (May 2017, see commit ca7e8db32835f5d2489ebddc7e14a51c9bbd4697), I chose to 
> - change getSystemAttribute: 1005 (the Windowing system name) to answer Windows instead of Win32
> - keep getSystemAttribute: 1001 (the primary OS name) answering Win32
> 
> 
> I guess a prudent way to deal with this for the moment is to implement SmalltalkImage>>is32BitWindows &  SmalltalkImage>>is64BitWindows (along with some other useful ones) to insulate clients from the details of the getSystemAttribute: interface, and then later we can try and remedy the situation.
> 
> In fact, if there are any volunteers motivated enough it would be really nice to see code like
> 
> clipboardInterpreterClass
> 	| platformName osVersion |
> 	platformName := Smalltalk platformName.
> 	osVersion := Smalltalk osVersion.
> 	(platformName = 'Win32' and: [osVersion = 'CE']) 
> 		ifTrue: [^NoConversionClipboardInterpreter].
> 	platformName = 'Win32' ifTrue: [^UTF8ClipboardInterpreter].
> 	platformName = 'Mac OS' ifTrue: [^MacShiftJISClipboardInterpreter].
> 	^platformName = 'unix' 
> 		ifTrue: 
> 			[(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding) 
> 				ifTrue: [MacShiftJISClipboardInterpreter]
> 				ifFalse: [UnixJPClipboardInterpreter]]
> 		ifFalse: [ NoConversionClipboardInterpreter ]
> 
> rewritten to more closely resemble
> 
> clipboardInterpreterClass
> 	Smalltalk os isWindows ifTrue:
> 		[^Smalltalk os isWindowsCE
> 			ifTrue: [NoConversionClipboardInterpreter]
> 			ifFalse: [UTF8ClipboardInterpreter]].
> 	Smalltalk os isMacOSX ifTrue:
> 		[^MacShiftJISClipboardInterpreter].

With the interesting gotcha that UTF is probably the correct thing here and MacShiftJISClipboardInterpreter actually the pre-OSX Mac OS?
So, what do the name actually still tell us? :/


> 	Smalltalk os isUnix ifTrue: 
> 		[^(ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding) 
> 			ifTrue: [MacShiftJISClipboardInterpreter]
> 			ifFalse: [UnixJPClipboardInterpreter]].
> 	^NoConversionClipboardInterpreter
> 
> or
> 
> clipboardInterpreterClass
> 	(Smalltalk os isWindows
> 	 and: [Smalltalk os isWindowsCE not]) ifTrue:
> 		[^ UTF8ClipboardInterpreter].
> 	Smalltalk os isMacOSX ifTrue:
> 		[^MacShiftJISClipboardInterpreter].
> 	Smalltalk os isUnix ifTrue: 
> 		[(Smalltalk os isMacOSX
> 		  or: [ShiftJISTextConverter encodingNames includes: X11Encoding getEncoding]) ifTrue:
> 			[^MacShiftJISClipboardInterpreter]
> 		 ^UnixJPClipboardInterpreter].
> 	^NoConversionClipboardInterpreter
> 
> 
> C:\Smalltalk\Squeak5.2alpha-18110-64bit-201804030952-Windows\Squeak5.2alpha-18110-64bit\Squeak5.2alpha-18110-64bit.1.image
> Squeak5.2alpha
> latest update: #18110
> Current Change Set: BBCRR-RestartAt5.2alpha
> Image format 68021 (64 bit)
> 
> - jrm
> 
> 
> _,,,^..^,,,_
> best, Eliot
> 



More information about the Squeak-dev mailing list