estack_to_ushort Function (ROM Call 0x2C8)

AMS 1.01 or higher estack.h

short estack_to_ushort (CESI ptr, unsigned short *value_ptr);

Converts entry on the expression stack to unsigned short integer.

estack_to_ushort converts an entry on the expression stack pointed to by ptr (it needs to point to the entry tag) to a unsigned short integer and stores the result in the location pointed to by value_ptr. Note that the entry need not be represented by POSINT_TAG or NEGINT_TAG: it also may be represented by FLOAT_TAG for example, but the value itself needs to be a whole number. This function does not remove the entry from the stack.

estack_to_short returns 1 if the conversion was successful, 0 in the case of overflow (in this case the stored result will be 0 or 65535 depending of the direction of the overflow), and -1 if the entry can not be represented as a whole number (in this case the result is undefined).


Uses: estack_to_float, is_whole_number, is0, _bcd_math, ROM Call 0x4E2
Used by: GetValue, cmd_cubicreg, cmd_expreg, cmd_linreg, cmd_lnreg, cmd_logistic, cmd_medmed, cmd_onevar, cmd_powerreg, cmd_quadreg, cmd_quartreg, cmd_sinreg, cmd_style, cmd_twovar, push_char, push_instring, push_left, push_mid, push_randpoly, push_right, push_rotate, push_shift, store_to_subscripted_element, ROM Call 0x4D1, ROM Call 0x5F1