<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1170" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>James,</FONT></DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT
size=2></FONT> </DIV>
<DIV><FONT size=2>This won't work. The image side equivalent of stObjectat() is
#basicAt: and NOT #at: as one might expect. That's because when you use
stObjectat() the primitive code which is equivalent to #basicAt: is being
executed.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The bottom line here is: Don't ever use complex composite
objects in primitives (OrderedCollection, Stream, etc) - only use primitive
forms (Integer, Array) as far far as possible. It's simple to handle on the
image side (instead of "self doPrimitivieWith: foo" just use "self
doPrimitiveWith: foo asArray") and it's terribly hard to deal with the
complexities from the primitives.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Cheers,</FONT></DIV>
<DIV><FONT size=2> - Andreas</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=jgjerde@contrarymotion.com
href="mailto:jgjerde@contrarymotion.com">James Gjerde</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=squeak-dev@lists.squeakfoundation.org
href="mailto:squeak-dev@lists.squeakfoundation.org">The general-purpose Squeak
developers list</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, March 13, 2004 10:42
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Q] accessing an
OrderedCollection from c source plugin</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>i am trying to access some string literals in a
smalltalk OrderedCollection that is passed as an arg to a named
primtive.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>in smalltalk:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> primMyPrimitive:
anOrderedCollectionOfStrings</FONT></DIV>
<DIV><FONT face=Arial size=2>
<primtive:'primMyPrimitive' module:'foo'></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>the c source:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> EXPORT(int)
primMyPrimitive(void) {</FONT></DIV>
<DIV><FONT face=Arial size=2> </FONT></DIV>
<DIV><FONT face=Arial size=2> int
collectionOop, strElementOop;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
collectionOop = interpreterProxy->stackObjectValue(0);</FONT></DIV>
<DIV><FONT face=Arial size=2>
strElementOop = interpreterProxy->stObjectat(collectionOop,
1);</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>now i know there is data at index 1, but this
method is erroring out in squeak. i am writing the c source myself. is there
some sort of cast i need to do with the origianl collectionOop in order for it
to work with stObjectat? does stObjectat not know that collectionOop
represents an OrderedCollection? i just want to be able to get the oops of the
elements in the OrderedCollection, i would know how to extract the string
values once i got them, problem is i cannot get the oops.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>i would certainly appreciate any
help.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>jamie</FONT></DIV></FONT></DIV>
<P>
<HR>
<P></P><BR></BLOCKQUOTE></BODY></HTML>