net.java.games.gluegen

Interface GlueEmitter

Known Implementing Classes:
DebugEmitter, JavaEmitter

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(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary, net.java.games.gluegen.cgram.types.TypeDictionary structDictionary, Map canonMap)
void
beginStructLayout()
Begins the process of computing field offsets and type sizes for the structs to be emitted.
void
beginStructs(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary, net.java.games.gluegen.cgram.types.TypeDictionary structDictionary, Map canonMap)
void
emitDefine(String name, String value, String optionalComment)
Iterator
emitFunctions(java.util.List cFunctions)
Emit glue code for the list of FunctionSymbols.
void
emitStruct(net.java.games.gluegen.cgram.types.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(net.java.games.gluegen.cgram.types.CompoundType t)
Lays out one struct which will be emitted later.
void
readConfigurationFile(String filename)
void
setMachineDescription(net.java.games.gluegen.cgram.types.MachineDescription md)
Set the description of the underlying hardware.

Method Details

beginDefines

public void beginDefines()
            throws Exception

beginEmission

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

beginFunctions

public void beginFunctions(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary,
                           net.java.games.gluegen.cgram.types.TypeDictionary structDictionary,
                           Map canonMap)
            throws Exception

beginStructLayout

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

beginStructs

public void beginStructs(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary,
                         net.java.games.gluegen.cgram.types.TypeDictionary structDictionary,
                         Map canonMap)
            throws Exception

emitDefine

public void emitDefine(String name,
                       String value,
                       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.

emitFunctions

public Iterator emitFunctions(java.util.List cFunctions)
            throws Exception
Emit glue code for the list of FunctionSymbols.

emitStruct

public void emitStruct(net.java.games.gluegen.cgram.types.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.

endDefines

public void endDefines()
            throws Exception

endEmission

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

endFunctions

public void endFunctions()
            throws Exception

endStructLayout

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

endStructs

public void endStructs()
            throws Exception

layoutStruct

public void layoutStruct(net.java.games.gluegen.cgram.types.CompoundType t)
            throws Exception
Lays out one struct which will be emitted later.

readConfigurationFile

public void readConfigurationFile(String filename)
            throws Exception

setMachineDescription

public void setMachineDescription(net.java.games.gluegen.cgram.types.MachineDescription md)
Set the description of the underlying hardware.