com.jogamp.gluegen.procaddress
Class ProcAddressEmitter

java.lang.Object
  extended by com.jogamp.gluegen.JavaEmitter
      extended by com.jogamp.gluegen.procaddress.ProcAddressEmitter
All Implemented Interfaces:
GlueEmitter

public class ProcAddressEmitter
extends JavaEmitter

A subclass of JavaEmitter that modifies the normal emission of C and Java code to allow dynamic lookups of the C entry points associated with the Java methods.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jogamp.gluegen.JavaEmitter
JavaEmitter.EmissionStyle, JavaEmitter.MethodAccess
 
Field Summary
protected  Set<String> emittedTableEntries
           
static String PROCADDRESS_VAR_PREFIX
           
protected  String tableClassName
           
protected  String tableClassPackage
           
protected  PrintWriter tableWriter
           
protected static String WRAP_PREFIX
           
 
Fields inherited from class com.jogamp.gluegen.JavaEmitter
cfg, LOG
 
Constructor Summary
ProcAddressEmitter()
           
 
Method Summary
 void beginFunctions(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap)
           
protected  void beginProcAddressTable()
           
 void beginStructs(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap)
           
protected  JavaConfiguration createConfig()
          Create the object that will read and store configuration information for this JavaEmitter.
protected  void emitProcAddressTableEntryForString(String str)
           
 void endFunctions()
           
protected  void endProcAddressTable()
           
protected  List<? extends FunctionEmitter> generateMethodBindingEmitters(Set<MethodBinding> methodBindingSet, FunctionSymbol sym)
          Generate all appropriate Java bindings for the specified C function symbols.
protected  void generateModifiedEmitters(CMethodBindingEmitter baseCEmitter, List<FunctionEmitter> emitters)
           
protected  void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List<FunctionEmitter> emitters)
           
protected  String getFunctionPointerTypedefName(FunctionSymbol sym)
          Returns the name of the typedef for a pointer to the function represented by the argument as defined by the ProcAddressNameExpr in the .cfg file.
protected  ProcAddressConfiguration getProcAddressConfig()
           
protected  boolean needsModifiedEmitters(FunctionSymbol sym)
           
protected  boolean needsProcAddressWrapper(FunctionSymbol sym)
           
 String runtimeExceptionType()
           
 String unsupportedExceptionType()
           
 
Methods inherited from class com.jogamp.gluegen.JavaEmitter
addStrings2Buffer, beginDefines, beginEmission, beginStructLayout, cWriter, emitAllFileFooters, emitAllFileHeaders, emitCHeader, emitCustomJavaCode, emitDefine, emitFunctions, emitStruct, endDefines, endEmission, endStructLayout, endStructs, expandMethodBinding, generatePrivateEmitters, generatePublicEmitters, getConfig, getImplPackageName, getJavaOutputDir, getJavaPackageName, getJavaRadix, getJavaType, getJavaType, getJavaValue, javaImplWriter, javaWriter, layoutStruct, openFile, prepCEmitter, readConfigurationFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCADDRESS_VAR_PREFIX

public static final String PROCADDRESS_VAR_PREFIX
See Also:
Constant Field Values

WRAP_PREFIX

protected static final String WRAP_PREFIX
See Also:
Constant Field Values

tableWriter

protected PrintWriter tableWriter

emittedTableEntries

protected Set<String> emittedTableEntries

tableClassPackage

protected String tableClassPackage

tableClassName

protected String tableClassName
Constructor Detail

ProcAddressEmitter

public ProcAddressEmitter()
Method Detail

beginFunctions

public void beginFunctions(TypeDictionary typedefDictionary,
                           TypeDictionary structDictionary,
                           Map<Type,Type> canonMap)
                    throws Exception
Specified by:
beginFunctions in interface GlueEmitter
Overrides:
beginFunctions in class JavaEmitter
Throws:
Exception

endFunctions

public void endFunctions()
                  throws Exception
Specified by:
endFunctions in interface GlueEmitter
Overrides:
endFunctions in class JavaEmitter
Throws:
Exception

beginStructs

public void beginStructs(TypeDictionary typedefDictionary,
                         TypeDictionary structDictionary,
                         Map<Type,Type> canonMap)
                  throws Exception
Specified by:
beginStructs in interface GlueEmitter
Overrides:
beginStructs in class JavaEmitter
Throws:
Exception

runtimeExceptionType

public String runtimeExceptionType()

unsupportedExceptionType

public String unsupportedExceptionType()

createConfig

protected JavaConfiguration createConfig()
Description copied from class: JavaEmitter
Create the object that will read and store configuration information for this JavaEmitter.

Overrides:
createConfig in class JavaEmitter

generateMethodBindingEmitters

protected List<? extends FunctionEmitter> generateMethodBindingEmitters(Set<MethodBinding> methodBindingSet,
                                                                        FunctionSymbol sym)
                                                                 throws Exception
Description copied from class: JavaEmitter
Generate all appropriate Java bindings for the specified C function symbols.

Overrides:
generateMethodBindingEmitters in class JavaEmitter
Throws:
Exception

needsModifiedEmitters

protected boolean needsModifiedEmitters(FunctionSymbol sym)

getFunctionPointerTypedefName

protected String getFunctionPointerTypedefName(FunctionSymbol sym)
Returns the name of the typedef for a pointer to the function represented by the argument as defined by the ProcAddressNameExpr in the .cfg file. For example, in the OpenGL headers, if the argument is the function "glFuncName", the value returned will be "PFNGLFUNCNAMEPROC". This returns a valid string regardless of whether or not the typedef is actually defined.


generateModifiedEmitters

protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter,
                                        List<FunctionEmitter> emitters)

generateModifiedEmitters

protected void generateModifiedEmitters(CMethodBindingEmitter baseCEmitter,
                                        List<FunctionEmitter> emitters)

needsProcAddressWrapper

protected boolean needsProcAddressWrapper(FunctionSymbol sym)

beginProcAddressTable

protected void beginProcAddressTable()
                              throws Exception
Throws:
Exception

endProcAddressTable

protected void endProcAddressTable()
                            throws Exception
Throws:
Exception

emitProcAddressTableEntryForString

protected void emitProcAddressTableEntryForString(String str)

getProcAddressConfig

protected ProcAddressConfiguration getProcAddressConfig()