next up previous contents index
Next: Output Up: Input Previous: Unparsing Definitions

   
Including Other Definitions

As will be presented later, Kimwitu generates a number of .h files, and a number of .c files that include those .h files. It may be necessary to include in those files additional C code or definitions, for instance because a type is defined that is used in the attribute declarations, or a function from a system library, such as math.h , is used in C code. The mechanism for this is similar to that of yacc, and the syntax for it is illustrated in the following example.

  


%{ /* these brackets should be at the beginning of a line */ #include <math.h> %}

Inclusions like these can appear anywhere between declarations. They go to the beginning of the .c file that is being generated from the .k file in which this construct appears.

In case it is necessary to make an inclusion in another file, the distinguished symbol  of that file can be used to redirect the inclusion, as in the following example. To make the same inclusion in several files, the redirection symbols of those files, separated by whitespace, can be given on the same line as the %{.


%{ KC_TYPES_HEADER /* Include this in k.h, and thus in every generated file. */ %}

For further information consult Section 2.4.


next up previous contents index
Next: Output Up: Input Previous: Unparsing Definitions

2000-04-17