public class JavaMethodBindingEmitter extends FunctionEmitter
Modifier and Type | Class and Description |
---|---|
protected class |
JavaMethodBindingEmitter.DefaultCommentEmitter
Class that emits a generic comment for JavaMethodBindingEmitters; the comment
includes the C signature of the native method that is being bound by the
emitter java method.
|
protected class |
JavaMethodBindingEmitter.InterfaceCommentEmitter |
FunctionEmitter.EmissionModifier
Modifier and Type | Field and Description |
---|---|
static FunctionEmitter.EmissionModifier |
ABSTRACT |
protected MethodBinding |
binding |
protected CommentEmitter |
defaultInterfaceCommentEmitter |
protected CommentEmitter |
defaultJavaCommentEmitter |
protected List<String> |
epilogue |
static FunctionEmitter.EmissionModifier |
FINAL |
static FunctionEmitter.EmissionModifier |
NATIVE |
static FunctionEmitter.EmissionModifier |
PRIVATE |
protected List<String> |
prologue |
static FunctionEmitter.EmissionModifier |
PROTECTED |
static FunctionEmitter.EmissionModifier |
PUBLIC |
static FunctionEmitter.EmissionModifier |
SYNCHRONIZED |
protected boolean |
tagNativeBinding |
protected boolean |
useNIODirectOnly |
cfg, STATIC
Constructor and Description |
---|
JavaMethodBindingEmitter(JavaMethodBindingEmitter arg) |
JavaMethodBindingEmitter(MethodBinding binding,
PrintWriter output,
String runtimeExceptionType,
String unsupportedExceptionType,
boolean emitBody,
boolean tagNativeBinding,
boolean eraseBufferAndArrayTypes,
boolean useNIOOnly,
boolean useNIODirectOnly,
boolean forDirectBufferImplementation,
boolean forIndirectBufferAndArrayImplementation,
boolean isUnimplemented,
boolean isInterface,
boolean isNativeMethod,
boolean isPrivateNativeMethod,
JavaConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
protected String[] |
argumentNameArray() |
protected String |
byteOffsetArgName(int i) |
protected static String |
byteOffsetArgName(String s) |
protected String |
byteOffsetArrayArgName(int i) |
protected int |
emitArguments(PrintWriter writer)
Returns the number of arguments emitted.
|
protected void |
emitArrayLengthAndNIOBufferChecks(MethodBinding binding,
PrintWriter writer) |
protected void |
emitBody(PrintWriter writer) |
protected void |
emitCall(MethodBinding binding,
PrintWriter writer) |
protected int |
emitCallArguments(MethodBinding binding,
PrintWriter writer) |
protected void |
emitCallResultReturn(MethodBinding binding,
PrintWriter writer) |
protected void |
emitCompoundArrayCopies(MethodBinding binding,
PrintWriter writer) |
protected void |
emitName(PrintWriter writer) |
protected void |
emitPostCallCleanup(MethodBinding binding,
PrintWriter writer) |
protected void |
emitPreCallSetup(MethodBinding binding,
PrintWriter writer) |
protected void |
emitPrologueOrEpilogue(List<String> code,
PrintWriter writer) |
protected void |
emitReturnType(PrintWriter writer) |
protected void |
emitReturnVariableSetupAndCall(MethodBinding binding,
PrintWriter writer) |
protected String |
erasedTypeString(JavaType type,
boolean skipBuffers) |
protected String |
getArgumentName(int i) |
protected String |
getBaseIndentString() |
MethodBinding |
getBinding() |
protected String |
getCommentEndString() |
protected String |
getCommentStartString() |
FunctionSymbol |
getCSymbol() |
String |
getImplName() |
String |
getInterfaceName() |
protected String |
getNativeImplMethodName() |
String |
getNativeName() |
protected String |
getReturnedArrayLengthComment() |
protected String |
getReturnedArrayLengthExpression() |
protected String |
getReturnTypeString(boolean skipArray) |
String |
getRuntimeExceptionType()
The type of exception (must subclass
java.lang.RuntimeException ) raised if runtime
checks fail in the generated code. |
String |
getUnsupportedExceptionType() |
boolean |
isForDirectBufferImplementation() |
boolean |
isForIndirectBufferAndArrayImplementation() |
boolean |
isNativeMethod() |
protected String |
isNIOArgName(int i) |
protected String |
isNIOArgName(String s) |
boolean |
isPrivateNativeMethod() |
static String |
javaThisArgumentName() |
protected String |
offsetArgName(int i) |
void |
setEmitBody(boolean emitBody)
Accessor for subclasses.
|
void |
setEpilogue(List<String> epilogue)
Sets the manually-generated epilogue code for this emitter.
|
void |
setEraseBufferAndArrayTypes(boolean erase)
Accessor for subclasses.
|
void |
setForDirectBufferImplementation(boolean direct)
Accessor for subclasses.
|
void |
setForIndirectBufferAndArrayImplementation(boolean indirect)
Accessor for subclasses.
|
void |
setPrivateNativeMethod(boolean v)
Accessor for subclasses.
|
void |
setPrologue(List<String> prologue)
Sets the manually-generated prologue code for this emitter.
|
void |
setReturnedArrayLengthExpression(String expr)
If the underlying function returns an array (currently only
arrays of compound types are supported) as opposed to a pointer
to an object, this method should be called to provide a
MessageFormat string containing an expression that computes the
number of elements of the returned array.
|
protected void |
setReturnedArrayLengthExpression(String expr,
boolean onlyForComments) |
boolean |
signatureOnly()
Indicates whether this emitter will print only a signature, or
whether it will emit Java code for the body of the method as
well.
|
addModifier, addModifiers, clearModifiers, emit, emit, emitDocComment, emitModifiers, emitSignature, getCommentEmitter, getDefaultOutput, getModifiers, hasModifier, isInterface, removeModifier, setCommentEmitter, toString
public static final FunctionEmitter.EmissionModifier PUBLIC
public static final FunctionEmitter.EmissionModifier PROTECTED
public static final FunctionEmitter.EmissionModifier PRIVATE
public static final FunctionEmitter.EmissionModifier ABSTRACT
public static final FunctionEmitter.EmissionModifier FINAL
public static final FunctionEmitter.EmissionModifier NATIVE
public static final FunctionEmitter.EmissionModifier SYNCHRONIZED
protected final CommentEmitter defaultJavaCommentEmitter
protected final CommentEmitter defaultInterfaceCommentEmitter
protected final boolean tagNativeBinding
protected final boolean useNIODirectOnly
protected final MethodBinding binding
public JavaMethodBindingEmitter(MethodBinding binding, PrintWriter output, String runtimeExceptionType, String unsupportedExceptionType, boolean emitBody, boolean tagNativeBinding, boolean eraseBufferAndArrayTypes, boolean useNIOOnly, boolean useNIODirectOnly, boolean forDirectBufferImplementation, boolean forIndirectBufferAndArrayImplementation, boolean isUnimplemented, boolean isInterface, boolean isNativeMethod, boolean isPrivateNativeMethod, JavaConfiguration configuration)
public JavaMethodBindingEmitter(JavaMethodBindingEmitter arg)
public final MethodBinding getBinding()
public boolean isNativeMethod()
public boolean isPrivateNativeMethod()
public boolean isForDirectBufferImplementation()
public boolean isForIndirectBufferAndArrayImplementation()
public String getInterfaceName()
getInterfaceName
in class FunctionEmitter
public String getImplName()
getImplName
in class FunctionEmitter
public String getNativeName()
getNativeName
in class FunctionEmitter
public FunctionSymbol getCSymbol()
getCSymbol
in class FunctionEmitter
protected String getArgumentName(int i)
public String getRuntimeExceptionType()
java.lang.RuntimeException
) raised if runtime
checks fail in the generated code.public String getUnsupportedExceptionType()
public void setReturnedArrayLengthExpression(String expr)
protected void setReturnedArrayLengthExpression(String expr, boolean onlyForComments)
protected String getReturnedArrayLengthExpression()
protected String getReturnedArrayLengthComment()
public void setPrologue(List<String> prologue)
public void setEpilogue(List<String> epilogue)
public boolean signatureOnly()
public void setEmitBody(boolean emitBody)
public void setEraseBufferAndArrayTypes(boolean erase)
public void setPrivateNativeMethod(boolean v)
public void setForDirectBufferImplementation(boolean direct)
public void setForIndirectBufferAndArrayImplementation(boolean indirect)
protected void emitReturnType(PrintWriter writer)
emitReturnType
in class FunctionEmitter
protected String getReturnTypeString(boolean skipArray)
protected void emitName(PrintWriter writer)
emitName
in class FunctionEmitter
protected int emitArguments(PrintWriter writer)
FunctionEmitter
emitArguments
in class FunctionEmitter
protected String getNativeImplMethodName()
protected String byteOffsetArgName(int i)
protected String isNIOArgName(int i)
protected String byteOffsetArrayArgName(int i)
protected String offsetArgName(int i)
protected void emitBody(PrintWriter writer)
emitBody
in class FunctionEmitter
protected void emitPrologueOrEpilogue(List<String> code, PrintWriter writer)
protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer)
protected void emitArrayLengthAndNIOBufferChecks(MethodBinding binding, PrintWriter writer)
protected void emitCompoundArrayCopies(MethodBinding binding, PrintWriter writer)
protected void emitCall(MethodBinding binding, PrintWriter writer)
protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer)
protected int emitCallArguments(MethodBinding binding, PrintWriter writer)
protected void emitPostCallCleanup(MethodBinding binding, PrintWriter writer)
protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer)
protected String[] argumentNameArray()
public static String javaThisArgumentName()
protected String getCommentStartString()
getCommentStartString
in class FunctionEmitter
protected String getCommentEndString()
getCommentEndString
in class FunctionEmitter
protected String getBaseIndentString()
getBaseIndentString
in class FunctionEmitter