next up previous contents
Next: Types with specific bit Up: Miscellaneous definitions Previous: Miscellaneous definitions   Contents


Simple types

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_FALSE failure. 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:

      typedef enum { GAN_CHAR, GAN_UCHAR, GAN_SHORT, GAN_USHORT,
                     GAN_INT,  GAN_UINT,  GAN_LONG,  GAN_ULONG,
      #if (SIZEOF_LONG_LONG != 0)
                     GAN_LONGLONG,
      #endif
                     GAN_FLOAT, GAN_DOUBLE, GAN_LONGDOUBLE,
                     GAN_STRING, GAN_BOOL, GAN_POINTER }
        Gan_Type;
Note that the GAN_LONGLONG value is only defined if the configure program finds the long long C type, and is able to determine its size. The array gan_type_sizes[] holds the sizes of each Gan_Type value:
      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 instance GAN_INT_MAXF and GAN_INT_MAXD are the float and double versions of INT_MAX.



2003-02-12