[Q] accessing an OrderedCollection from c source plugin

James Gjerde jgjerde at contrarymotion.com
Sun Mar 14 01:10:13 UTC 2004


i can use Array, and that works, i was able to extract the string literals from the array.

thanks again.

jamie

----- Original Message ----- 
  From: Andreas Raab 
  To: The general-purpose Squeak developers list 
  Sent: Saturday, March 13, 2004 4:47 PM
  Subject: Re: [Q] accessing an OrderedCollection from c source plugin


  James,

  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.

  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.

  Cheers,
    - Andreas

    ----- Original Message ----- 
    From: James Gjerde 
    To: The general-purpose Squeak developers list 
    Sent: Saturday, March 13, 2004 10:42 PM
    Subject: [Q] accessing an OrderedCollection from c source plugin


    hello,

    i am trying to access some string literals in a smalltalk OrderedCollection that is passed as an arg to a named primtive.

    in smalltalk:

        primMyPrimitive: anOrderedCollectionOfStrings
            <primtive:'primMyPrimitive' module:'foo'>

    the c source:

        EXPORT(int) primMyPrimitive(void) {
        
            int collectionOop, strElementOop;

            collectionOop = interpreterProxy->stackObjectValue(0);
            strElementOop = interpreterProxy->stObjectat(collectionOop, 1);
    }

    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.

    i would certainly appreciate any help.

    jamie


----------------------------------------------------------------------------






------------------------------------------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040313/8a428730/attachment.htm


More information about the Squeak-dev mailing list