diff --git a/configure b/configure index ba27d29..8875947 100755 --- a/configure +++ b/configure @@ -4445,7 +4445,7 @@ if test -n "$with_javac" ; then # and if found, set OFP_JAVAC to to $with_javac (third arg) and if not, set it to # no (arg 4). TMP_JAVAC_BASE_NAME="`basename $with_javac`" - TMP_PATH=`echo $with_javac | sed "s/\/$TMP_JAVAC_BASE_NAME//"` + TMP_PATH=`echo $with_javac | sed "s/\/$TMP_JAVAC_BASE_NAME$//"` # Extract the first word of "$TMP_JAVAC_BASE_NAME", so it can be a program name with args. set dummy $TMP_JAVAC_BASE_NAME; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -4586,7 +4586,7 @@ if test -n "$with_java" ; then # and if found, set OFP_JAVA to to $with_java (third arg) and if not, set it to # no (arg 4). TMP_JAVA_BASE_NAME="`basename $with_java`" - TMP_PATH=`echo $with_java | sed "s/\/$TMP_JAVA_BASE_NAME//"` + TMP_PATH=`echo $with_java | sed "s/\/$TMP_JAVA_BASE_NAME$//"` # Extract the first word of "$TMP_JAVA_BASE_NAME", so it can be a program name with args. set dummy $TMP_JAVA_BASE_NAME; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 diff --git a/src/fortran/ofp/FrontEnd.java b/src/fortran/ofp/FrontEnd.java index 979cc71..7c9a2a8 100644 --- a/src/fortran/ofp/FrontEnd.java +++ b/src/fortran/ofp/FrontEnd.java @@ -346,7 +346,7 @@ public static void main(String args[]) throws Exception { File srcFile = new File(args[i]); if (srcFile.exists() == false) { System.err.println("Error: " + args[i] + " does not exist!"); - error = new Boolean(true); + error = true; } else { includeDirs.add(srcFile.getParent()); FrontEnd ofp = new FrontEnd(newArgs.toArray(new String[newArgs.size()]), args[i], type); @@ -420,7 +420,7 @@ public Boolean call() throws Exception { // see if we successfully parse the program unit or not if (verbose && error) { System.out.println("Parser failed"); - return new Boolean(error); + return error; } } // end while (not end of file) @@ -437,7 +437,7 @@ public Boolean call() throws Exception { System.out.println("Parser exiting normally"); } - return new Boolean(error); + return error; } // end call() public int getSourceForm() { diff --git a/src/fortran/ofp/parser/c/jni/c_main_ex.c b/src/fortran/ofp/parser/c/jni/c_main_ex.c index a4deef9..aafed5c 100644 --- a/src/fortran/ofp/parser/c/jni/c_main_ex.c +++ b/src/fortran/ofp/parser/c/jni/c_main_ex.c @@ -35,6 +35,9 @@ extern "C" { #define ERROR_CODE 4 /* These should be defined in jni.h. */ +#ifndef JNI_VERSION_1_8 +#define JNI_VERSION_1_8 8 +#endif #ifndef JNI_VERSION_1_6 #define JNI_VERSION_1_6 6 #endif @@ -99,7 +102,9 @@ extern "C" { jni_version = getenv("JNI_VERSION"); if(jni_version) { - if(strcmp(jni_version, "1.6") == 0) + if(strcmp(jni_version, "1.8") == 0) + jvm_args.version = JNI_VERSION_1_8; + else if(strcmp(jni_version, "1.8") == 0) jvm_args.version = JNI_VERSION_1_6; else if(strcmp(jni_version, "1.4") == 0) jvm_args.version = JNI_VERSION_1_4; @@ -175,7 +180,7 @@ extern "C" { /* Get the error status from the 'boolean getError()' method. */ errorMethodID = (*env)->GetStaticMethodID(env, ofp_class, "getError", "()Z"); - retval = (*env)->CallBooleanMethod(env, new_ofp_class, errorMethodID); + retval = (*env)->CallStaticBooleanMethod(env, new_ofp_class, errorMethodID); } /* We're done; destroy the Java VM. */ @@ -183,7 +188,6 @@ extern "C" { /* Cleanup any memory we allocated. */ free(classpath); - return (retval == JNI_TRUE ? ERROR_CODE : 0); } diff --git a/src/fortran/ofp/parser/java/FortranStream.java b/src/fortran/ofp/parser/java/FortranStream.java index e8af62e..043284e 100644 --- a/src/fortran/ofp/parser/java/FortranStream.java +++ b/src/fortran/ofp/parser/java/FortranStream.java @@ -245,6 +245,7 @@ private void convertFreeFormInputBuffer() char[] newData = new char[super.n]; boolean continuation = false; + int continueline = 0; int count = 0; int col = 1; // 1 based int line = 1; // 1 based @@ -325,6 +326,7 @@ else if (matchFreeFormString(i, data)) { index_count = consumeFreeFormString(i, data, count, newData); ii = index_count[0]; count = index_count[1]; while (data[ii] == '&') { + continueline += 1; // string is continued across multiple lines line += 1; col += ii - i; @@ -359,6 +361,14 @@ else if (matchFreeFormString(i, data)) { col += 1; } newData[count++] = data[i]; + if(continueline > 0 && data[i] == '\n') + { + while(continueline > 0) + { + continueline -= 1; + newData[count++] = '\n'; + } + } } // this line is to be continued @@ -368,6 +378,9 @@ else if (matchFreeFormString(i, data)) { } // switch to new data buffer +// System.out.println(this.data); +// System.out.println("================"); +// System.out.println(newData); this.data = newData; this.n = count; }