Class JavaConfiguration
- java.lang.Object
-
- com.jogamp.gluegen.JavaConfiguration
-
- Direct Known Subclasses:
ProcAddressConfiguration
public class JavaConfiguration extends Object
Parses and provides access to the contents of .cfg files for the JavaEmitter.
-
-
Field Summary
Fields Modifier and Type Field Description protected Logging.LoggerIf
LOG
static String
NEWLINE
-
Constructor Summary
Constructors Constructor Description JavaConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaEmitter.MethodAccess
accessControl(String name)
Returns the access control for the given method-name or fully qualified class-name.protected void
addClassJavadoc(String className, String code)
protected void
addCustomJavaCode(String className, String code)
void
addDelegateImplementation(String origName, String renamedImpl)
Programmatically adds a delegate implementation directive for the given symbol.protected void
addJavaPrologueOrEpilogue(String methodName, String code, boolean prologue)
void
addJavaSymbolRename(String origName, String newName)
Programmatically adds a rename directive for the given symbol.protected void
addMethodJavadoc(String methodName, String code)
protected void
addTypeInfo(TypeInfo info)
TypeInfo
addTypeInfo(String alias, Type superType)
void
addUseNIODirectOnly(String fname)
void
addUseNIOOnly(String fname)
boolean
allStatic()
Returns true if the emission style is AllStatic.TypeInfo
canonicalNameOpaque(String canonicalName)
If the givencanonicalName
should be considered opaque, returns the TypeInfo describing the replacement type.static String
canonicalStructFieldSymbol(String structName, String fieldName)
Returns the canonical configuration name for a struct field name, i.e.String
className()
Returns the class name parsed from the configuration file.List<String>
customCCode()
Returns, as a List of Strings, the custom C code to be emitted along with the glue code for the main class.List<String>
customJavaCodeForClass(String className)
Returns a list of Strings containing user-implemented code for the given Java type name (not fully-qualified, only the class name); returns either null or an empty list if there is no custom code for the class.protected void
dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo)
protected void
doInclude(StringTokenizer tok, File file, String filename, int lineNo)
protected void
doIncludeAs(StringTokenizer tok, File file, String filename, int lineNo)
JavaEmitter.EmissionStyle
emissionStyle()
Returns the code emission style (constants in JavaEmitter) parsed from the configuration file.boolean
emitImpl()
Returns true if an implementing class should be emitted during glue code generation.boolean
emitInterface()
Returns true if an interface should be emitted during glue code generation.List<String>
extendedInterfaces(String interfaceName)
Returns a List of Strings indicating the interfaces the passed interface should declare it extends.String
extendedParentClass(String className)
Returns a List of Strings indicating the interfaces the passed class should declare it implements.List<String>
forcedStructs()
Returns, as a List of Strings, the structs for which glue code emission should be forced.boolean
forceStaticInitCode(String clazzName)
Returns true if the static initialization java code implementinginitializeImpl()
and the native code implementing:Set<String>
getAliasedDocNames(AliasedSymbol symbol)
Return a set of aliased-name for comment in docs.protected static ASTLocusTag
getASTLocusTag(AliasedSymbol s)
String
getDelegatedImplementation(AliasedSymbol symbol)
Returns theRENAMED-IMPL-SYMBOL
if the implementation of the glue code of the given function shall be manually delegated by the end user.String
getDelegatedImplementation(String functionName)
Variant ofgetDelegatedImplementation(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.String
getJavaSymbolRename(String origName)
Returns a replacement name for this function or definition which should be used as the Java name for the bound method or constant.JavaType
getOpaqueReturnType(AliasedSymbol symbol)
JavaType
getOpaqueReturnType(String functionName)
Variant ofgetOpaqueReturnType(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.Set<String>
getRenamedJavaSymbols(String aliasedName)
Returns a set of replaced names to the givenaliasedName
.String
gluegenRuntimePackage()
Returns the package in which the generated glue code expects to find its run-time helper classes (Buffers, Platform, StructAccessor).String
implClassName()
Returns the implementation class name parsed from the configuration file.List<String>
implementedInterfaces(String className)
Returns a List of Strings indicating the interfaces the passed class should declare it implements.String
implPackageName()
Returns the implementation package name parsed from the configuration file.List<String>
imports()
Returns the list of imports that should be emitted at the top of each .java file.boolean
isForceUsingNIOOnly4All()
boolean
isUnimplemented(AliasedSymbol symbol)
Returns true if this function should be given a body which throws a run-time exception with an "unimplemented" message during glue code generation.List<String>
javadocForClass(String className)
Returns a list of Strings containing Javadoc documentation for the given Java type name (not fully-qualified, only the class name); returns either null or an empty list if there is no Javadoc documentation for the class.List<String>
javadocForMethod(String methodName)
List<String>
javaEpilogueForMethod(MethodBinding binding, boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes)
Returns a list of Strings which should be emitted as an epilogue to the body for the Java-side glue code for the given method.String
javaOutputDir()
Returns the Java code output directory parsed from the configuration file.List<String>
javaPrologueForMethod(MethodBinding binding, boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes)
Returns a list of Strings which should be emitted as a prologue to the body for the Java-side glue code for the given method.void
logIgnores()
void
logIgnoresOnce()
void
logRenames()
void
logRenamesOnce()
boolean
manuallyImplement(AliasedSymbol symbol)
Returns true if the glue code for the given aliased function will be manually implemented by the end user.boolean
manuallyImplement(String functionName)
Variant ofmanuallyImplement(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.boolean
manualStaticInitCall(String clazzName)
Returns true if the static initialization java code callinginitializeImpl()
for the given class will be manually implemented by the end user as requested via configuration directiveManualStaticInitCall 'class-name'
.String
nativeOutputDir()
Returns the native code output directory parsed from the configuration file.boolean
nativeOutputUsesJavaHierarchy()
Returns whether the native code directory structure mirrors the Java hierarchy.static <K,V>
VoneInMap(Map<K,V> map, Set<K> symbols)
static <K> boolean
oneInSet(Set<K> set1, Set<K> set2)
String
packageForStruct(String structName)
Returns the package into which to place the glue code for accessing the specified struct.String
packageName()
Returns the package name parsed from the configuration file.protected static TypeInfo
parseTypeInfo(String cType, JavaType javaType)
void
read(String filename)
Reads the configuration file.protected void
read(String filename, String linePrefix)
Reads the specified file, treating each line as if it started with the specified string.protected void
readAccessControl(StringTokenizer tok, String filename, int lineNo)
protected void
readArgumentIsString(StringTokenizer tok, String filename, int lineNo)
When const char* arguments in the C function prototypes are encountered, the emitter will normally convert them tobyte[]
arguments.protected Boolean
readBoolean(String cmd, StringTokenizer tok, String filename, int lineNo)
protected void
readClassJavadoc(StringTokenizer tok, String filename, int lineNo)
protected void
readCustomCCode(StringTokenizer tok, String filename, int lineNo)
protected void
readCustomJavaCode(StringTokenizer tok, String filename, int lineNo)
void
readDelegateImplementation(StringTokenizer tok, String filename, int lineNo)
protected void
readExtend(StringTokenizer tok, String filename, int lineNo)
protected void
readExtendedIntfImplSymbols(StringTokenizer tok, String filename, int lineNo, boolean forInterface, boolean forImplementation, boolean onlyList)
protected void
readForceStaticInitCode(StringTokenizer tok, String filename, int lineNo)
protected void
readIgnore(StringTokenizer tok, String filename, int lineNo)
protected void
readIgnoreField(StringTokenizer tok, String filename, int lineNo)
protected void
readIgnoreNot(StringTokenizer tok, String filename, int lineNo)
protected void
readImplements(StringTokenizer tok, String filename, int lineNo)
protected void
readJavaPrologueOrEpilogue(StringTokenizer tok, String filename, int lineNo, boolean prologue)
protected void
readManuallyImplement(StringTokenizer tok, String filename, int lineNo)
protected void
readManualStaticInitCall(StringTokenizer tok, String filename, int lineNo)
protected void
readMethodJavadoc(StringTokenizer tok, String filename, int lineNo)
protected void
readOpaque(StringTokenizer tok, String filename, int lineNo)
protected void
readParentClass(StringTokenizer tok, String filename, int lineNo)
protected void
readRangeCheck(StringTokenizer tok, String filename, int lineNo, boolean inBytes)
protected void
readRenameJavaSymbol(StringTokenizer tok, String filename, int lineNo)
protected void
readRenameJavaType(StringTokenizer tok, String filename, int lineNo)
protected void
readReturnedArrayLength(StringTokenizer tok, String filename, int lineNo)
protected void
readReturnsOpaque(StringTokenizer tok, String filename, int lineNo)
protected void
readReturnsString(StringTokenizer tok, String filename, int lineNo)
protected void
readReturnValueCapacity(StringTokenizer tok, String filename, int lineNo)
protected void
readReturnValueLength(StringTokenizer tok, String filename, int lineNo)
protected String
readString(String cmd, StringTokenizer tok, String filename, int lineNo)
protected void
readStructMachineDataInfoIndex(StringTokenizer tok, String filename, int lineNo)
protected void
readStructPackage(StringTokenizer tok, String filename, int lineNo)
protected void
readTemporaryCVariableAssignment(StringTokenizer tok, String filename, int lineNo)
protected void
readTemporaryCVariableDeclaration(StringTokenizer tok, String filename, int lineNo)
protected void
readUnignore(StringTokenizer tok, String filename, int lineNo)
protected void
readUnimplemented(StringTokenizer tok, String filename, int lineNo)
boolean
relaxedEqualSemanticsTest()
Returns whetherTypeConfig.SemanticEqualityOp#equalSemantics(TypeConfig.SemanticEqualityOp)
shall attempt to perform a relaxed semantic equality test, e.g.String
renameJavaType(String javaTypeName)
Returns a replacement name for this type, which should be the name of a Java wrapper class for a C struct, or the name unchanged if no RenameJavaType directive was specified for this type.String
returnedArrayLength(String functionName)
Returns a MessageFormat string of the Java expression calculating the number of elements in the returned array from the specified function name.boolean
returnsString(AliasedSymbol symbol)
Indicates whether the given function (which returns achar*
in C) should be translated as returning ajava.lang.String
.boolean
returnsString(String functionName)
Indicates whether the given function (which returns achar*
in C) should be translated as returning ajava.lang.String
.String
returnStructMachineDataInfoIndex(String structName)
Returns a MessageFormat string of the Java code definingmdIdx
, i.e.String
returnValueCapacity(String functionName)
Returns a MessageFormat string of the C expression calculating the capacity of the java.nio.ByteBuffer being returned from a native method, or null if no expression has been specified.String
returnValueLength(String symbol)
Returns a MessageFormat string of the C expression calculating the length of the array being returned from a native method.String
runtimeExceptionType()
Returns the kind of exception to raise if run-time checks fail in the generated code.void
setOutputRootDir(String s)
boolean
shouldIgnoreInImpl(AliasedSymbol symbol)
Returns true if this aliased symbol should be ignored during glue code generation of implementation only.protected boolean
shouldIgnoreInImpl_Int(AliasedSymbol symbol)
boolean
shouldIgnoreInInterface(AliasedSymbol symbol)
Returns true if this aliased symbol should be ignored during glue code generation of interfaces and implementation.boolean
shouldIgnoreInInterface(String symbol)
Variant ofshouldIgnoreInInterface(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.protected boolean
shouldIgnoreInInterface_Int(AliasedSymbol symbol)
protected static boolean
startsWithDescriptor(String s)
List<Integer>
stringArguments(String functionName)
Returns a list ofInteger
s which are the indices ofconst char*
arguments that should be converted toString
s.protected Class<?>
stringToPrimitiveType(String type)
boolean
structsOnly()
boolean
tagNativeBinding()
Returns whether the comment of a native method binding should include a @native tag.List<String>
temporaryCVariableAssignments(String functionName)
Returns a List of Strings of expressions containing assignments to temporary C variables in the glue code for the specified function.List<String>
temporaryCVariableDeclarations(String functionName)
Returns a List of Strings of expressions declaring temporary C variables in the glue code for the specified function.TypeInfo
typeInfo(Type type)
If this type should be considered opaque, returns the TypeInfo describing the replacement type.String
unsupportedExceptionType()
Returns the kind of exception to raise if run-time checks fail in the generated code.boolean
useNIODirectOnly(String functionName)
Returns true if the given function should only create a java.nio variant, and no array variants, forvoid*
and other C primitive pointers.boolean
useNIOOnly(String functionName)
Returns true if the given function should only create a java.nio variant, and no array variants, forvoid*
and other C primitive pointers.
-
-
-
Field Detail
-
LOG
protected final Logging.LoggerIf LOG
-
NEWLINE
public static String NEWLINE
-
-
Method Detail
-
read
public final void read(String filename) throws IOException
Reads the configuration file.- Parameters:
filename
- path to file that should be read- Throws:
IOException
-
read
protected final void read(String filename, String linePrefix) throws IOException
Reads the specified file, treating each line as if it started with the specified string.- Parameters:
filename
- path to file that should be readlinePrefix
- if not null, treat each line read as if it were prefixed with the specified string.- Throws:
IOException
-
setOutputRootDir
public void setOutputRootDir(String s)
-
packageName
public String packageName()
Returns the package name parsed from the configuration file.
-
implPackageName
public String implPackageName()
Returns the implementation package name parsed from the configuration file.
-
className
public String className()
Returns the class name parsed from the configuration file.
-
implClassName
public String implClassName()
Returns the implementation class name parsed from the configuration file.
-
structsOnly
public boolean structsOnly()
-
javaOutputDir
public String javaOutputDir()
Returns the Java code output directory parsed from the configuration file.
-
nativeOutputDir
public String nativeOutputDir()
Returns the native code output directory parsed from the configuration file.
-
nativeOutputUsesJavaHierarchy
public boolean nativeOutputUsesJavaHierarchy()
Returns whether the native code directory structure mirrors the Java hierarchy.
-
tagNativeBinding
public boolean tagNativeBinding()
Returns whether the comment of a native method binding should include a @native tag.
-
relaxedEqualSemanticsTest
public boolean relaxedEqualSemanticsTest()
Returns whetherTypeConfig.SemanticEqualityOp#equalSemantics(TypeConfig.SemanticEqualityOp)
shall attempt to perform a relaxed semantic equality test, e.g. skip theconst
andvolatile
qualifier - or not.
-
emissionStyle
public JavaEmitter.EmissionStyle emissionStyle()
Returns the code emission style (constants in JavaEmitter) parsed from the configuration file.
-
accessControl
public JavaEmitter.MethodAccess accessControl(String name)
Returns the access control for the given method-name or fully qualified class-name.
-
gluegenRuntimePackage
public String gluegenRuntimePackage()
Returns the package in which the generated glue code expects to find its run-time helper classes (Buffers, Platform, StructAccessor). Defaults to "com.jogamp.gluegen.runtime".
-
runtimeExceptionType
public String runtimeExceptionType()
Returns the kind of exception to raise if run-time checks fail in the generated code.
-
unsupportedExceptionType
public String unsupportedExceptionType()
Returns the kind of exception to raise if run-time checks fail in the generated code.
-
imports
public List<String> imports()
Returns the list of imports that should be emitted at the top of each .java file.
-
canonicalNameOpaque
public TypeInfo canonicalNameOpaque(String canonicalName)
If the givencanonicalName
should be considered opaque, returns the TypeInfo describing the replacement type.Returns null if this type should not be considered opaque.
If symbol references a struct fields, see
canonicalStructFieldSymbol(String, String)
, it describes field's array-length or element-count referenced by a pointer.
-
typeInfo
public TypeInfo typeInfo(Type type)
If this type should be considered opaque, returns the TypeInfo describing the replacement type. Returns null if this type should not be considered opaque.
-
returnsString
public boolean returnsString(String functionName)
Indicates whether the given function (which returns achar*
in C) should be translated as returning ajava.lang.String
.
-
returnsString
public boolean returnsString(AliasedSymbol symbol)
Indicates whether the given function (which returns achar*
in C) should be translated as returning ajava.lang.String
.
-
returnedArrayLength
public String returnedArrayLength(String functionName)
Returns a MessageFormat string of the Java expression calculating the number of elements in the returned array from the specified function name. The literal1
indicates a single object.If symbol references a struct fields, see
canonicalStructFieldSymbol(String, String)
, it describes field's array-length or element-count referenced by a pointer.In case of struct fields, this array length will also be used for the native C function, i.e. multiplied w/
sizeof(C-Type)
and passed down to native code, if not overriden by eitherreturnValueCapacity(String)
orreturnValueLength(String)
!
-
stringArguments
public List<Integer> stringArguments(String functionName)
Returns a list ofInteger
s which are the indices ofconst char*
arguments that should be converted toString
s. Returns null if there are no such hints for the given function name.
-
isForceUsingNIOOnly4All
public boolean isForceUsingNIOOnly4All()
-
addUseNIOOnly
public void addUseNIOOnly(String fname)
-
useNIOOnly
public boolean useNIOOnly(String functionName)
Returns true if the given function should only create a java.nio variant, and no array variants, forvoid*
and other C primitive pointers. NIO only still allows usage of array backed not direct Buffers.
-
addUseNIODirectOnly
public void addUseNIODirectOnly(String fname)
-
useNIODirectOnly
public boolean useNIODirectOnly(String functionName)
Returns true if the given function should only create a java.nio variant, and no array variants, forvoid*
and other C primitive pointers. NIO direct only does only allow direct Buffers. Implies useNIOOnly !
-
manualStaticInitCall
public boolean manualStaticInitCall(String clazzName)
Returns true if the static initialization java code callinginitializeImpl()
for the given class will be manually implemented by the end user as requested via configuration directiveManualStaticInitCall 'class-name'
.
-
forceStaticInitCode
public boolean forceStaticInitCode(String clazzName)
Returns true if the static initialization java code implementinginitializeImpl()
and the native code implementing:static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity);
for the given class will be included in the generated code, always, as requested via configuration directiveForceStaticInitCode 'class-name'
.If case above code has been generated, static class initialization is generated to call
initializeImpl()
, seemanualStaticInitCall(String)
.
-
customJavaCodeForClass
public List<String> customJavaCodeForClass(String className)
Returns a list of Strings containing user-implemented code for the given Java type name (not fully-qualified, only the class name); returns either null or an empty list if there is no custom code for the class.
-
javadocForClass
public List<String> javadocForClass(String className)
Returns a list of Strings containing Javadoc documentation for the given Java type name (not fully-qualified, only the class name); returns either null or an empty list if there is no Javadoc documentation for the class.
-
packageForStruct
public String packageForStruct(String structName)
Returns the package into which to place the glue code for accessing the specified struct. Defaults to emitting into the regular package (i.e., the result ofpackageName
).
-
customCCode
public List<String> customCCode()
Returns, as a List of Strings, the custom C code to be emitted along with the glue code for the main class.
-
forcedStructs
public List<String> forcedStructs()
Returns, as a List of Strings, the structs for which glue code emission should be forced.
-
returnStructMachineDataInfoIndex
public String returnStructMachineDataInfoIndex(String structName)
Returns a MessageFormat string of the Java code definingmdIdx
, i.e. the index of the static MachineDescriptor index for structs.If undefined, code generation uses the default expression:
private static final int mdIdx = MachineDataInfoRuntime.getStatic().ordinal();
-
returnValueCapacity
public String returnValueCapacity(String functionName)
Returns a MessageFormat string of the C expression calculating the capacity of the java.nio.ByteBuffer being returned from a native method, or null if no expression has been specified.If symbol references a struct fields, see
canonicalStructFieldSymbol(String, String)
, it describes field's array-length or element-count referenced by a pointer.
-
returnValueLength
public String returnValueLength(String symbol)
Returns a MessageFormat string of the C expression calculating the length of the array being returned from a native method.If symbol references a struct fields, see
canonicalStructFieldSymbol(String, String)
, it describes field's array-length or element-count referenced by a pointer.
-
temporaryCVariableDeclarations
public List<String> temporaryCVariableDeclarations(String functionName)
Returns a List of Strings of expressions declaring temporary C variables in the glue code for the specified function.
-
temporaryCVariableAssignments
public List<String> temporaryCVariableAssignments(String functionName)
Returns a List of Strings of expressions containing assignments to temporary C variables in the glue code for the specified function.
-
extendedInterfaces
public List<String> extendedInterfaces(String interfaceName)
Returns a List of Strings indicating the interfaces the passed interface should declare it extends. May return null or a list of zero length if there are none.
-
implementedInterfaces
public List<String> implementedInterfaces(String className)
Returns a List of Strings indicating the interfaces the passed class should declare it implements. May return null or a list of zero length if there are none.
-
extendedParentClass
public String extendedParentClass(String className)
Returns a List of Strings indicating the interfaces the passed class should declare it implements. May return null or a list of zero length if there are none.
-
logIgnoresOnce
public void logIgnoresOnce()
-
logIgnores
public void logIgnores()
-
logRenamesOnce
public void logRenamesOnce()
-
logRenames
public void logRenames()
-
getASTLocusTag
protected static ASTLocusTag getASTLocusTag(AliasedSymbol s)
-
canonicalStructFieldSymbol
public static String canonicalStructFieldSymbol(String structName, String fieldName)
Returns the canonical configuration name for a struct field name, i.e. 'struct-name'.'field-name'
-
manuallyImplement
public boolean manuallyImplement(String functionName)
Variant ofmanuallyImplement(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.
-
manuallyImplement
public boolean manuallyImplement(AliasedSymbol symbol)
Returns true if the glue code for the given aliased function will be manually implemented by the end user.Both, the
current-name
and allaliases
shall be considered.If symbol references a struct field or method, see
canonicalStructFieldSymbol(String, String)
, it describes field's array-length or element-count referenced by a pointer.- See Also:
manuallyImplement(String)
-
getDelegatedImplementation
public String getDelegatedImplementation(String functionName)
Variant ofgetDelegatedImplementation(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.
-
getDelegatedImplementation
public String getDelegatedImplementation(AliasedSymbol symbol)
Returns theRENAMED-IMPL-SYMBOL
if the implementation of the glue code of the given function shall be manually delegated by the end user.DelegateImplementation <ORIG-SYMBOL> <RENAMED-IMPL-SYMBOL>
The interface is emitted unchanged.
The Java and native-code implementation is renamed to
RENAMED-IMPL-SYMBOL
. The user's manual implementation ofORIG-SYMBOL
may delegate toRENAMED-IMPL-SYMBOL
.If symbol references a struct field or method, see
canonicalStructFieldSymbol(String, String)
, it describes field's array-length or element-count referenced by a pointer.
-
getOpaqueReturnType
public JavaType getOpaqueReturnType(String functionName)
Variant ofgetOpaqueReturnType(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.
-
getOpaqueReturnType
public JavaType getOpaqueReturnType(AliasedSymbol symbol)
Returns the opaqueJavaType
for the given functionAliasedSymbol
ornull
if not opaque.ReturnsOpaque <Primitive Java Type> <Function Name>
-
shouldIgnoreInInterface
public final boolean shouldIgnoreInInterface(String symbol)
Variant ofshouldIgnoreInInterface(AliasedSymbol)
, where this method only considers thecurrent-name
of the given symbol, not therenamed-symbol
.
-
shouldIgnoreInInterface
public boolean shouldIgnoreInInterface(AliasedSymbol symbol)
Returns true if this aliased symbol should be ignored during glue code generation of interfaces and implementation.Both, the
current-name
and allaliases
shall be considered.Implementation calls
shouldIgnoreInInterface_Int(AliasedSymbol)
and overriding implementations shall ensure its being called as well!- Parameters:
symbol
- the symbolic aliased name to check for exclusion
-
shouldIgnoreInInterface_Int
protected final boolean shouldIgnoreInInterface_Int(AliasedSymbol symbol)
-
shouldIgnoreInImpl
public boolean shouldIgnoreInImpl(AliasedSymbol symbol)
Returns true if this aliased symbol should be ignored during glue code generation of implementation only.Both, the
current-name
and allaliases
shall be considered.Implementation calls
shouldIgnoreInImpl_Int(AliasedSymbol)
and overriding implementations shall ensure its being called as well!- Parameters:
symbol
- the symbolic aliased name to check for exclusion
-
shouldIgnoreInImpl_Int
protected final boolean shouldIgnoreInImpl_Int(AliasedSymbol symbol)
-
isUnimplemented
public boolean isUnimplemented(AliasedSymbol symbol)
Returns true if this function should be given a body which throws a run-time exception with an "unimplemented" message during glue code generation.
-
getAliasedDocNames
public Set<String> getAliasedDocNames(AliasedSymbol symbol)
Return a set of aliased-name for comment in docs.This is usually
AliasedSymbol.addAliasedName(String)
, however an implementation may choose otherwise.- Parameters:
symbol
- the aliased symbol to retrieve the aliases- Returns:
- set of aliased-names or
null
.
-
renameJavaType
public String renameJavaType(String javaTypeName)
Returns a replacement name for this type, which should be the name of a Java wrapper class for a C struct, or the name unchanged if no RenameJavaType directive was specified for this type.
-
getJavaSymbolRename
public String getJavaSymbolRename(String origName)
Returns a replacement name for this function or definition which should be used as the Java name for the bound method or constant. If a function, it still calls the originally-named C function under the hood. Returns null if this symbol has not been explicitly renamed.
-
getRenamedJavaSymbols
public Set<String> getRenamedJavaSymbols(String aliasedName)
Returns a set of replaced names to the givenaliasedName
.
-
addJavaSymbolRename
public void addJavaSymbolRename(String origName, String newName)
Programmatically adds a rename directive for the given symbol.
-
addDelegateImplementation
public void addDelegateImplementation(String origName, String renamedImpl)
Programmatically adds a delegate implementation directive for the given symbol.
-
allStatic
public boolean allStatic()
Returns true if the emission style is AllStatic.
-
emitInterface
public boolean emitInterface()
Returns true if an interface should be emitted during glue code generation.
-
emitImpl
public boolean emitImpl()
Returns true if an implementing class should be emitted during glue code generation.
-
javaPrologueForMethod
public List<String> javaPrologueForMethod(MethodBinding binding, boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes)
Returns a list of Strings which should be emitted as a prologue to the body for the Java-side glue code for the given method. Returns null if no prologue was specified.
-
javaEpilogueForMethod
public List<String> javaEpilogueForMethod(MethodBinding binding, boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes)
Returns a list of Strings which should be emitted as an epilogue to the body for the Java-side glue code for the given method. Returns null if no epilogue was specified.
-
dispatch
protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException
- Throws:
IOException
-
readString
protected String readString(String cmd, StringTokenizer tok, String filename, int lineNo)
-
readBoolean
protected Boolean readBoolean(String cmd, StringTokenizer tok, String filename, int lineNo)
-
stringToPrimitiveType
protected Class<?> stringToPrimitiveType(String type) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
readAccessControl
protected void readAccessControl(StringTokenizer tok, String filename, int lineNo)
-
readOpaque
protected void readOpaque(StringTokenizer tok, String filename, int lineNo)
-
readReturnsOpaque
protected void readReturnsOpaque(StringTokenizer tok, String filename, int lineNo)
-
readReturnsString
protected void readReturnsString(StringTokenizer tok, String filename, int lineNo)
-
readReturnedArrayLength
protected void readReturnedArrayLength(StringTokenizer tok, String filename, int lineNo)
-
readExtendedIntfImplSymbols
protected void readExtendedIntfImplSymbols(StringTokenizer tok, String filename, int lineNo, boolean forInterface, boolean forImplementation, boolean onlyList)
-
readIgnore
protected void readIgnore(StringTokenizer tok, String filename, int lineNo)
-
readUnignore
protected void readUnignore(StringTokenizer tok, String filename, int lineNo)
-
readIgnoreNot
protected void readIgnoreNot(StringTokenizer tok, String filename, int lineNo)
-
readUnimplemented
protected void readUnimplemented(StringTokenizer tok, String filename, int lineNo)
-
readIgnoreField
protected void readIgnoreField(StringTokenizer tok, String filename, int lineNo)
-
readManuallyImplement
protected void readManuallyImplement(StringTokenizer tok, String filename, int lineNo)
-
readManualStaticInitCall
protected void readManualStaticInitCall(StringTokenizer tok, String filename, int lineNo)
-
readForceStaticInitCode
protected void readForceStaticInitCode(StringTokenizer tok, String filename, int lineNo)
-
readCustomJavaCode
protected void readCustomJavaCode(StringTokenizer tok, String filename, int lineNo)
-
readCustomCCode
protected void readCustomCCode(StringTokenizer tok, String filename, int lineNo)
-
readMethodJavadoc
protected void readMethodJavadoc(StringTokenizer tok, String filename, int lineNo)
-
readClassJavadoc
protected void readClassJavadoc(StringTokenizer tok, String filename, int lineNo)
-
readArgumentIsString
protected void readArgumentIsString(StringTokenizer tok, String filename, int lineNo)
When const char* arguments in the C function prototypes are encountered, the emitter will normally convert them tobyte[]
arguments. This directive lets you specify which of those arguments should be converted toString
arguments instead ofbyte[]
.For example, given the C prototype:
void FuncName(const char* ugh, int bar, const char *foo, const char* goop);
The emitter will normally emit:public abstract void FuncName(byte[] ugh, int bar, byte[] foo, byte[] goop);
However, if you supplied the following directive:ArgumentIsString FuncName 0 2
The emitter will instead emit:public abstract void FuncName(String ugh, int bar, String foo, byte[] goop);
-
readStructPackage
protected void readStructPackage(StringTokenizer tok, String filename, int lineNo)
-
readStructMachineDataInfoIndex
protected void readStructMachineDataInfoIndex(StringTokenizer tok, String filename, int lineNo)
-
readReturnValueCapacity
protected void readReturnValueCapacity(StringTokenizer tok, String filename, int lineNo)
-
readReturnValueLength
protected void readReturnValueLength(StringTokenizer tok, String filename, int lineNo)
-
readTemporaryCVariableDeclaration
protected void readTemporaryCVariableDeclaration(StringTokenizer tok, String filename, int lineNo)
-
readTemporaryCVariableAssignment
protected void readTemporaryCVariableAssignment(StringTokenizer tok, String filename, int lineNo)
-
doInclude
protected void doInclude(StringTokenizer tok, File file, String filename, int lineNo) throws IOException
- Throws:
IOException
-
doIncludeAs
protected void doIncludeAs(StringTokenizer tok, File file, String filename, int lineNo) throws IOException
- Throws:
IOException
-
readExtend
protected void readExtend(StringTokenizer tok, String filename, int lineNo)
-
readImplements
protected void readImplements(StringTokenizer tok, String filename, int lineNo)
-
readParentClass
protected void readParentClass(StringTokenizer tok, String filename, int lineNo)
-
readRenameJavaType
protected void readRenameJavaType(StringTokenizer tok, String filename, int lineNo)
-
readRenameJavaSymbol
protected void readRenameJavaSymbol(StringTokenizer tok, String filename, int lineNo)
-
readDelegateImplementation
public void readDelegateImplementation(StringTokenizer tok, String filename, int lineNo)
-
readJavaPrologueOrEpilogue
protected void readJavaPrologueOrEpilogue(StringTokenizer tok, String filename, int lineNo, boolean prologue)
-
addJavaPrologueOrEpilogue
protected void addJavaPrologueOrEpilogue(String methodName, String code, boolean prologue)
-
readRangeCheck
protected void readRangeCheck(StringTokenizer tok, String filename, int lineNo, boolean inBytes)
-
addTypeInfo
protected void addTypeInfo(TypeInfo info)
-
startsWithDescriptor
protected static boolean startsWithDescriptor(String s)
-
-