There are two sorts of objects that Prolog may want to handle: atomic and compound. Atomic objects include numbers and atoms, and compound objects include data structures and arrays. To be more precise about it, an atomic type is defined by one of the following. A long integer is 64 bits on DEC Alpha platforms and 32 bits on other Quintus Prolog platforms. Long integers are however truncated to 32 bits (sign-extended) by the Prolog system:
structsdoes no type checking for you. Represented as a Prolog integer.
And compound types are defined by one of:
C programmers will recognize that the kinds of data supported by this package were designed for the C language. They should also work for other languages, but programmers must determine the proper type declarations in those languages. The table above makes clear the storage requirements and interpretation of each type.
Note that there is one important difference between the
and C: the
structs package permits declarations of pointers to arrays.
A pointer to an array is distinguished from a pointer to a single
element. For example
is probably a more appropriate declaration of a C string type than
which is the orthodox way to declare a string in C. Note that the
structs_to_c tool described below does generate proper (identical)
C declarations for both of these