If used as a parameter type, the parameter must be a Character whose numeric value is between 0 and 255. The parameter is converted to a C char. If used as a return value, the low 8 bits of the return value are converted to a
Character before returning to Smalltalk.
All instances of Character are converted. This means that the passed-in values will be between 0 and 65535 and the low 16 bits of the return value are converted to a
Character on return.
For outgoing parameters, only true or
false can be converted. The passed parameter is TRUE for
true, FALSE for
false. As a return type, 0 is converted to
false, and all other values are converted to
true. The passed value for
true is platform-dependent. The value of !0 in C is passed.
If used as a parameter type, the parameter must be an Integer that can be represented in 32 bits or 64 bits,
Character,
Boolean, or
nil (see
Passed parameters). Instances of
OSObject with
reftype immediate (namely
true,
false,
nil,
Characters, and
SmallIntegers) can also be used (see
OSObjects). If used as a return type, the low n (8, 16, 32, 64) bits of the return value are sign- or zero-extended (signed or unsigned, respectively) and then converted to a Smalltalk
Integer. The return value in Smalltalk is guaranteed to be within these given ranges:
As a parameter type, this is an amalgamation of the struct,
char,
bool, and
int type conversions. If the parameter is a byte, word, or long object or
nil, the
struct conversion is performed. If the parameter is
true or
false, the
bool conversion is performed. If the parameter is a
Character, the
char16 conversion is performed. If the parameter is an
Integer, the
uint32 conversion is performed on a 32-bit virtual machine or a
uint64 on a 64-bit virtual machine.
Instances of OSObject can also be supplied as the parameter. If the
OSObject reftype is handle, the handle is dereferenced and the offset is added. All other objects cause the conversion to fail. If used as a return type, the
uint32 conversion is performed on a 32-bit virtual machine or a
uint64 on a 64-bit virtual machine.
For example, if the first argument in a C function is a int * (i.e. pointer), then the first argument type of the associated platform function is best expressed as
pointer. Defining the argument type instead as an
int16 is not only semantically incorrect, but it will also be functionally incorrect in many cases since the incoming pointer value will be truncated to 16 bits.
Copyright 2005, 2017 Instantiations, Inc. All rights reserved.