Skip to content
Snippets Groups Projects
Commit 44e1a734 authored by Guy Zana's avatar Guy Zana
Browse files

java: split ELFRunner. decouple functionality from js interface

parent 60cf8403
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@
<jar jarfile="${dist}/cli.jar" basedir="${build-cli}" compress="false" >
<manifest>
<attribute name="Main-Class" value="com.cloudius.main.RhinoCLI" />
<attribute name="Class-Path" value="cloudius.jar" />
</manifest>
</jar>
</target>
......
......@@ -3,11 +3,10 @@ package com.cloudius.util;
import java.util.*;
import sun.org.mozilla.javascript.NativeArray;
import sun.org.mozilla.javascript.NativeGlobal;
import sun.org.mozilla.javascript.ScriptableObject;
import sun.org.mozilla.javascript.annotations.JSFunction;
import com.cloudius.Config;
import com.cloudius.util.Exec;
import com.cloudius.main.RhinoCLI;
public class ELFLoader extends ScriptableObject {
......@@ -15,12 +14,6 @@ public class ELFLoader extends ScriptableObject {
// Identifies the scriptable object
private static final long serialVersionUID = 87664098764510039L;
static {
Config.loadJNI("elf-loader.so");
}
public native static boolean run(String[] argv);
// The native function run() alters this member variable
public static int _exitcode;
......@@ -35,7 +28,7 @@ public class ELFLoader extends ScriptableObject {
argv[i] = (String)js_argv.get(i);
}
boolean success = run(argv);
boolean success = Exec.run(argv);
if (success) {
RhinoCLI._scope.put("_exitcode", RhinoCLI._scope, _exitcode);
}
......
package com.cloudius.util;
import com.cloudius.Config;
public class Exec {
static {
Config.loadJNI("elf-loader.so");
}
public native static boolean run(String[] argv);
// The native function run() alters this member variable
public static int _exitcode;
}
......@@ -40,9 +40,9 @@ bool run_elf(int argc, char** argv, int *return_code)
/*
* Class: com_cloudius_util_ELFLoader
* Method: run
* Signature: (Ljava/util/List;)Z
* Signature: (Ljava/util/String;)Z
*/
extern "C" JNIEXPORT jboolean JNICALL Java_com_cloudius_util_ELFLoader_run
extern "C" JNIEXPORT jboolean JNICALL Java_com_cloudius_util_Exec_run
(JNIEnv *env, jclass self, jobjectArray jargv)
{
char *argv[argc_max_arguments];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment