[squeak-dev] Macintosh command line script?

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

[squeak-dev] Macintosh command line script?

Howard Stearns-3
How do I pass in the name of a script to run when starting squeak from  
a Macintosh command shell?

I thought it was:
        <vm> <imagename> <scriptname> otherArg1 otherArg2 etc

But that doesn't seem to be working on Mac:
   Smalltalk getSystemAttribute: 2 => ''
although lower or higher integers work as expected, and 2 works as  
expected on Windows and Linux.

For <vm>, I mean something that reaches inside the Mac .app, like  
squeak.app/Contents/MacOS/VM

In my case:
Smalltalk getSystemAttribute: 1006
=> 'Mac Carbon 3.8.12b5 6-Jun-06 >BA037700-B8B0-4089-B25E-338707613B8A<'
and
Smalltalk getSystemAttribute: 1001  => 'Mac OS'



-Howard

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

keith1y
Howard Stearns wrote:

> How do I pass in the name of a script to run when starting squeak from
> a Macintosh command shell?
>
> I thought it was:
>     <vm> <imagename> <scriptname> otherArg1 otherArg2 etc
>
> But that doesn't seem to be working on Mac:
>   Smalltalk getSystemAttribute: 2 => ''
> although lower or higher integers work as expected, and 2 works as
> expected on Windows and Linux.
>
> For <vm>, I mean something that reaches inside the Mac .app, like
> squeak.app/Contents/MacOS/VM
>
> In my case:
> Smalltalk getSystemAttribute: 1006
> => 'Mac Carbon 3.8.12b5 6-Jun-06 >BA037700-B8B0-4089-B25E-338707613B8A<'
> and
> Smalltalk getSystemAttribute: 1001  => 'Mac OS'
>
>
>
> -Howard
Last time I tried the MacOS vm wasnt accepting commandline params

Keith


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

johnmci
Well the current VM is Mac Carbon 3.8.18b3 10-Apr-08
Using one from two years back means you miss out on lots
I'd suggest you download the current release and try again...

On May 28, 2008, at 3:25 PM, Keith Hodges wrote:

> Howard Stearns wrote:
>> How do I pass in the name of a script to run when starting squeak  
>> from a Macintosh command shell?
>>
>> I thought it was:
>>    <vm> <imagename> <scriptname> otherArg1 otherArg2 etc
>>
>> But that doesn't seem to be working on Mac:
>>  Smalltalk getSystemAttribute: 2 => ''
>> although lower or higher integers work as expected, and 2 works as  
>> expected on Windows and Linux.
>>
>> For <vm>, I mean something that reaches inside the Mac .app, like  
>> squeak.app/Contents/MacOS/VM
>>
>> In my case:
>> Smalltalk getSystemAttribute: 1006
>> => 'Mac Carbon 3.8.12b5 6-Jun-06 >BA037700-B8B0-4089-
>> B25E-338707613B8A<'
>> and
>> Smalltalk getSystemAttribute: 1001  => 'Mac OS'
>>
>>
>>
>> -Howard
> Last time I tried the MacOS vm wasnt accepting commandline params
>
> Keith
>
>

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

Howard Stearns-3
Thanks, John and Keith.

Alas, it fails the same way in the current version from http://ftp.squeak.org/current_stable/mac/Squeak3.10.1-7175mac.zip 
  (link on "Latest Release" of squeak.org), for which
    SmalltalkImage current getSystemAttribute: 1006
        => 'Mac Carbon 3.8.18b3 10-Apr-08 >DC0EAF5D-C46C-479D-B2A3-
DBD4A2DF95A8<'

Seems odd to me that no one is using Squeak for scripting or arbitrary  
applications on Mac.
Or if people use, say, custom class #startUp methods instead, why do  
we have script processing at all on the other platforms?

-Howard


On May 28, 2008, at 8:23 PM, John M McIntosh wrote:

