|
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
">6. Procedure specificationsThe most common Green Card directive is a procedure specification. It describes the interface to a C procedure. A procedure specification has four parts:
Any of these parts may be omitted except the type signature. If any part is missing, Green Card will fill in a suitable statement based on the type signature given in the %fun statement. For example, consider the sin procedure specification again:
Green Card fills in the missing statements like this: [1]
The rules that guide this automatic fill-in are described in Section 8. A procedure specification can define a procedure with no input parameter, or even a constant (a ``procedure'' with no input parameters and no side effects). In the following example, printBang is an example of the former, while grey is an example of the latter: [2]
All the C variables bound in the %call statement or mentioned in the %result statement, are declared by Green Card and in scope throughout the body. In the examples above, Green Card would have declared arg1, res1 and r. Notes
|