net.java.games.gluegen

Class JavaEmitter

Implemented Interfaces:
GlueEmitter

public class JavaEmitter
extends java.lang.Object
implements GlueEmitter

Method Summary

void
beginDefines()
void
beginEmission(GlueEmitterControls controls)
void
beginFunctions(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary, net.java.games.gluegen.cgram.types.TypeDictionary structDictionary, Map canonMap)
void
beginStructLayout()
void
beginStructs(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary, net.java.games.gluegen.cgram.types.TypeDictionary structDictionary, Map canonMap)
protected boolean
bindingNeedsBody(MethodBinding binding)
protected PrintWriter
cWriter()
protected JavaConfiguration
createConfig()
Create the object that will read and store configuration information for this JavaEmitter.
protected void
emitAllFileFooters()
Write out any footer information for the output files (closing brace of class definition, etc).
protected void
emitAllFileHeaders()
Write out any header information for the output files (class declaration and opening brace, import statements, etc).
protected void
emitCHeader(PrintWriter cWriter, String className)
protected void
emitCustomJavaCode(PrintWriter writer, String className)
Emit all the strings specified in the "CustomJavaCode" parameters of the configuration file.
void
emitDefine(String name, String value, String optionalComment)
Iterator
emitFunctions(List originalCFunctions)
void
emitStruct(net.java.games.gluegen.cgram.types.CompoundType structType, String alternateName)
void
endDefines()
void
endEmission()
void
endFunctions()
void
endStructLayout()
void
endStructs()
protected List
generateMethodBindingEmitters(net.java.games.gluegen.cgram.types.FunctionSymbol sym)
Generate all appropriate Java bindings for the specified C function symbols.
protected JavaConfiguration
getConfig()
Get the configuration information for this JavaEmitter.
protected String
getImplPackageName()
Returns the value that was specified by the configuration directive "ImplPackage", or the default if none was specified.
protected String
getJavaOutputDir()
Returns the value that was specified by the configuration directive "JavaOutputDir", or the default if none was specified.
protected String
getJavaPackageName()
Returns the value that was specified by the configuration directive "Package", or the default if none was specified.
protected PrintWriter
javaImplWriter()
protected PrintWriter
javaWriter()
void
layoutStruct(net.java.games.gluegen.cgram.types.CompoundType t)
protected PrintWriter
openFile(String filename)
void
readConfigurationFile(String filename)
void
setMachineDescription(net.java.games.gluegen.cgram.types.MachineDescription md)

Method Details

beginDefines

public void beginDefines()
            throws Exception
Specified by:
beginDefines in interface GlueEmitter

beginEmission

public void beginEmission(GlueEmitterControls controls)
            throws IOException
Specified by:
beginEmission in interface GlueEmitter

beginFunctions

public void beginFunctions(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary,
                           net.java.games.gluegen.cgram.types.TypeDictionary structDictionary,
                           Map canonMap)
            throws Exception
Specified by:
beginFunctions in interface GlueEmitter

beginStructLayout

public void beginStructLayout()
            throws Exception
Specified by:
beginStructLayout in interface GlueEmitter

beginStructs

public void beginStructs(net.java.games.gluegen.cgram.types.TypeDictionary typedefDictionary,
                         net.java.games.gluegen.cgram.types.TypeDictionary structDictionary,
                         Map canonMap)
            throws Exception
Specified by:
beginStructs in interface GlueEmitter

bindingNeedsBody

protected boolean bindingNeedsBody(MethodBinding binding)

cWriter

protected PrintWriter cWriter()

createConfig

protected JavaConfiguration createConfig()
Create the object that will read and store configuration information for this JavaEmitter.

emitAllFileFooters

protected void emitAllFileFooters()
Write out any footer information for the output files (closing brace of class definition, etc).

emitAllFileHeaders

protected void emitAllFileHeaders()
            throws IOException
Write out any header information for the output files (class declaration and opening brace, import statements, etc).

emitCHeader

protected void emitCHeader(PrintWriter cWriter,
                           String className)

emitCustomJavaCode

protected void emitCustomJavaCode(PrintWriter writer,
                                  String className)
            throws Exception
Emit all the strings specified in the "CustomJavaCode" parameters of the configuration file.

emitDefine

public void emitDefine(String name,
                       String value,
                       String optionalComment)
            throws Exception
Specified by:
emitDefine in interface GlueEmitter

emitFunctions

public Iterator emitFunctions(List originalCFunctions)
            throws Exception

emitStruct

public void emitStruct(net.java.games.gluegen.cgram.types.CompoundType structType,
                       String alternateName)
            throws Exception
Specified by:
emitStruct in interface GlueEmitter

endDefines

public void endDefines()
            throws Exception
Specified by:
endDefines in interface GlueEmitter

endEmission

public void endEmission()
Specified by:
endEmission in interface GlueEmitter

endFunctions

public void endFunctions()
            throws Exception
Specified by:
endFunctions in interface GlueEmitter

endStructLayout

public void endStructLayout()
            throws Exception
Specified by:
endStructLayout in interface GlueEmitter

endStructs

public void endStructs()
            throws Exception
Specified by:
endStructs in interface GlueEmitter

generateMethodBindingEmitters

protected List generateMethodBindingEmitters(net.java.games.gluegen.cgram.types.FunctionSymbol sym)
            throws Exception
Generate all appropriate Java bindings for the specified C function symbols.

getConfig

protected JavaConfiguration getConfig()
Get the configuration information for this JavaEmitter.

getImplPackageName

protected String getImplPackageName()
Returns the value that was specified by the configuration directive "ImplPackage", or the default if none was specified.

getJavaOutputDir

protected String getJavaOutputDir()
Returns the value that was specified by the configuration directive "JavaOutputDir", or the default if none was specified.

getJavaPackageName

protected String getJavaPackageName()
Returns the value that was specified by the configuration directive "Package", or the default if none was specified.

javaImplWriter

protected PrintWriter javaImplWriter()

javaWriter

protected PrintWriter javaWriter()

layoutStruct

public void layoutStruct(net.java.games.gluegen.cgram.types.CompoundType t)
            throws Exception
Specified by:
layoutStruct in interface GlueEmitter

openFile

protected PrintWriter openFile(String filename)
            throws IOException

readConfigurationFile

public void readConfigurationFile(String filename)
            throws Exception
Specified by:
readConfigurationFile in interface GlueEmitter

setMachineDescription

public void setMachineDescription(net.java.games.gluegen.cgram.types.MachineDescription md)
Specified by:
setMachineDescription in interface GlueEmitter