Wiki source for getAttributeIntoLength


Show raw source

======**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
length an agreed upon length for the storage area.

**return**: char*, or sucess(0) to fail primitive.
**From**: Interpreter
**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 arguments passed to the program via the cmd line
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**
//os-9/OSXCarbon//
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


//Cocoa://
if indexNumber < 0 and negated is between 1 and the number of arguments then return the start up argument as a char*
if indexNumber is > 0 and if you subtract 2 from it and it is between 1 and the number of arguments then return the startup argument as char*
indexNumber = 1001, return 'Mac OS'
indexNumber = 1002, return Gestalt(gestaltSystemVersion
indexNumber = 1003, return Gestalt(gestaltSysArchitecture
indexNumber = 1004, return CFBundleShortVersionString and interpreterVersion
indexNumber = 1005, return 'Aqua'
indexNumber = 1006, return build string, which is say "Mac Cocoa 5.7b1 15-Jun-10 >34286DE5-3BD3-40D8-9700-4C41C772B16B<"
or maybe "Mac Cocoa Cog 5.8b10 07-Sep-10 >8AD3A516-DBAC-4CD4-BC89-8F21317DF7E1<
indexNumber = 1007, if stack vm return __interpBuildInfo
indexNumber = 1008, if cog vm return __cogitBuildInfo

**iPhone**
if indexNumber < 0 and negated is between 1 and the number of arguments then return the start up argument as a char*
{However on the iPhone it's hard to say how you would pass in an argument since there is no cmd-line interface}
if indexNumber is > 0 and if you subtract 2 from it and it is between 1 and the number of arguments then return the startup argument as char*
indexNumber = 1001, return iPhone
indexNumber = 1002, return iPhone BUG
indexNumber = 1003, return iPhone BUG
indexNumber = 1004, return CFBundleShortVersionString and interpreterVersion
indexNumber = 1006, return build string, which is say 'iPhone 1.0.1b1 18-May-08 >1B1BAAE0-F4CA-4192-B3E5-4FE51E5BB820<'
indexNumber = 1007, if stack vm return __interpBuildInfo
indexNumber = 1008, if cog vm return __cogitBuildInfo
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**
if indexNumber is > 0 and <= 1000 return image options
if indexNumber is < 0 return VM options
indexNumber = 1001, return Win32
indexNumber = 1002, return NT, 95, CE
indexNumber = 1003, return SH, MIPS, IX86
indexNumber = 1004, return interpreterVersion
indexNumber = 1005, return Win32
indexNumber = 1006, return vmBuildString
indexNumber = 10001, return hwInfoString
indexNumber = 10002, return osInfoString
indexNumber = 10003, return gdInfoString

**BUGS**
If attributeSize(1) followed by getAttribute(1) does not return the same sized element the results will be bogus.
Possible memory corruption can occur.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki