Top Inners Fields Constructors Methods
com.jogamp.gluegen

public Class JavaEmitter

extends Object
implements GlueEmitter
Class Inheritance
All Implemented Interfaces
com.jogamp.gluegen.GlueEmitter
Known Direct Subclasses
com.jogamp.gluegen.procaddress.ProcAddressEmitter, com.jogamp.gluegen.structgen.CStructAnnotationProcessor.AnnotationProcessorJavaStructEmitter
Static Imports
com.jogamp.gluegen.JavaEmitter.MethodAccess.PACKAGE_PRIVATE, .JavaEmitter.MethodAccess.PRIVATE, .JavaEmitter.MethodAccess.PROTECTED, .JavaEmitter.MethodAccess.PUBLIC, .JavaEmitter.MethodAccess.PUBLIC_ABSTRACT, java.util.logging.Level.FINE, .Level.INFO, .Level.WARNING

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
public static enum
JavaEmitter.EmissionStyle

Style of code emission.

public static enum
JavaEmitter.MethodAccess

Access control for emitted Java methods.

Field Summary

Modifier and TypeField and Description
private Map<Type, Type>
protected JavaConfiguration
private String
private final Map<String, ConstantDefinition.JavaExpr>
private PrintWriter
private static final String
private static final Type
private String
private PrintWriter
private PrintWriter
private StructLayout
protected final Logging.LoggerIf
private final MachineDataInfo
private final MachineDataInfo.StaticConfig[]
private static final String
private static final String
private static final String
private boolean
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
addStrings2Buffer(StringBuilder buf, final String sep, final String first, final Collection<String> col)

public void
public void
beginEmission(final GlueEmitterControls controls)

Implements com.jogamp.gluegen.GlueEmitter.beginEmission.

Begin the emission of glue code.
public void
beginFunctions(final TypeDictionary typedefDictionary, final TypeDictionary structDictionary, final Map<Type, Type> canonMap)

Implements com.jogamp.gluegen.GlueEmitter.beginFunctions.

public void
beginStructLayout()

Implements com.jogamp.gluegen.GlueEmitter.beginStructLayout.

Begins the process of computing field offsets and type sizes for the structs to be emitted.
public void
beginStructs(final TypeDictionary typedefDictionary, final TypeDictionary structDictionary, final Map<Type, Type> canonMap)

Implements com.jogamp.gluegen.GlueEmitter.beginStructs.

private MethodBinding
bindFunction(FunctionSymbol sym, final boolean forInterface, final MachineDataInfo curMachDesc, final JavaType containingType, final Type containingCType)

Maps the C types in the specified function to Java types through the MethodBinding interface.

private Type
canonicalize(final Type t)

private final String
capitalizeString(final String string)

Converts first letter to upper case.

protected String
private void
closeWriter(final PrintWriter writer)

private void
private String
compatiblePrimitiveJavaTypeName(final Type fieldType, final JavaType javaType, final MachineDataInfo curMachDesc)

protected JavaConfiguration
createConfig()

Create the object that will read and store configuration information for this JavaEmitter.

protected PrintWriter
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(final PrintWriter cWriter, final String packageName, final String className)

protected void
emitCInitCode(final PrintWriter cWriter, final String packageName, final String className)

protected void
emitCustomJavaCode(final PrintWriter writer, final String className)

Emit all the strings specified in the "CustomJavaCode" parameters of the configuration file.

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

Implements com.jogamp.gluegen.GlueEmitter.emitDefine.

public Iterator<FunctionSymbol>
emitFunctions(final List<FunctionSymbol> funcsToBind)

Implements com.jogamp.gluegen.GlueEmitter.emitFunctions.

Emit glue code for the list of FunctionSymbols.
protected void
emitJavaInitCode(final PrintWriter jWriter, final String className)

public void
emitStruct(final CompoundType structCType, final Type structCTypedefPtr)

Implements com.jogamp.gluegen.GlueEmitter.emitStruct.

Emit glue code for the given CompoundType.
public void
public void
endEmission()

Implements com.jogamp.gluegen.GlueEmitter.endEmission.

Finish the emission of glue code.
public void
public void
endStructLayout()

Implements com.jogamp.gluegen.GlueEmitter.endStructLayout.

Finishes the struct layout process.
public void
protected List<MethodBinding>
private void
generateArrayGetterSetterCode(final Set<MethodBinding> methodBindingSet, final PrintWriter javaWriter, final PrintWriter jniWriter, final CompoundType structCType, final String structCTypeName, final String structClassPkgName, final Type containingCType, final JavaType containingJType, final int i, final Field field, final String fieldName, final String returnSizeLookupName)

