plugin primitive with 32 bit parameters, how?

John M McIntosh johnmci at smalltalkconsulting.com
Thu Sep 25 17:27:57 UTC 2003


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.


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



More information about the Squeak-dev mailing list