|
GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java (public API).
|
Emits the C-side component of the Java<->C JNI binding to its CodeUnit, see FunctionEmitter.
More...
Classes | |
| class | DefaultCommentEmitter |
| Class that emits a generic comment for CMethodBindingEmitters; the comment includes the C signature of the native method that is being bound by the emitter java method. More... | |
Public Member Functions | |
| CMethodBindingEmitter (final MethodBinding binding, final CodeUnit unit, final String javaPackageName, final String javaClassName, final boolean isOverloadedBinding, final boolean isJavaMethodStatic, final boolean forImplementingMethodCall, final boolean forIndirectBufferAndArrayImplementation, final MachineDataInfo machDesc, final JavaConfiguration configuration) | |
| Constructs an emitter for the specified binding, and sets a default comment emitter that will emit the signature of the C function that is being bound. More... | |
| String | getInterfaceName () |
| String | getImplName () |
| String | getNativeName () |
| FunctionSymbol | getCSymbol () |
| final MessageFormat | getReturnValueCapacityExpression () |
| Get the expression for the capacity of the returned java.nio.Buffer. More... | |
| final void | setReturnValueCapacityExpression (final MessageFormat expression) |
| If this function returns a void* encapsulated in a java.nio.Buffer (or compound type wrapper), sets the expression for the capacity of the returned Buffer. More... | |
| final MessageFormat | getReturnValueLengthExpression () |
| Get the expression for the length of the returned array. More... | |
| final void | setReturnValueLengthExpression (final MessageFormat expression) |
| If this function returns an array, sets the expression for the length of the returned array. More... | |
| final List< String > | getTemporaryCVariableDeclarations () |
| Returns the List of Strings containing declarations for temporary C variables to be assigned to after the underlying function call. More... | |
| final void | setTemporaryCVariableDeclarations (final List< String > arg) |
| Sets up a List of Strings containing declarations for temporary C variables to be assigned to after the underlying function call. More... | |
| final List< String > | getTemporaryCVariableAssignments () |
| Returns the List of Strings containing assignments for temporary C variables which are made after the underlying function call. More... | |
| final void | setTemporaryCVariableAssignments (final List< String > arg) |
| Sets up a List of Strings containing assignments for temporary C variables which are made after the underlying function call. More... | |
| String | getJavaPackageName () |
| Get the name of the class in which the corresponding Java method resides. More... | |
| String | getJavaClassName () |
| Get the name of the package in which the corresponding Java method resides. More... | |
| final boolean | getIsOverloadedBinding () |
| Is the Java<->C JNI binding for this emitter's MethodBinding one of several overloaded methods with the same name? More... | |
| final boolean | getIsJavaMethodStatic () |
| Is the Java side of the Java<->C JNI binding for this emitter's MethodBinding a static method?. More... | |
| final boolean | forIndirectBufferAndArrayImplementation () |
| Is this CMethodBindingEmitter implementing the case of an indirect buffer or array being passed down to C code? More... | |
| final MachineDataInfo | getMachineDataInfo () |
| Used for certain internal type size computations. More... | |
| boolean | emitBodyMapCToJNIType (final int argIdx, final boolean addLocalVar) |
| Emit code, converting a C type into a java JNI-type. More... | |
Public Member Functions inherited from com.jogamp.gluegen.FunctionEmitter | |
| FunctionEmitter (final MethodBinding binding, final CodeUnit unit, final boolean isInterface, final JavaConfiguration configuration) | |
| Constructs the FunctionEmitter with a CommentEmitter that emits nothing. More... | |
| FunctionEmitter (final FunctionEmitter arg) | |
| Makes this FunctionEmitter a copy of the passed one. More... | |
| final boolean | isInterface () |
| final MethodBinding | getBinding () |
| final CodeUnit | getUnit () |
| void | addModifiers (final Iterator< EmissionModifier > mi) |
| void | addModifier (final EmissionModifier m) |
| boolean | removeModifier (final EmissionModifier m) |
| void | clearModifiers () |
| boolean | hasModifier (final EmissionModifier m) |
| Iterator< EmissionModifier > | getModifiers () |
| abstract String | getInterfaceName () |
| abstract String | getImplName () |
| abstract String | getNativeName () |
| abstract FunctionSymbol | getCSymbol () |
| final void | emit () |
Emit the function to the getUnit(). More... | |
| String | toString () |
| void | setCommentEmitter (final CommentEmitter cEmitter) |
| Set the object that will emit the comment for this function. More... | |
| CommentEmitter | getCommentEmitter () |
| Get the comment emitter for this FunctionEmitter. More... | |
Static Public Member Functions | |
| static StringBuilder | appendJNIMangledArgs (final MethodBinding binding, final boolean forIndirectBufferAndArrayImplementation, final StringBuilder buf) |
| Return the mangled JNI argument names of given binding. More... | |
Protected Member Functions | |
| StringBuilder | appendReturnType (final StringBuilder buf) |
| StringBuilder | appendName (final StringBuilder buf) |
| String | getImplSuffix () |
| int | appendArguments (final StringBuilder buf) |
| Returns the number of arguments emitted. More... | |
| void | emitAdditionalCode () |
| void | emitBody () |
| void | emitBodyVariableDeclarations () |
| void | emitBodyUserVariableDeclarations () |
| Emits the user-defined C variable declarations from the TemporaryCVariableDeclarations directive in the .cfg file. More... | |
| boolean | isUTF8Type (Type type) |
| Checks a type to see whether it is for a UTF-8 pointer type (i.e., "const char *", "const char **"). More... | |
| void | emitBodyVariablePreCallSetup () |
| Code to init the variables that were declared in emitBodyVariableDeclarations(), PRIOR TO calling the actual C function. More... | |
| void | emitBodyVariablePostCallCleanup () |
| Code to clean up any variables that were declared in emitBodyVariableDeclarations(), AFTER calling the actual C function. More... | |
| int | emitBodyPassCArguments () |
| Returns the number of arguments passed so calling code knows whether to print a comma. More... | |
| void | setIsCStructFunctionPointer (final boolean v) |
If method originates from a struct, see MethodBinding#hasContainingType(), it can either purposed to call a native static function (default) or a struct's function pointer. More... | |
| void | emitBodyCallCFunction () |
| void | emitBodyUserVariableAssignments () |
| Emits the user-defined C variable assignments from the TemporaryCVariableAssignments directive in the .cfg file. More... | |
| String | jniMangle (final MethodBinding binding) |
| String | byteOffsetArgName (final int i) |
| String | isNIOArgName (final int i) |
| String | isNIOArgName (final String s) |
| String | byteOffsetArrayArgName (final int i) |
| String[] | argumentNameArray () |
| String | pointerConversionArgumentName (final String argName) |
| boolean | javaArgTypeNeedsDataCopy (final JavaType javaArgType) |
Protected Member Functions inherited from com.jogamp.gluegen.FunctionEmitter | |
| void | emitAdditionalCode () |
| void | emitDocComment () |
| final void | emitSignature () |
| StringBuilder | appendSignature (final StringBuilder buf) |
| final int | emitModifiers () |
| int | appendModifiers (final StringBuilder buf) |
| String | getBaseIndentString () |
| String | getCommentStartString () |
| String | getCommentEndString () |
| final void | emitReturnType () |
| abstract StringBuilder | appendReturnType (StringBuilder buf) |
| final void | emitName () |
| abstract StringBuilder | appendName (StringBuilder buf) |
| final int | emitArguments () |
| Returns the number of arguments emitted. More... | |
| abstract int | appendArguments (StringBuilder buf) |
| Returns the number of arguments emitted. More... | |
| abstract void | emitBody () |
Static Protected Member Functions | |
| static String | cThisArgumentName () |
Protected Attributes | |
| final LoggerIf | LOG |
| boolean | forImplementingMethodCall |
| boolean | forIndirectBufferAndArrayImplementation |
| MachineDataInfo | machDesc |
Protected Attributes inherited from com.jogamp.gluegen.FunctionEmitter | |
| final MethodBinding | binding |
| final CodeUnit | unit |
| final JavaConfiguration | cfg |
Static Protected Attributes | |
| static final CommentEmitter | defaultCommentEmitter = new DefaultCommentEmitter() |
| static final String | arrayResLength = "_array_res_length" |
| static final String | arrayRes = "_array_res" |
| static final String | arrayIdx = "_array_idx" |
| static final String | STRING_CHARS_PREFIX = "_strchars_" |
Additional Inherited Members | |
Static Public Attributes inherited from com.jogamp.gluegen.FunctionEmitter | |
| static final EmissionModifier | STATIC = new EmissionModifier("static") |
Emits the C-side component of the Java<->C JNI binding to its CodeUnit, see FunctionEmitter.
Definition at line 58 of file CMethodBindingEmitter.java.
| com.jogamp.gluegen.CMethodBindingEmitter.CMethodBindingEmitter | ( | final MethodBinding | binding, |
| final CodeUnit | unit, | ||
| final String | javaPackageName, | ||
| final String | javaClassName, | ||
| final boolean | isOverloadedBinding, | ||
| final boolean | isJavaMethodStatic, | ||
| final boolean | forImplementingMethodCall, | ||
| final boolean | forIndirectBufferAndArrayImplementation, | ||
| final MachineDataInfo | machDesc, | ||
| final JavaConfiguration | configuration | ||
| ) |
Constructs an emitter for the specified binding, and sets a default comment emitter that will emit the signature of the C function that is being bound.
Definition at line 127 of file CMethodBindingEmitter.java.
|
protected |
Returns the number of arguments emitted.
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Reimplemented in com.jogamp.gluegen.procaddress.ProcAddressCMethodBindingEmitter.
Definition at line 359 of file CMethodBindingEmitter.java.
|
static |
Return the mangled JNI argument names of given binding.
| binding | |
| forIndirectBufferAndArrayImplementation | If true, this CMethodBindingEmitter implements the case of an indirect buffer or array being passed down to C code, otherwise false. |
| buf |
Definition at line 1308 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 335 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 327 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1663 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1647 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1659 of file CMethodBindingEmitter.java.
|
staticprotected |
Definition at line 1283 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 416 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 423 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented in com.jogamp.gluegen.procaddress.ProcAddressCMethodBindingEmitter.
Definition at line 1022 of file CMethodBindingEmitter.java.
| boolean com.jogamp.gluegen.CMethodBindingEmitter.emitBodyMapCToJNIType | ( | final int | argIdx, |
| final boolean | addLocalVar | ||
| ) |
Emit code, converting a C type into a java JNI-type.
The resulting JNI value is assigned to a local JNI variable named cArgName+"_jni" with cArgName = binding.getArgumentName(argIdx) or cArgName = "_res".
| argIdx | -1 is return value, [0..n] is argument index |
| addLocalVar | if true, emit instantiating the local JNI variable. |
Definition at line 1069 of file CMethodBindingEmitter.java.
|
protected |
Returns the number of arguments passed so calling code knows whether to print a comma.
Definition at line 948 of file CMethodBindingEmitter.java.
|
protected |
Emits the user-defined C variable assignments from the TemporaryCVariableAssignments directive in the .cfg file.
Definition at line 1050 of file CMethodBindingEmitter.java.
|
protected |
Emits the user-defined C variable declarations from the TemporaryCVariableDeclarations directive in the .cfg file.
Definition at line 539 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented in com.jogamp.gluegen.procaddress.ProcAddressCMethodBindingEmitter.
Definition at line 442 of file CMethodBindingEmitter.java.
|
protected |
Code to clean up any variables that were declared in emitBodyVariableDeclarations(), AFTER calling the actual C function.
Definition at line 815 of file CMethodBindingEmitter.java.
|
protected |
Code to init the variables that were declared in emitBodyVariableDeclarations(), PRIOR TO calling the actual C function.
Reimplemented in com.jogamp.gluegen.procaddress.ProcAddressCMethodBindingEmitter.
Definition at line 584 of file CMethodBindingEmitter.java.
| final boolean com.jogamp.gluegen.CMethodBindingEmitter.forIndirectBufferAndArrayImplementation | ( | ) |
Is this CMethodBindingEmitter implementing the case of an indirect buffer or array being passed down to C code?
Definition at line 319 of file CMethodBindingEmitter.java.
| FunctionSymbol com.jogamp.gluegen.CMethodBindingEmitter.getCSymbol | ( | ) |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 183 of file CMethodBindingEmitter.java.
| String com.jogamp.gluegen.CMethodBindingEmitter.getImplName | ( | ) |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 174 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 347 of file CMethodBindingEmitter.java.
| String com.jogamp.gluegen.CMethodBindingEmitter.getInterfaceName | ( | ) |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 170 of file CMethodBindingEmitter.java.
| final boolean com.jogamp.gluegen.CMethodBindingEmitter.getIsJavaMethodStatic | ( | ) |
Is the Java side of the Java<->C JNI binding for this emitter's MethodBinding a static method?.
Definition at line 313 of file CMethodBindingEmitter.java.
| final boolean com.jogamp.gluegen.CMethodBindingEmitter.getIsOverloadedBinding | ( | ) |
Is the Java<->C JNI binding for this emitter's MethodBinding one of several overloaded methods with the same name?
Definition at line 307 of file CMethodBindingEmitter.java.
| String com.jogamp.gluegen.CMethodBindingEmitter.getJavaClassName | ( | ) |
Get the name of the package in which the corresponding Java method resides.
Definition at line 301 of file CMethodBindingEmitter.java.
| String com.jogamp.gluegen.CMethodBindingEmitter.getJavaPackageName | ( | ) |
Get the name of the class in which the corresponding Java method resides.
Definition at line 295 of file CMethodBindingEmitter.java.
| final MachineDataInfo com.jogamp.gluegen.CMethodBindingEmitter.getMachineDataInfo | ( | ) |
Used for certain internal type size computations.
Definition at line 324 of file CMethodBindingEmitter.java.
| String com.jogamp.gluegen.CMethodBindingEmitter.getNativeName | ( | ) |
Reimplemented from com.jogamp.gluegen.FunctionEmitter.
Definition at line 178 of file CMethodBindingEmitter.java.
| final MessageFormat com.jogamp.gluegen.CMethodBindingEmitter.getReturnValueCapacityExpression | ( | ) |
Get the expression for the capacity of the returned java.nio.Buffer.
Definition at line 190 of file CMethodBindingEmitter.java.
| final MessageFormat com.jogamp.gluegen.CMethodBindingEmitter.getReturnValueLengthExpression | ( | ) |
Get the expression for the length of the returned array.
Definition at line 225 of file CMethodBindingEmitter.java.
| final List< String > com.jogamp.gluegen.CMethodBindingEmitter.getTemporaryCVariableAssignments | ( | ) |
Returns the List of Strings containing assignments for temporary C variables which are made after the underlying function call.
A null argument indicates that no manual assignments are to be made.
Definition at line 278 of file CMethodBindingEmitter.java.
| final List< String > com.jogamp.gluegen.CMethodBindingEmitter.getTemporaryCVariableDeclarations | ( | ) |
Returns the List of Strings containing declarations for temporary C variables to be assigned to after the underlying function call.
Definition at line 259 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1651 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1655 of file CMethodBindingEmitter.java.
|
protected |
Checks a type to see whether it is for a UTF-8 pointer type (i.e., "const char *", "const char **").
False implies that this type is for a Unicode pointer type ("jchar *", "jchar **").
Definition at line 551 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1705 of file CMethodBindingEmitter.java.
|
protected |
Reimplemented in com.jogamp.gluegen.procaddress.ProcAddressCMethodBindingEmitter.
Definition at line 1287 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 1675 of file CMethodBindingEmitter.java.
|
protected |
If method originates from a struct, see MethodBinding#hasContainingType(), it can either purposed to call a native static function (default) or a struct's function pointer.
Definition at line 1018 of file CMethodBindingEmitter.java.
| final void com.jogamp.gluegen.CMethodBindingEmitter.setReturnValueCapacityExpression | ( | final MessageFormat | expression | ) |
If this function returns a void* encapsulated in a java.nio.Buffer (or compound type wrapper), sets the expression for the capacity of the returned Buffer.
| expression | a MessageFormat which, when applied to an array of type String[] that contains each of the arguments names of the Java-side binding, returns an expression that will (when compiled by a C compiler) evaluate to an integer-valued expression. The value of this expression is the capacity of the java.nio.Buffer returned from this method. |
| IllegalArgumentException | if the binding.getJavaReturnType().isNIOBuffer() == false and binding.getJavaReturnType().isCompoundTypeWrapper() == false |
Definition at line 211 of file CMethodBindingEmitter.java.
| final void com.jogamp.gluegen.CMethodBindingEmitter.setReturnValueLengthExpression | ( | final MessageFormat | expression | ) |
If this function returns an array, sets the expression for the length of the returned array.
| expression | a MessageFormat which, when applied to an array of type String[] that contains each of the arguments names of the Java-side binding, returns an expression that will (when compiled by a C compiler) evaluate to an integer-valued expression. The value of this expression is the length of the array returned from this method. |
| IllegalArgumentException | if the binding.getJavaReturnType().isNIOBuffer() == false |
Definition at line 244 of file CMethodBindingEmitter.java.
| final void com.jogamp.gluegen.CMethodBindingEmitter.setTemporaryCVariableAssignments | ( | final List< String > | arg | ) |
Sets up a List of Strings containing assignments for temporary C variables which are made after the underlying function call.
A null argument indicates that no manual assignments are to be made.
Definition at line 287 of file CMethodBindingEmitter.java.
| final void com.jogamp.gluegen.CMethodBindingEmitter.setTemporaryCVariableDeclarations | ( | final List< String > | arg | ) |
Sets up a List of Strings containing declarations for temporary C variables to be assigned to after the underlying function call.
A null argument indicates that no manual declarations are to be made.
Definition at line 268 of file CMethodBindingEmitter.java.
|
staticprotected |
Definition at line 64 of file CMethodBindingEmitter.java.
|
staticprotected |
Definition at line 63 of file CMethodBindingEmitter.java.
|
staticprotected |
Definition at line 62 of file CMethodBindingEmitter.java.
|
staticprotected |
Definition at line 60 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 87 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 88 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 66 of file CMethodBindingEmitter.java.
|
protected |
Definition at line 117 of file CMethodBindingEmitter.java.
|
staticprotected |
Definition at line 114 of file CMethodBindingEmitter.java.