Converting Smalltalk objects to C values
These functions enable users to convert Smalltalk objects into C values for processing in a user primitive.
char EsCharacterToChar(EsObject character)
Returns the char value of character.
Error cases: character is assumed to be a character. Some VA Smalltalk characters will not fit in a char. The return value in this case is unspecified.

U_16 EsCharacterToU16(EsObject character)
Returns the U_16 value of character.
Error cases: character is assumed to be a character.

U_32 EsFloatToCDouble(EsObject object, double * value)
Converts object to a C double and stores the result in the location pointed to by value. Returns an EsPrimErr code. If the return value is EsPrimErrNoError then *value is valid. Otherwise, *value is invalid.
Error cases: An error occurs if object is not a Float.
 
U_32 EsIntegerToI32(EsObject object, I_32 * value)
Converts object to a C signed 32-bit Integer and stores the result in the location pointed to by value. Returns an EsPrimErr code. If the return value is EsPrimErrNoError then *value is valid. Otherwise, *value is invalid.
Error cases: An error occurs if object is not a smallInteger or largeInteger. An error occurs if the value of the number cannot fit in 32 bits signed.

U_32 EsIntegerToU32(EsObject object, U_32 * value)
Converts object to a C unsigned 32-bit integer and stores the result in the location pointed to by value. Returns an EsPrimErr code. If the return value is EsPrimErrNoError then *value is valid. Otherwise, *value is invalid.
Error cases: An error occurs if object is not a smallInteger or largeInteger. An error occurs if the value of the number cannot fit in 32 bits unsigned.
 
U_32 EsIntegerToUPtr(EsObject object, U_PTR * value)
Converts object to a C unsigned pointer-width integer and stores the result in the location pointed to by value. Returns an EsPrimErr code. If the return value is EsPrimErrNoError then *value is valid. Otherwise, *value is invalid.
Error cases: An error occurs if object is not a smallInteger or largeInteger. An error occurs if the value of the number cannot fit in an unsigned pointer-width integer.
 
I_32 EsSmallIntegerToI32(EsObject smallInteger)
Returns the signed 32-bit value of smallInteger.
Error cases: smallInteger is assumed to be a SmallInteger.
 
Last modified date: 08/10/2017