Programmer's Reference

Parameter types and return types

The supported parameter types and return types are:

none, void
This is not a valid parameter type. If it is used as the return type, the return value of the Smalltalk message is ignored and no value is returned to the caller of the EsEntryPoint.

char, char8
If it is used as a parameter type, the low eight bits of the parameter are converted to a Character whose numeric value is between 0 and 255. If it is used as a return type, the return value from the Smalltalk message must be a Character whose numeric value is between 0 and 255.

char16
If it is used as a parameter type, the low 16 bits of the parameter are converted to a Character. If it is used as a return type, the return value from the Smalltalk message must be a Character.

bool, boolean
If it is used as a parameter type, the low eight bits of the parameter are tested for 0. If they are 0, false is passed to the Smalltalk message. If they are not 0, true is passed. If it is used as a return type, only true or false can be converted. The return value is TRUE for true, and FALSE for false.

The return value for true is platform-dependent. In C it is the value of !0.

int8, int16, int32, uint8, uint16, uint32
If it is used as a parameter type, the low 8, 16 or 32 bits of the parameter are converted to an Integer that is in the specified range. If it is used as a return type, the return value must be an Integer (see Returned parameters). The integer ranges are as follows:
int8
-128...127
int16
-32768...32767
int32
-2147483648...2147483647
uint8
0...255
uint16
0...65535
uint32
0...4294967295

struct
If it is used as a parameter type, the parameter is converted using uint32 conversion. If it is used as a return type, the return value must be a byte, word, or long object or a non-immediate OSObject. nil is returned as 0.

pointer
If used as a parameter type, the parameter is converted using uint32 conversion. If it is used as a return type, this is an amalgamation of struct, char, bool, and int type conversions. For a given parameter type, the conversion performed is as follows:
byte object, word object, long object, nil
struct
true, false
bool
Character
char16
Integer
uint32
OSObject
struct

All other objects cause the conversion to fail.

safePointer
If it is used as a parameter type, this is the same as pointer conversion. If it is used as a return type, the parameter can be a fixed byte, word, or long object. Instances of OSObject can also be supplied as the parameter provided they are non-immediate.

If an OSObject whose reference is a byte, word, or long object is returned, the reference must be in fixed space. This is also true for byte, word, or long objects that are returned directly.

Returned parameters

All values returned to external language functions are extended to a 32-bit quantity before being returned. Signed integers are sign-extended; unsigned integers are zero-extended. All the int types perform the same conversion when converting from IBM Smalltalk objects to external language values. For example, -1 can be returned as a uint32 or a uint8. Both result in 0xFFFFFFFF being returned.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]