asdlGen Reference Manual : Views : Adding User Code
Previous: Interpretation of View Entry Values
Next: Other Properties

5.2. Adding User Code

It is useful to be able to add arbitrary user code to the modules produced by asdlGen. Modules have six properties that can be set to allow the addition of user code. strings.

interface_prologue

Include text verbatim after the introduction of the base environment, but before any type defined in the module interface.

interface_epilogue

Include text verbatim after all types defined in the module interface have been defined.

implementation_prologue

Include text verbatim after the introduction of the base environment, but before any other implementation code is defined.

implementation_epilogue

Include text verbatim after all definitions defined in the module implementation.

suppress

Default value is false. Do not produce any code for this module, assume it's implementation is written by hand. It's often a good idea to first generate code and then set the flag, so the generated code can be used as stubs for the user implementation.

is_library

Default value is false. If true assume all types can be used as lists or options and generate any needed code, rather then generating list and option code on demand. Useful for generating stubs.

The precise meaning of interface and implementation for the different languages is as follows

C

The interface is the .h file and the implementation is the .c file.

C++

The interface is the .hxx file and the implementation is the .cxx file.

Java

Java has no notion of interfaces so this property is ignored. The implementation_prologue is placed outside the class definition of a Java class that contains package wide global constants. The implementation_epilogue is placed inside the class definition of a Java class that contains package wide global constants.

ML

The interface is the generated signature the implementation is the structure.

Haskell

The interface is the export list of the module. The implementation is the module body.


asdlGen Reference Manual : Views : Adding User Code
Previous: Interpretation of View Entry Values
Next: Other Properties