When working on a project which combines CAL and Java code there is
often a need to marshal data types between CAL and Java. The
mechanism which is generally used for this is to make a CAL data type
an instance of the Inputable and Outputable type classes.
To make a user defined type inputable and outputable, you would first
decide what the Java representation of the Quark type will be. The
input and output methods will convert between the Quark type and an
appropriate instance of this Java class.
A common approach is to define a foreign type for the target Java
class, write CAL functions that convert to and from that type, using
foreign functions, then convert to or from JObject using a foreign
function that merely casts between the target Java class and Object.
For more information please see the two documents 'CAL User's Guide'
and 'Java Meets Quark'.
The Input/Output code generation tool seeks to streamline the process
of making a CAL data type an instance of the Inputable and Outputable
type classes by generating the majority of the necessary CAL and Java
code.
The code generation tool takes an existing CAL data type and will
generate a corresponding Java class. It will then generate the
necessary CAL code to refer to the generated Java class as a CAL
foreign type, generate the CAL functions needed to convert between the
original CAL data type and the foreign type, and generate the type
class instance declarations to make the original data type an instance
of the Inputable and Outputable type classes.
The source generation tool is still under development. However, at
this point in time it has enough functionality to be useful, and is
ready for feedback from a wider audience.
Hope this will be of some interest,
Ray