Module <tt>main</tt>

HANDBOOK / LIBRARY REFERENCE MANUAL /

# Module `main`

For compilers generated with Gentle a C function `main` must be provided. This function must call the generated function `ROOT`, which has no parameters and elaborates the `'root'` clause of the Gentle specification. In the simplest case the procedure `main` could have the form

    main() { ROOT(); }

In addition the function `main` may contain code for initialization and finalization. The parameters of main provide access to the Unix command arguments.

The library provides a simple version of `main`. It implements a command with none or one argument. If no argument is specified, standard input is used as source file. If one argument is specified, this is taken as name of the source file.