[previous] [up] [next]     [contents] [index]
Next: Compile-time Switches Up: Function and Method Declarations Previous: Parameters

Code Inserts

C++ code!inserting literal The inserts part of a function declaration can be used to specify macro calls resolving to C++ code to be inserted at various points in the glue code. The inserts section has this form:

[CS-inserts] [: [SC-inserts] [: [exception] [: [virtual]]]]

CS-inserts specifies code for the C++-to-Scheme glue function (only generated when the method is virtual). It has this form:

[start [/ [pre-call] [/ [post-call] [/ end]]]]

where each item is a macro call. The expansion of start will be inserted into the glue function right after the variable declarations. pre-call is inserted just before the Scheme function is called. post-call is inserted just after the Scheme call, and end is inserted just before the C++ function returns a value.

SC-inserts has the same form as CS-inserts; it is used in the Scheme-to-C++ glue function (which is always generated).

exception can be a macro call that expands to an expression for the return value of the C++-to-Scheme glue function; it is used in the event of an error in Scheme execution. The special macro SUPER SUPER calls the C++-defined version of the function. SUPER is not allowed for pure virtual functions; it is the default for all other functions.

If virtual is specified, it is used in place of exception when the function is pure virtual.



PLT