requested changes to java.c, configure.ac, and internal state to cobl…#150
requested changes to java.c, configure.ac, and internal state to cobl…#150xevor11 wants to merge 9 commits intoOCamlPro:java-interopfrom
Conversation
…ocal.h Fixed conflicts
GitMensch
left a comment
There was a problem hiding this comment.
please add an entry to DEPENDENCIES about the new optional dependency, and an entry to ChangeLog and libcob/ChangeLog; this will also make it easier to understand what you added why
Please just update your source branch, currently jni-correct and those commits will land in here.
configure.ac
Outdated
|
|
||
| AC_PATH_PROG(javahome,java, "/usr/bin") | ||
| javahome=`dirname ${javahome}` | ||
| javahome=`dirname ${javahome}` |
There was a problem hiding this comment.
Why twice?
Do we need this for anything later on?
There was a problem hiding this comment.
That was by accident, however I was slightly confused about the formatting
configure.ac
Outdated
| AC_CHECK_HEADERS([jni.h], [], | ||
| [AC_MSG_ERROR([jni.h is required but could not be found])]) | ||
| AC_CHECK_HEADERS([jni_md.h], [], | ||
| [AC_MSG_ERROR([jni_md.h is required but could not be found])]) |
There was a problem hiding this comment.
We can leave this as-is for now, later on it should only be done if --with-java is specified.
You may opt to do this part after your mid-term evaluation, whenever you do check how --with-xml2 is handled.
| lib_LTLIBRARIES = libcob.la | ||
| libcob_la_SOURCES = common.c move.c numeric.c strings.c \ | ||
| fileio.c call.c intrinsic.c termio.c screenio.c reportio.c cobgetopt.c \ | ||
| java.c \ | ||
| mlio.c coblocal.h cconv.c system.def profiling.c |
There was a problem hiding this comment.
you likely just wanted to add java.c to the list below; later on you may include it conditional on a variable (similar but not identical to libodbci).
In any case that's an adjustment, so please add ,2024 to the copyright year of this file
libcob/coblocal.h
Outdated
| /* | ||
| Copyright (C) 2007-2012, 2014-2022 Free Software Foundation, Inc. | ||
| Written by Roger While, Simon Sobisch, Ron Norman | ||
| Copyright (C) 2007-2012, 2014-2024 Free Software Foundation, Inc. |
There was a problem hiding this comment.
we don't just include year numbers, so until @ddeclerck has reached a state where he considers to have many important commit merges done (or you miss a specific 3.x commit that he already merged) and we rebase the java-interop branch which likely will add 2023 commits, the change should say ,2024`.
| COB_HIDDEN char* cob_get_strerror (void); | ||
|
|
||
| COB_HIDDEN JNIEnv* cob_create_vm (); | ||
| COB_HIDDEN void cob_handle_error (JavaVM* jvm, char* methodSig); | ||
| COB_HIDDEN char* cob_gen_method_sig (const char** paramType, int paramCount, const char** returnType); | ||
|
|
||
| COB_HIDDEN void cob_lookup_static_method (JNIEnv* env, JavaVM* jvm, const char *className, const char *methodName, | ||
| const char *methodSig, const char *returnType, const char** paramTypes, int paramCount); | ||
|
|
||
| COB_HIDDEN void cob_static_method (JNIEnv* env, JavaVM* jvm, jclass cls, jmethodID mid); | ||
| COB_HIDDEN void cob_call_java_static_method (JNIEnv *env, JavaVM *jvm, const char *className, const char *methodName, jobject obj, jstring input); | ||
|
|
||
| enum cob_case_modifier { | ||
| CCM_NONE, | ||
| CCM_LOWER, | ||
| CCM_UPPER, | ||
| CCM_LOWER_LOCALE, | ||
| CCM_UPPER_LOCALE | ||
| }; | ||
| COB_HIDDEN unsigned char cob_toupper (const unsigned char); | ||
| COB_HIDDEN unsigned char cob_tolower (const unsigned char); | ||
| COB_HIDDEN int cob_field_to_string (const cob_field *, void *, | ||
| const size_t, const enum cob_case_modifier target_case); |
There was a problem hiding this comment.
something has gone wrong here - see the same content directly above
There was a problem hiding this comment.
I do not see any duplicates in the file?
There was a problem hiding this comment.
cob_field_to_string is duplicate, cob_tolower/cob_toupper/cob_get_strerror/cob_case_modifier are shown to be added while not related to this PR
There was a problem hiding this comment.
I might have changed the line number causing get strerror and the enum to appear in the PR
…G and DEPENDENCIES
|
Added the requested changes |
|
Do you have a first working call to Java (which likely includes and adjustment to call.c as well), maybe |
…rectional communication
|
More changes for the following: Integrated JNI with java.c by adding types and data structures in java.c for bidirectional communication Working towards: Do you have a first working call to Java (which likely includes and adjustment to call.c as well), maybe System.getProperty("java.version") which is then DISPLAYed by COBOL? |
| jclass cls; | ||
| jmethodID mid; | ||
| } MethodCache; | ||
| #define HAVE_JNI |
There was a problem hiding this comment.
This should be defined by the configure script, but I guess this is a workaround until it is fully operative.
| static struct field_list *local_field_cache = NULL; | ||
| static struct call_list *call_cache = NULL; | ||
| extern JavaVM *jvm; | ||
| extern JNIEnv *env; |
There was a problem hiding this comment.
I'm not sure these are needed in the compiler (cobc) itself.
| static void lookup_java_call(const char *p) { | ||
| struct call_list *clp; | ||
|
|
||
| for (clp = call_cache; clp; clp = clp->next) { |
There was a problem hiding this comment.
I think it's another list you need to manipulate in this function. Something like call_java_cache.
|
@GitMensch Here are the final changes, we fixed issues with autoconf, config and when |
I guess you want to check #157 instead. This PR (#150) is outdated and can probably be closed. |
|
closed in favor of duplicate #157 |
Rebased and Made requested changes in PR #149