> Well the current VM is Mac Carbon 3.8.18b3 10-Apr-08
> Using one from two years back means you miss out on lots
> I'd suggest you download the current release and try again...
>
> On May 28, 2008, at 3:25 PM, Keith Hodges wrote:
>
>> Howard Stearns wrote:
>>> How do I pass in the name of a script to run when starting squeak  
>>> from a Macintosh command shell?
>>>
>>> I thought it was:
>>>   <vm> <imagename> <scriptname> otherArg1 otherArg2 etc
>>>
>>> But that doesn't seem to be working on Mac:
>>> Smalltalk getSystemAttribute: 2 => ''
>>> although lower or higher integers work as expected, and 2 works as  
>>> expected on Windows and Linux.
>>>
>>> For <vm>, I mean something that reaches inside the Mac .app, like  
>>> squeak.app/Contents/MacOS/VM
>>>
>>> In my case:
>>> Smalltalk getSystemAttribute: 1006
>>> => 'Mac Carbon 3.8.12b5 6-Jun-06 >BA037700-B8B0-4089-
>>> B25E-338707613B8A<'
>>> and
>>> Smalltalk getSystemAttribute: 1001  => 'Mac OS'
>>>
>>>
>>>
>>> -Howard
>> Last time I tried the MacOS vm wasnt accepting commandline params
>>
>> Keith
>>
>>
>
> --
> =
> =
> =
> =
> =
> ======================================================================
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> =
> =
> =
> =
> =
> ======================================================================
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

johnmci
Sigh, ok well I'm in the middle of a port and have been busy  
documenting, oddly I spent an hour checking getAttributeIntoLength the  
other day
so it seems that  asking for index 2 should give the document name,  
which is a hold over from the original macintosh os-7.x  based VM  
where you
would launch squeak with a document and it was the smalltalk script to  
execute.

Oddly the macintosh carbon port has managed to dispose of this notion  
of the document.
  There are calls in the VM to set and get it, but no one sets it.

Well of course this is why I'm doing this work...
I 'll look into building a mac carbon 3.8.18b4  to fix the problem

You could try passing a negative number  say -2  that might get the  
data, but I'm not quite sure without testing if that is correct as  
compared to
the unix vm.

sqInt getAttributeIntoLength(sqInt indexNumber, sqInt byteArrayIndex,  
sqInt length)
Parms:
indexNumber, a negative or positive number, or zero
byteArrayIndex a pointer to squeak memory, use  
pointerForOop(byteArrayIndex) to convert
lenght an agreed upon length for the storage area.
return: char*
or sucess(0) to fail primitive.

