emitMethodSignature(buffer, javaMethod, cMethod, null, false); emitMethodBody(buffer, javaMethod); buffer.append("}\n\n"); String wrappedMethodName = emitMethodSignature(buffer, javaMethod, cMethod, additionalArgs.toString()); emitMethodBody(buffer, javaMethod); buffer.append("}\n\n"); emitMethodSignature(buffer, javaMethod, cMethod, null); if (!isManual) { buffer.append(jniSetupCode); emitMethodSignature(buffer, javaMethod, cMethod, null); if (!isManual) { buffer.append(jniSetupCode);
emitMethodSignature(buffer, javaMethod, cMethod, null, false); emitMethodBody(buffer, javaMethod); buffer.append("}\n\n"); String wrappedMethodName = emitMethodSignature(buffer, javaMethod, cMethod, additionalArgs.toString()); emitMethodBody(buffer, javaMethod); buffer.append("}\n\n"); emitMethodSignature(buffer, javaMethod, cMethod, null); if (!isManual) { buffer.append(jniSetupCode); emitMethodSignature(buffer, javaMethod, cMethod, null); if (!isManual) { buffer.append(jniSetupCode);
private String emitMethodSignature (StringBuffer buffer, JavaMethod javaMethod, CMethod cMethod, String additionalArguments, boolean appendPrefix) { // emit head, consisting of JNIEXPORT,return type and method name // if this is a wrapped method, prefix the method name String wrappedMethodName = null; if (additionalArguments != null) { String[] tokens = cMethod.getHead().replace("\r\n", "").replace("\n", "").split(" "); wrappedMethodName = JNI_WRAPPER_PREFIX + tokens[3]; buffer.append("static inline "); buffer.append(tokens[1]); buffer.append(" "); buffer.append(wrappedMethodName); buffer.append("\n"); } else { buffer.append(cMethod.getHead()); } // construct argument list // Differentiate between static and instance method, then output each argument if (javaMethod.isStatic()) { buffer.append("(JNIEnv* env, jclass clazz"); } else { buffer.append("(JNIEnv* env, jobject object"); } if (javaMethod.getArguments().size() > 0) buffer.append(", "); for (int i = 0; i < javaMethod.getArguments().size(); i++) { // output the argument type as defined in the header buffer.append(cMethod.getArgumentTypes()[i + 2]); buffer.append(" "); // if this is not a POD or an object, we need to add a prefix
private String emitMethodSignature (StringBuffer buffer, JavaMethod javaMethod, CMethod cMethod, String additionalArguments, boolean appendPrefix) { // emit head, consisting of JNIEXPORT,return type and method name // if this is a wrapped method, prefix the method name String wrappedMethodName = null; if (additionalArguments != null) { String[] tokens = cMethod.getHead().replace("\r\n", "").replace("\n", "").split(" "); wrappedMethodName = JNI_WRAPPER_PREFIX + tokens[3]; buffer.append("static inline "); buffer.append(tokens[1]); buffer.append(" "); buffer.append(wrappedMethodName); buffer.append("\n"); } else { buffer.append(cMethod.getHead()); } // construct argument list // Differentiate between static and instance method, then output each argument if (javaMethod.isStatic()) { buffer.append("(JNIEnv* env, jclass clazz"); } else { buffer.append("(JNIEnv* env, jobject object"); } if (javaMethod.getArguments().size() > 0) buffer.append(", "); for (int i = 0; i < javaMethod.getArguments().size(); i++) { // output the argument type as defined in the header buffer.append(cMethod.getArgumentTypes()[i + 2]); buffer.append(" "); // if this is not a POD or an object, we need to add a prefix
emitMethodSignature(buffer, javaMethod, cMethod, null, false); emitMethodBody(buffer, javaMethod); buffer.append("}\n\n"); String wrappedMethodName = emitMethodSignature(buffer, javaMethod, cMethod, additionalArgs.toString()); emitMethodBody(buffer, javaMethod); buffer.append("}\n\n"); emitMethodSignature(buffer, javaMethod, cMethod, null); if (!isManual) { buffer.append(jniSetupCode); emitMethodSignature(buffer, javaMethod, cMethod, null); if (!isManual) { buffer.append(jniSetupCode);
private String emitMethodSignature (StringBuffer buffer, JavaMethod javaMethod, CMethod cMethod, String additionalArguments, boolean appendPrefix) { // emit head, consisting of JNIEXPORT,return type and method name // if this is a wrapped method, prefix the method name String wrappedMethodName = null; if (additionalArguments != null) { String[] tokens = cMethod.getHead().replace("\r\n", "").replace("\n", "").split(" "); wrappedMethodName = JNI_WRAPPER_PREFIX + tokens[3]; buffer.append("static inline "); buffer.append(tokens[1]); buffer.append(" "); buffer.append(wrappedMethodName); buffer.append("\n"); } else { buffer.append(cMethod.getHead()); } // construct argument list // Differentiate between static and instance method, then output each argument if (javaMethod.isStatic()) { buffer.append("(JNIEnv* env, jclass clazz"); } else { buffer.append("(JNIEnv* env, jobject object"); } if (javaMethod.getArguments().size() > 0) buffer.append(", "); for (int i = 0; i < javaMethod.getArguments().size(); i++) { // output the argument type as defined in the header buffer.append(cMethod.getArgumentTypes()[i + 2]); buffer.append(" "); // if this is not a POD or an object, we need to add a prefix