Utility

Technical Notes

Overview
Converting Pointers to Segments
Determining Conversion Status

Overview

This unit consists of miscellaneous functions and variables which are provided to support the Spontaneous Assembly library source code and C binder interface.

Converting Pointers to Segments

_ptr_to_seg
Converts a far pointer to a segment address (segaddr).
_ptr_to_seg converts a segment:offset far pointer into an equivalent segment address. If the far pointer does not point to an exact segment boundary, the returned segment address is always rounded up to the next higher segment boundary. If the far pointer points to a location in the high memory area (approximately the first 64 KB above the one megabyte boundary), an error condition is returned. The return value is of type segaddr (which denotes a segment address and is equivalent to unsigned int).

Determining Conversion Status

c_code
Contains the status of the most recent conversion.
The data conversion and date/time conversion functions return the status of the conversion through the global variable c_code. The status code is returned in a variable to maintain a smaller function profile; it also allows the status to be ignored or dealt with at a later time. The following symbolic constants (defined in UTIL.H) identify the possible values of c_code:
C_OFLOW
(0) Overflow occurred
C_SUCCESS
(1) Conversion was successful
C_UFLOW
(-1) Underflow was detected (no digits were encountered)
Specific return values for each function are specified in the reference section entry for each function which uses c_code.

UTIL.H is automatically included by DATACONV.H and DATETIME.H.