com.jogamp.gluegen
Interface GlueEmitter

All Known Implementing Classes:
DebugEmitter, JavaEmitter, ProcAddressEmitter

public interface GlueEmitter

Specifies the interface by which GlueGen requests glue code to be generated. Can be replaced to generate glue code for other languages and foreign function interfaces.


Method Summary
 void beginDefines()
           
 void beginEmission(GlueEmitterControls controls)
          Begin the emission of glue code.
 void beginFunctions(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap)
           
 void beginStructLayout()
          Begins the process of computing field offsets and type sizes for the structs to be emitted.
 void beginStructs(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap)
           
 void emitDefine(ConstantDefinition def, String optionalComment)
           
 Iterator<FunctionSymbol> emitFunctions(List<FunctionSymbol> cFunctions)
          Emit glue code for the list of FunctionSymbols.
 void emitStruct(CompoundType t, String alternateName)
          Emit glue code for the given CompoundType.
 void endDefines()
           
 void endEmission()
          Finish the emission of glue code.
 void endFunctions()
           
 void endStructLayout()
          Finishes the struct layout process.
 void endStructs()
           
 void layoutStruct(CompoundType t)
          Lays out one struct which will be emitted later.
 void readConfigurationFile(String filename)
           
 void setMachineDescription(MachineDescription md32, MachineDescription md64)
          Sets the description of the underlying hardware.
 

Method Detail

readConfigurationFile

void readConfigurationFile(String filename)
                           throws Exception
Throws:
Exception

setMachineDescription

void setMachineDescription(MachineDescription md32,
                           MachineDescription md64)
Sets the description of the underlying hardware. "md32" specifies the description of a 32-bit version of the underlying CPU architecture. "md64" specifies the description of a 64-bit version of the underlying CPU architecture. At least one must be specified. When both are specified, the bulk of the glue code is generated using the 32-bit machine description, but structs are laid out twice and the base class delegates between the 32-bit and 64-bit implementation at run time. This allows Java code which can access both 32-bit and 64-bit versions of the data structures to be included in the same jar file.

It is up to the end user to provide the appropriate opaque definitions to ensure that types of varying size (longs and pointers in particular) are exposed to Java in such a way that changing the machine description does not cause different shared glue code to be generated for the 32- and 64-bit ports.


beginEmission

void beginEmission(GlueEmitterControls controls)
                   throws Exception
Begin the emission of glue code. This might include opening files, emitting class headers, etc.

Throws:
Exception

endEmission

void endEmission()
                 throws Exception
Finish the emission of glue code. This might include closing files, closing open class definitions, etc.

Throws:
Exception

beginDefines

void beginDefines()
                  throws Exception
Throws:
Exception

emitDefine

void emitDefine(ConstantDefinition def,
                String optionalComment)
                throws Exception
Parameters:
optionalComment - If optionalComment is non-null, the emitter can emit that string as a comment providing extra information about the define.
Throws:
Exception

endDefines

void endDefines()
                throws Exception
Throws:
Exception

beginFunctions

void beginFunctions(TypeDictionary typedefDictionary,
                    TypeDictionary structDictionary,
                    Map<Type,Type> canonMap)
                    throws Exception
Throws:
Exception

emitFunctions

Iterator<FunctionSymbol> emitFunctions(List<FunctionSymbol> cFunctions)
                                       throws Exception
Emit glue code for the list of FunctionSymbols.

Throws:
Exception

endFunctions

void endFunctions()
                  throws Exception
Throws:
Exception

beginStructLayout

void beginStructLayout()
                       throws Exception
Begins the process of computing field offsets and type sizes for the structs to be emitted.

Throws:
Exception

layoutStruct

void layoutStruct(CompoundType t)
                  throws Exception
Lays out one struct which will be emitted later.

Throws:
Exception

endStructLayout

void endStructLayout()
                     throws Exception
Finishes the struct layout process.

Throws:
Exception

beginStructs

void beginStructs(TypeDictionary typedefDictionary,
                  TypeDictionary structDictionary,
                  Map<Type,Type> canonMap)
                  throws Exception
Throws:
Exception

emitStruct

void emitStruct(CompoundType t,
                String alternateName)
                throws Exception
Emit glue code for the given CompoundType. alternateName is provided when the CompoundType (e.g. "struct foo_t") has not been typedefed to anything but the type of "pointer to struct foo_t" has (e.g. "typedef struct foo_t {} *Foo"); in this case alternateName would be set to Foo.

Throws:
Exception

endStructs

void endStructs()
                throws Exception
Throws:
Exception