Smalltalk platformName in Win64 image >> Win32

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
jrm
Reply | Threaded
Open this post in threaded view
|

Smalltalk platformName in Win64 image >> Win32

jrm
The value returned from "Smalltalk platformName" on  the 64 bit 5.2A image is Win32. Does this matter?

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


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk platformName in Win64 image >> Win32

Eliot Miranda-2
Hi John-Reed,

On Tue, Jun 26, 2018 at 8:33 AM, John-Reed Maffeo <[hidden email]> 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].
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


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk platformName in Win64 image >> Win32

Tobias Pape

> On 26.06.2018, at 18:26, Eliot Miranda <[hidden email]> wrote:
>
> Hi John-Reed,
>
> On Tue, Jun 26, 2018 at 8:33 AM, John-Reed Maffeo <[hidden email]> 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
>


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk platformName in Win64 image >> Win32

Eliot Miranda-2
Hi Tobias,

> On Jun 26, 2018, at 10:06 AM, Tobias Pape <[hidden email]> wrote:
>
>
>> On 26.06.2018, at 18:26, Eliot Miranda <[hidden email]> wrote:
>>
>> Hi John-Reed,
>>
>> On Tue, Jun 26, 2018 at 8:33 AM, John-Reed Maffeo <[hidden email]> 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? :/

There’s another parameter that answers the OS version number that on Mac OS X, IIRC, is a float, so that 10.10.1 is 1010.1, and hence OS X would be distinguished by that number being >= 1000.

>
>>    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
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk platformName in Win64 image >> Win32

Tobias Pape

> On 26.06.2018, at 22:33, Eliot Miranda <[hidden email]> wrote:
>
> Hi Tobias,
>
>> On Jun 26, 2018, at 10:06 AM, Tobias Pape <[hidden email]> wrote:
>>
>>
>>> On 26.06.2018, at 18:26, Eliot Miranda <[hidden email]> wrote:
>>>
>>> Hi John-Reed,
>>>
>>> On Tue, Jun 26, 2018 at 8:33 AM, John-Reed Maffeo <[hidden email]> 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? :/
>
> There’s another parameter that answers the OS version number that on Mac OS X, IIRC, is a float, so that 10.10.1 is 1010.1, and hence OS X would be distinguished by that number being >= 1000.

Yea, true.
I was being a smartass about that names in that method, sorry ^.^

One thing, I think it is still ok to refer to Windows as Win32 even on 64 bit.
The api is essentially the same (compared to the "newer" WinRT api…)
        (stackoverflow links semi-case-inpoint:
        https://stackoverflow.com/questions/6679396/should-i-define-both-win32-and-win64-in-64bit-build
        https://stackoverflow.com/questions/7476814/will-there-be-a-win64-api
)

Best regards
        -Tobias

>
>>
>>>   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
>>>
>>
>>
>