Primitive help needed: object from signed-32bit int

Mark A. Schwenk mas at wellthot.com
Tue Feb 9 21:06:30 UTC 1999


Dan,

Thanks for the quick response. I'll try one of your workarounds for the
moment (probably 1). I've been looking a bit at other Smalltalk
implementations interfaces to C code and have been thinking of working on
Squeak's interface to C. Do you have anything on your wishlist related to
this or any design pointers for how you'd like to see this done?

I've played a bit with the SqueakPlugin interface but had some problems with
my primitives needing to call routines in another shared library. I didn't
see an easy way to load in the additional library, using the current setup.

Thanks for your support!

-Mark Schwenk

-----Original Message-----
From: Dan Ingalls <DanI at wdi.disney.com>
To: Mark A. Schwenk <mas at wellthot.com>
Cc: squeak at cs.uiuc.edu <squeak at cs.uiuc.edu>
Date: Tuesday, February 09, 1999 2:22 PM
Subject: Re: Primitive help needed: object from signed-32bit int


>>I attempted to write a version that would work with both negative and
>>positive longs, but I couldn't find an example of how to instantiate a
>>non-special class from the primitive world.
>
>Mark -
>
>It's true there is no simple way to do this.  Just to get you going though,
here are two possibilities off the top of my head:
>
>1.  Arrange to pass IN a LargeNegativeInteger to be cloned, or class LNI to
be instantiated, and use that.
>
>2.  Pass your 32-bit value back as a LargePositiveInteger, and then use
logic like...
>
> valueAsLPI := self primitiveZort.
> signedValue := (valueAsLPI bitAnd: 16r80000000) = 0
> ifTrue: [valueAsLPI]
> ifFalse: [(valueAsLPI bitInvert32 + 1) negated]
>
>Hope this helps.
>
> - Dan
>
>





More information about the Squeak-dev mailing list