From: Interpreter  via char * GetAttributeString(int id)
Why:
Returns char* to an empty string or magic value strings. which might  
be arguments to the VM at startup.
Works in conjunction with attributeSize which calls it to get data and  
use that for sizing.
Do NOT return NULL
ON unix systems for numbers < 0 it returns the argument passed to the  
binary
On unix systems for numbers > 2 it returns the
number == 0 return vmName
number == 1 return imageName
number == 1001 /* OS type: "unix", "win32", "mac", ... */
number == 1002 /* OS name: "solaris2.5" on unix, "win95" on win32, ...  
*/
number == 1003 /* processor architecture: "68k", "x86",  
"PowerPC", ...  */
number == 1004 /* Interpreter version string */
number == 1006 /* build string, say "Unix built on "__DATE__ "  
"__TIME__" Compiler: "__VERSION__ */
Responsibility:
MacIntosh
indexNumber = 2, return document name, this is not allowed by unix port
BUGS This is not valid, not set, so returns empty string, also use of  
negative # does not match unix implementation
indexNumber = 1001, return 'Mac OS'
indexNumber = 1002, return Gestalt(gestaltSystemVersion
indexNumber = 1003, return Gestalt(gestaltSysArchitecture
indexNumber = 1004, return CFBundleShortVersionString and  
interpreterVersion
indexNUmber = 1005, ignore
indexNumber = 1006, return build string, which is say 'Mac Carbon  
3.8.18b3 10-Apr-08 >DC0EAF5D-C46C-479D-B2A3-DBD4A2DF95A8<'
indexNumber = 1201, return 255 that is the number of characters in a  
file name
indexNumber = 1202, return last file error number, was used by some  
macintosh VM to return file error information, not valid anymore

Unix
indexNumber = 1005, return dpy->winSystemName
indexNumber = 1006, return VM_BUILD_STRING, "Unix built on "__DATE__ "  
"__TIME__" Compiler: "__VERSION__"

Windows
NOTE: NOT CHECKING WINDOWS, windows developers can add their comments  
once this goes onto a WIki somewhere.

BUGS
If attributeSize(1) followed by getAttribute(1) does not return the  
same sized element the results will be bogus.

On May 29, 2008, at 6:34 AM, Howard Stearns wrote:

> Thanks, John and Keith.
>
> Alas, it fails the same way in the current version from http://ftp.squeak.org/current_stable/mac/Squeak3.10.1-7175mac.zip 
>  (link on "Latest Release" of squeak.org), for which
>   SmalltalkImage current getSystemAttribute: 1006
> => 'Mac Carbon 3.8.18b3 10-Apr-08 >DC0EAF5D-C46C-479D-B2A3-
> DBD4A2DF95A8<'
>
> Seems odd to me that no one is using Squeak for scripting or  
> arbitrary applications on Mac.
> Or if people use, say, custom class #startUp methods instead, why do  
> we have script processing at all on the other platforms?
>
> -Howard



--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

johnmci
In reply to this post by Howard Stearns-3
I've posted a 3.8.18b4 VM to the usual places via
http://www.smalltalkconsulting.com/squeak.html

Howard can you test and confirm it works for what you need?


On May 29, 2008, at 6:34 AM, Howard Stearns wrote:

> Thanks, John and Keith.

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

Howard Stearns-3
Confirmed.  It works. (You do have to give a full pathname to the  
script file.)

Thanks!

For what it's worth, re your other question:
On released VM, SmalltalkImage current getSystemAttribute: N gives the  
same answers for
        3, 4, 5, ...
as for
        -1, -2, -3, ...
but there doesn't seem to be a different way to get a real value for 2  
(the script name).

On May 29, 2008, at 5:47 PM, John M McIntosh wrote:

> I've posted a 3.8.18b4 VM to the usual places via
> http://www.smalltalkconsulting.com/squeak.html
>
> Howard can you test and confirm it works for what you need?
>
>
> On May 29, 2008, at 6:34 AM, Howard Stearns wrote:
>
>> Thanks, John and Keith.
>
> --
> =
> =
> =
> =
> =
> ======================================================================
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> =
> =
> =
> =
> =
> ======================================================================
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

keith1y
Howard Stearns wrote:
> Confirmed.  It works. (You do have to give a full pathname to the
> script file.)
>
Thats a known bug/feature of 3.9+

Installer-Launcher (part of LPF) does fix it amongst other things.

Keith



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

Bert Freudenberg

On 30.05.2008, at 21:09, Keith Hodges wrote:

> Howard Stearns wrote:
>> Confirmed.  It works. (You do have to give a full pathname to the  
>> script file.)
>>
> Thats a known bug/feature of 3.9+
>
> Installer-Launcher (part of LPF) does fix it amongst other things.


How so? Where would it get the cwd from?

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Macintosh command line script?

Bert Freudenberg
In reply to this post by keith1y
On 30.05.2008, at 21:09, Keith Hodges wrote:

> Howard Stearns wrote:
>> Confirmed.  It works. (You do have to give a full pathname to the  
>> script file.)
>>
> Thats a known bug/feature of 3.9+
>
> Installer-Launcher (part of LPF) does fix it amongst other things.


How so? Where does it get cwd from?

- Bert -