[squeak-dev] Macintosh command line script?

John M McIntosh johnmci at smalltalkconsulting.com
Thu May 29 22:05:38 UTC 2008


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 <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
= 
= 
= 
========================================================================





More information about the Squeak-dev mailing list