private void
generateArrayPointerCode(final Set<MethodBinding> methodBindingSet, final PrintWriter javaWriter, final PrintWriter jniWriter, final String structCTypeName, final String structClassPkgName, final Type containingCType, final JavaType containingJType, final int i, final FunctionSymbol funcSym, final String returnSizeLookupName, final String docArrayLenExpr, final String nativeArrayLenExpr)

private void
generateFunctionPointerCode(final Set<MethodBinding> methodBindingSet, final PrintWriter javaWriter, final PrintWriter jniWriter, final String structCTypeName, final String structClassPkgName, final Type containingCType, final JavaType containingJType, final int i, final FunctionSymbol funcSym, final String returnSizeLookupName)

private void
generateGetterSignature(final PrintWriter writer, final Type origFieldType, final boolean staticMethod, final boolean abstractMethod, final String returnTypeName, final String fieldName, final String capitalizedFieldName, final String customArgs, final String arrayLengthExpr)

protected List<? extends FunctionEmitter>
generateMethodBindingEmitters(final FunctionSymbol sym)

Generate all appropriate Java bindings for the specified C function symbols.

private void
generateMethodBindingEmittersImpl(final ArrayList<FunctionEmitter> allEmitters, final FunctionSymbol sym, final boolean forInterface)

private void
generateOffsetAndSizeArrays(final PrintWriter writer, final String prefix, final String fieldName, final Type fieldType, final Field field, final String postfix)

protected void
generatePrivateEmitters(final MethodBinding binding, final List<FunctionEmitter> allEmitters)

Generates the private emitters for this MethodBinding.

protected void
generatePublicEmitters(final MethodBinding binding, final List<FunctionEmitter> allEmitters, final boolean signatureOnly)

Generates the public emitters for this MethodBinding which will produce either simply signatures (for the interface class, if any) or function definitions with or without a body (depending on whether or not the implementing function can go directly to native code because it doesn't need any processing of the outgoing arguments).

private void
generateSetterSignature(final PrintWriter writer, final Type origFieldType, final boolean abstractMethod, final String returnTypeName, final String fieldName, final String capitalizedFieldName, final String customArgsPre, final String paramTypeName, final String customArgsPost, final String arrayLengthExpr)

private String
getArrayArrayLengthExpr(final ArrayType type, final String returnSizeLookupName, final boolean[] hasFixedTypeLen, final int[][] lengthRes)

public String[]
getClassAccessModifiers(final String classFQName)

protected JavaConfiguration
getConfig()

Get the configuration information for this JavaEmitter.

public JavaConfiguration
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 static String
getJNIMethodNamePrefix(final String javaPackageName, final String javaClassName)

Returns the JNI method prefix consisting our of mangled package- and class-name

private StructLayout
private String
getPointerArrayLengthExpr(final PointerType type, final String returnSizeLookupName)

private static boolean
isIntegerType(final Class<?> c)

private boolean
isJNIEnvPointer(final Type cType)

private boolean
isOpaque(final Type type)

protected String
protected PrintWriter
private JavaType
javaType(final Class<?> c)

protected PrintWriter
protected static String
jniMangle(final String name)

Mangle a class, package or function name for JNI usage, i.e. replace all '.' w/ '_'

public void
layoutStruct(final CompoundType t)

Implements com.jogamp.gluegen.GlueEmitter.layoutStruct.

Lays out one struct which will be emitted later.
private MethodBinding
lowerMethodBindingPointerTypes(final MethodBinding inputBinding, final boolean convertToArrays, final boolean[] canProduceArrayVariant)

protected void
mangleBinding(final MethodBinding binding)

Allow specializations to modify the given MethodBinding before expanding and emission.

protected PrintWriter

Returns:

a PrintWriter instance to write the class source file or null to suppress output!
openFile
(final String
the class's full filename to open w/ write access
filename
,
final String
the simple class name, i.e. w/o package name
simpleClassName
)

private void
protected void
prepCEmitter(final String returnSizeLookupName, final JavaType javaReturnType, final CMethodBindingEmitter cEmitter)

public void
private boolean
requiresGetCStringLength(final Type fieldType, final String returnSizeLookupName)

protected final boolean
requiresStaticInitialization(final String clazzName)

Returns true if implementation (java and native-code) requires staticClassInitCodeCCode and staticClassInitCallJavaCode and have initializeImpl() being called at static class initialization.

private JavaType
typeToJavaType(final Type cType, final MachineDataInfo curMachDesc)

private JavaType
typeToJavaTypeImpl(final Type cType, final MachineDataInfo curMachDesc)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait