Package com.jogamp.gluegen.procaddress
Class ProcAddressEmitter
- java.lang.Object
-
- com.jogamp.gluegen.JavaEmitter
-
- 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, JavaEmitter.Ownership
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>
emittedTableEntries
static String
PROCADDRESS_VAR_PREFIX
Must be synchronized w/ ProcAddressTable.PROCADDRESS_VAR_PREFIX !!!protected String
tableClassName
protected String
tableClassPackage
protected JavaCodeUnit
tableJavaUnit
protected static String
WRAP_PREFIX
-
Fields inherited from class com.jogamp.gluegen.JavaEmitter
cfg, LOG
-
-
Constructor Summary
Constructors Constructor Description ProcAddressEmitter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginFunctions(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap, List<FunctionSymbol> cFunctions)
protected void
beginProcAddressTable()
void
beginStructs(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap)
protected boolean
callThroughProcAddress(FunctionSymbol sym)
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 void
fixSecurityModifiers(JavaMethodBindingEmitter javaEmitter)
If 'native', enforce 'private native' modifiers.protected List<? extends FunctionEmitter>
generateMethodBindingEmitters(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
hasFunctionPointerTypedef(FunctionSymbol sym)
protected boolean
needsModifiedEmitters(FunctionSymbol sym)
String
runtimeExceptionType()
String
unsupportedExceptionType()
-
Methods inherited from class com.jogamp.gluegen.JavaEmitter
addStrings2Buffer, beginDefines, beginEmission, beginStructLayout, cUnit, emitAllFileFooters, emitAllFileHeaders, emitCustomJavaCode, emitCustomJNICode, emitDefine, emitFunctions, emitStruct, endDefines, endEmission, endStructLayout, endStructs, expandMethodBinding, generatePrivateEmitters, generatePublicEmitters, getClassAccessModifiers, getConfig, getImplPackageName, getJavaOutputDir, getJavaPackageName, getJNIMethodNamePrefix, javaImplUnit, javaUnit, jniMangle, layoutStruct, mangleBinding, openCUnit, openJavaUnit, prepCEmitter, readConfigurationFile
-
-
-
-
Field Detail
-
PROCADDRESS_VAR_PREFIX
public static final String PROCADDRESS_VAR_PREFIX
Must be synchronized w/ ProcAddressTable.PROCADDRESS_VAR_PREFIX !!!- See Also:
- Constant Field Values
-
WRAP_PREFIX
protected static final String WRAP_PREFIX
- See Also:
- Constant Field Values
-
tableJavaUnit
protected JavaCodeUnit tableJavaUnit
-
tableClassPackage
protected String tableClassPackage
-
tableClassName
protected String tableClassName
-
-
Method Detail
-
beginFunctions
public void beginFunctions(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap, List<FunctionSymbol> cFunctions) throws Exception
- Specified by:
beginFunctions
in interfaceGlueEmitter
- Overrides:
beginFunctions
in classJavaEmitter
- Throws:
Exception
-
endFunctions
public void endFunctions() throws Exception
- Specified by:
endFunctions
in interfaceGlueEmitter
- Overrides:
endFunctions
in classJavaEmitter
- Throws:
Exception
-
beginStructs
public void beginStructs(TypeDictionary typedefDictionary, TypeDictionary structDictionary, Map<Type,Type> canonMap) throws Exception
- Specified by:
beginStructs
in interfaceGlueEmitter
- Overrides:
beginStructs
in classJavaEmitter
- 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 classJavaEmitter
-
generateMethodBindingEmitters
protected List<? extends FunctionEmitter> generateMethodBindingEmitters(FunctionSymbol sym) throws Exception
Description copied from class:JavaEmitter
Generate all appropriate Java bindings for the specified C function symbols.- Overrides:
generateMethodBindingEmitters
in classJavaEmitter
- 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.
-
fixSecurityModifiers
protected void fixSecurityModifiers(JavaMethodBindingEmitter javaEmitter)
If 'native', enforce 'private native' modifiers.
-
generateModifiedEmitters
protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List<FunctionEmitter> emitters)
-
generateModifiedEmitters
protected void generateModifiedEmitters(CMethodBindingEmitter baseCEmitter, List<FunctionEmitter> emitters)
-
callThroughProcAddress
protected boolean callThroughProcAddress(FunctionSymbol sym)
-
hasFunctionPointerTypedef
protected boolean hasFunctionPointerTypedef(FunctionSymbol sym)
-
emitProcAddressTableEntryForString
protected void emitProcAddressTableEntryForString(String str)
-
getProcAddressConfig
protected ProcAddressConfiguration getProcAddressConfig()
-
-