Simple types (original) (raw)
Next: Types with specific bit Up: Miscellaneous definitions Previous: Miscellaneous definitions Contents A boolean type GAN_BOOL is defined:
typedef enum { GAN_FALSE=0, GAN_TRUE=1 } Gan_Bool;The boolean type is the standard type returned by a Gandalf function, where a return type of GAN_TRUE indicates success, GAN_FALSEfailure. Another use for the Gan_Bool type is with bit arrays and binary images. See Sections 2.3 and 4.4.
The Gan_Type enumerated type is used extensively to indicated different kinds of simple objects:
/// labels for simple types used throughout Gandalf
typedef enum
{
GAN_CHAR, /**< signed character */
GAN_UCHAR, /**< unsigned character */
GAN_SHORT, /**< signed short integer */
GAN_USHORT, /**< unsigned short integer */
GAN_INT, /**< signed integer */
GAN_UINT, /**< unsigned integer */
GAN_LONG, /**< signed long integer */
GAN_ULONG, /**< unsigned long integer */
#if (SIZEOF_LONG_LONG != 0)
GAN_LONGLONG, /**< signed extra-long integer */
#endif
GAN_FLOAT, /**< single precision floating point */
GAN_DOUBLE, /**< double precision floating point */
GAN_LONGDOUBLE, /**< long double precision floating point */
GAN_STRING, /**< string (array of characters) */
GAN_BOOL, /**< boolean */
GAN_POINTER /**< generic pointer */
} Gan_Type;Note that the GAN_LONGLONG value is only defined if the configureprogram finds the long long C type, and is able to determine its size. The array gan_type_sizes[] holds the sizes of each Gan_Typevalue:
/// array of sizeof()'s of each Gandalf type, one for each value in a Gan_Type
extern const size_t gan_type_sizes[];gan_type_sizes and the gan_debug boolean flag (see below) are the only global variables in Gandalf.
gan_type_sizes[]is a constant array, so it is thread-safe.
Gandalf also provides single and double precision floating point versions of the integer limit values found in <limits.h>. For instanceGAN_INT_MAXF and GAN_INT_MAXD are the float anddouble versions of INT_MAX.
2006-03-17