plugin primitive with 32 bit parameters, how?
Ragnar Hojland Espinosa
ragnar at linalco.com
Sat Sep 27 18:49:46 UTC 2003
On Thu, Sep 25, 2003 at 10:27:57AM -0700, John M McIntosh wrote:
> In your plugin say it is a Oops parameter, then invoke
> positive32BitValueOf against it to get the integer.
After much crashing..
And now I have to ask on how to do it the other way, that is, from C
to squeak. I want to return a pointer (so really passing around an
int) I could return a SmallInteger or I could copy the 4 bytes to a
ByteArray in squeak.. is there a better way? All I saw were SmallIntegers..
primitiveCursesStdscr
| w |
self var: #w declareC: 'WINDOW* w'.
self primitive: 'primitiveCursesStdscr'.
self cCode: 'w = ncurses_getstdscr()'.
^ w asOop: SmallInteger
> On Thursday, September 25, 2003, at 09:07 AM, Ragnar Hojland Espinosa
> wrote:
>
> >I'm attempting to build an ncurses plugin (along with a rough guide on
> >the swiki) and I'm suck.
> >
> >Prototype of the function is:
> >
> > int echochar (unsigned long char);
> >
> >and this is what I have
> >
> >
> >primitiveCursesEchoChar: aChar
> > | result |
> >
> > self var: #result declareC: 'int result'.
> > self primitive:
> > 'primitiveCursesEchoChar'
> > parameters: #(SmallInteger).
> > self cCode:
> > 'result = ncurses_echochar (aChar)'
> > inSmalltalk: [result _ nil].
> > ^ result asOop: Boolean.
> >
> >does that mean the parameter passed to ncurses_echochar will be only
> >SmallInteger long? If so, is there a way to pass a 32 bit value other
> >than getting aChar as a LongInteger and then copying the bytes?
> >
> >--
> >Ragnar Hojland - Project Manager
> >Linalco "Specialists in Linux and Free Software"
> >http://www.linalco.com Tel: +34-91-5970074 Fax: +34-91-5970083
> >
> >
> >
> --
> ========================================================================
> ===
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
> ========================================================================
> ===
>
--
Ragnar Hojland - Project Manager
Linalco "Specialists in Linux and Free Software"
http://www.linalco.com Tel: +34-91-5970074 Fax: +34-91-5970083
More information about the Squeak-dev
mailing list
|