The include directive is used to extract constants and
type definitions from C header files and put them into the equivalent
Cyclone header file. For example, here is part of the spec that we
use to interface to C's errno.h:
errno.h:
include { E2BIG EACCES EADDRINUSE ... }
The spec says that the Cyclone version of errno.h should use
the C definitions of error constants like E2BIG. These are
typically macro-defined as integers, but the integers can differ from
system to system. We ensure that Cyclone uses the right constants by
running buildlib on each system.
For another example, our spec for sys/types.h reads, in part:
sys/types.h:
include { id_t mode_t off_t pid_t ... }
Here the symbols are typedef names, and the result will be that the
Cyclone header file contains the typedefs that define id_t,
etc. Again, these can differ from system to system.
You can use include to obtain not just constants (macros) and
typedefs, but struct and union definitions as well. Furthermore, if a
definition you include requires any other definitions that
you do not explicitly include, those other definitions will
be placed into the Cyclone header too.
Currently, include does not work for variable or function
declarations. You have to use the hstub directive to add
variable and function declarations to your Cyclone header.