plugin primitive with 32 bit parameters, how?

Ragnar Hojland Espinosa ragnar at linalco.com
Fri Sep 26 08:31:50 UTC 2003


On Thu, Sep 25, 2003 at 10:27:57AM -0700, John M McIntosh wrote:
> Yes, see file plugin
> 
> EXPORT(int) primitiveFileRead(void) {
>     size_t byteSize;
>     size_t count;
>     int array;
>     SQFile * file;
>     int bytesRead;
>     size_t startIndex;
>     char * arrayIndex;
>     int objectPointer;
> 
> 	count =  
> interpreterProxy->positive32BitValueOf(interpreterProxy- >stackValue(0));
> 	startIndex =  
> interpreterProxy->positive32BitValueOf(interpreterProxy- >stackValue(1));
> 
> 
> In your plugin say  it is a Oops parameter, then invoke  
> positive32BitValueOf against it to get the integer.

Thanks, I changed it into this and looks like it works :)

primitiveCursesEchoChar: aChar 
        | longchar result |
	  
	self var: #longchar declareC: 'unsigned long longchar'.
        self var: #result declareC: 'int result'.
        self primitive: 'primitiveCursesEchoChar' parameters: #(Oop).
  	longchar _ self positive32BitValueOf: aChar.
        self cCode: 'result = ncurses_echochar (longchar)'.
        ^ result asOop: Boolean.

-- 
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