-/* context_java - implementation of context switching for java threads */
+/* Context switching within the JVM. */
-/* Copyright (c) 2009-2010, 2012-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "JavaContext.hpp"
#include "jxbt_utilities.h"
#include "src/simix/smx_private.h"
-#include "xbt/dynar.h"
-#include <simgrid/simix.h>
-#include <xbt/ex.h>
-#include <xbt/ex.hpp>
-#include <xbt/function_types.h>
+#include "xbt/ex.hpp"
-extern JavaVM *__java_vm;
+extern "C" JavaVM* __java_vm;
XBT_LOG_NEW_DEFAULT_CATEGORY(jmsg, "MSG for Java(TM)");
-/* Copyright (c) 2009-2010, 2012-2014. The SimGrid Team.
- * All rights reserved. */
+/* Context switching within the JVM. */
+
+/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#define SIMGRID_JAVA_JAVA_CONTEXT_HPP
#include <functional>
-
#include <jni.h>
-#include <xbt/misc.h>
-#include <simgrid/simix.h>
-#include <xbt/xbt_os_thread.h>
-
+#include "simgrid/simix.h"
#include "src/simix/smx_private.h"
+#include "xbt/xbt_os_thread.h"
#include "jmsg.h"
-#include "jmsg_process.h"
namespace simgrid {
namespace kernel {
/* Java Wrappers to the MSG API. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Msg_environmentGetRoutingRoot(JNIEnv * env, jclass cls)
{
msg_netzone_t as = MSG_environment_get_routing_root();
- jobject jas = jas_new_instance(env);
+ jobject jas = jnetzone_new_instance(env);
if (!jas) {
jxbt_throw_jni(env, "java As instantiation failed");
return nullptr;
}
- jas = jas_ref(env, jas);
+ jas = jnetzone_ref(env, jas);
if (!jas) {
jxbt_throw_jni(env, "new global ref allocation failed");
return nullptr;
}
- jas_bind(jas, as, env);
+ jnetzone_bind(jas, as, env);
return (jobject) jas;
}
/* Java Wrappers to the MSG API. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
SG_BEGIN_DECL()
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
extern int JAVA_HOST_LEVEL;
extern int JAVA_STORAGE_LEVEL;
*/
void jmsg_throw_status(JNIEnv *env, msg_error_t status);
-/*
- * Class org_simgrid_msg_Msg
- * Method getClock
- * Signature ()D
- */
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Msg_getClock(JNIEnv *, jclass);
-
-/**
- * Class org_simgrid_msg_Msg
- * Method run
- */
JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv * env, jclass cls);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_energyInit();
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_debug(JNIEnv *, jclass, jstring);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_verb(JNIEnv *, jclass, jstring);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_info(JNIEnv *, jclass, jstring);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_warn(JNIEnv *, jclass, jstring);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_error(JNIEnv *, jclass, jstring);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_critical(JNIEnv *, jclass, jstring);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls, jstring jplatformFile);
-/* Functions related to the java host instances. */
+/* Java bindings of the NetZones. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <xbt/str.h>
-#include <xbt/dict.h>
-#include <xbt/dynar.h>
-
#include "simgrid/s4u/NetZone.hpp"
-#include <simgrid/s4u/host.hpp>
+#include "simgrid/s4u/host.hpp"
-#include "simgrid/msg.h"
#include "jmsg_as.h"
#include "jmsg_host.h"
#include "jxbt_utilities.h"
static jmethodID jas_method_As_constructor;
static jfieldID jas_field_As_bind;
-jobject jas_new_instance(JNIEnv * env) {
+jobject jnetzone_new_instance(JNIEnv* env)
+{
jclass cls = jxbt_get_class(env, "org/simgrid/msg/As");
return env->NewObject(cls, jas_method_As_constructor);
}
-jobject jas_ref(JNIEnv * env, jobject jas) {
+jobject jnetzone_ref(JNIEnv* env, jobject jas)
+{
return env->NewGlobalRef(jas);
}
-void jas_unref(JNIEnv * env, jobject jas) {
+void jnetzone_unref(JNIEnv* env, jobject jas)
+{
env->DeleteGlobalRef(jas);
}
-void jas_bind(jobject jas, simgrid::s4u::NetZone* netzone, JNIEnv* env)
+void jnetzone_bind(jobject jas, simgrid::s4u::NetZone* netzone, JNIEnv* env)
{
env->SetLongField(jas, jas_field_As_bind, (jlong)(uintptr_t)(netzone));
}
-simgrid::s4u::NetZone* jas_get_native(JNIEnv* env, jobject jas)
+simgrid::s4u::NetZone* jnetzone_get_native(JNIEnv* env, jobject jas)
{
return (simgrid::s4u::NetZone*)(uintptr_t)env->GetLongField(jas, jas_field_As_bind);
}
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) {
- simgrid::s4u::NetZone* as = jas_get_native(env, jas);
+ simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
return env->NewStringUTF(as->name());
}
jobjectArray jtable;
jobject tmp_jas;
simgrid::s4u::NetZone* tmp_as;
- simgrid::s4u::NetZone* self_as = jas_get_native(env, jas);
+ simgrid::s4u::NetZone* self_as = jnetzone_get_native(env, jas);
xbt_dict_t dict = self_as->children();
int count = xbt_dict_length(dict);
char *key;
xbt_dict_foreach(dict,cursor,key,tmp_as) {
- tmp_jas = jas_new_instance(env);
+ tmp_jas = jnetzone_new_instance(env);
if (!tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
return nullptr;
}
- tmp_jas = jas_ref(env, tmp_jas);
+ tmp_jas = jnetzone_ref(env, tmp_jas);
if (!tmp_jas) {
jxbt_throw_jni(env, "new global ref allocation failed");
return nullptr;
}
- jas_bind(tmp_jas, tmp_as, env);
+ jnetzone_bind(tmp_jas, tmp_as, env);
env->SetObjectArrayElement(jtable, index, tmp_jas);
index++;
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobject jas, jobject jname) {
- simgrid::s4u::NetZone* as = jas_get_native(env, jas);
+ simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
if (!as) {
jxbt_throw_notbound(env, "as", jas);
jobject jhost;
jstring jname;
msg_host_t host;
- simgrid::s4u::NetZone* as = jas_get_native(env, jas);
+ simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
xbt_dynar_t table = as->hosts();
int count = xbt_dynar_length(table);
-/* Functions related to the java As instances. */
+/* Functions related to the java As instances. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
SG_BEGIN_DECL()
-jobject jas_new_instance(JNIEnv * env);
-jobject jas_ref(JNIEnv * env, jobject jas);
-void jas_unref(JNIEnv * env, jobject jas);
-void jas_bind(jobject jas, msg_netzone_t as, JNIEnv* env);
-simgrid::s4u::NetZone* jas_get_native(JNIEnv* env, jobject jas);
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
+jobject jnetzone_new_instance(JNIEnv* env);
+jobject jnetzone_ref(JNIEnv* env, jobject jnetzone);
+void jnetzone_unref(JNIEnv* env, jobject jnetzone);
+void jnetzone_bind(jobject jas, msg_netzone_t as, JNIEnv* env);
+simgrid::s4u::NetZone* jnetzone_get_native(JNIEnv* env, jobject jnetzone);
JNIEXPORT void JNICALL Java_org_simgrid_msg_As_nativeInit(JNIEnv *env, jclass cls);
-
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas);
-
-JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas);
-
+JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv* env, jobject jnetzone);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobject jhost, jobject jname);
-
-JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jobject jas);
+JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv* env, jobject jnetzone);
SG_END_DECL()
#endif /*!MSG_JAS_H */
-/* Functions related to the java comm instances */
+/* Java bindings to the Comm API */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-/* Functions related to the java comm instances */
+/* Java bindings to the Comm API */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#ifndef MSG_JCOMM_H
#define MSG_JCOMM_H
+
+#include "simgrid/msg.h"
#include <jni.h>
-#include <simgrid/msg.h>
SG_BEGIN_DECL()
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
/** This function binds the task associated with the communication to the java communication object. */
void jcomm_bind_task(JNIEnv *env, jobject jcomm);
-/* Functions related to the java file API. */
+/* Java bindings of the file API. */
-/* Copyright (c) 2012-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2015. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-/* Functions related to the java file API. */
+/* Java bindings of the file API. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2015. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
SG_BEGIN_DECL()
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
jfieldID jfile_field_bind;
void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t fd);
/* Functions related to the java host instances. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <xbt/dict.h>
-#include <xbt/dynar.h>
-#include <xbt/log.h>
-#include <xbt/str.h>
-
-#include <surf/surf_routing.h>
-
-#include <simgrid/s4u/host.hpp>
+#include "simgrid/plugins/energy.h"
+#include "simgrid/s4u/host.hpp"
-#include "simgrid/msg.h"
#include "jmsg.h"
#include "jmsg_host.h"
#include "jxbt_utilities.h"
return (msg_host_t) (uintptr_t) env->GetLongField(jhost, jhost_field_Host_bind);
}
-const char *jhost_get_name(jobject jhost, JNIEnv * env) {
- msg_host_t host = jhost_get_native(env, jhost);
- return host->cname();
-}
-
-jboolean jhost_is_valid(jobject jhost, JNIEnv * env) {
- if (env->GetLongField(jhost, jhost_field_Host_bind)) {
- return JNI_TRUE;
- } else {
- return JNI_FALSE;
- }
-}
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass cls) {
jclass class_Host = env->FindClass("org/simgrid/msg/Host");
jhost_method_Host_constructor = env->GetMethodID(class_Host, "<init>", "()V");
env->ReleaseStringUTFChars((jstring) jname, name);
}
-#include "simgrid/plugins/energy.h"
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getConsumedEnergy (JNIEnv *env, jobject jhost)
{
msg_host_t host = jhost_get_native(env, jhost);
/* Functions related to the java host instances. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
SG_BEGIN_DECL()
-/**
- * This function returns a new java host instance.
- *
- * @param env The environment of the current thread
- *
- * @return A new java host object.
- *
- * @exception If the class Host is not found the function throws the ClassNotFoundException. If the constructor of
- * this class is not found the function throws the exception NotSuchMethodException.
- */
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
+/** Returns a new java instance of an host. */
jobject jhost_new_instance(JNIEnv * env);
-/**
- * This function returns a global reference to the java host instance specified by the parameter jhost.
- *
- * @param jhost The original java host instance.
- * @param env The environment of the current thread
- *
- * @return The global reference to the original java host instance.
- */
+/** Take a ref onto the java instance (to prevent its collection) */
jobject jhost_ref(JNIEnv * env, jobject jhost);
-/**
- * This function delete a global reference to a java host instance.
- *
- * @param The global refernce to delete.
- * @param env The environment of the current thread
- */
+/** Release a ref onto the java instance */
void jhost_unref(JNIEnv * env, jobject jhost);
-/**
- * This function associated a native host to a java host instance.
- *
- * @param jhost The java host instance.
- * @param host The native host to bind.
- * @param env The environment of the current thread
- *
- * @exception If the class Host is not found the function throws the ClassNotFoundException. If the field bind of
- * this class is not found the function throws the exception NotSuchFieldException.
- */
+/** Binds a native instance to a java instance. */
void jhost_bind(jobject jhost, msg_host_t host, JNIEnv * env);
-/**
- * This function returns a native host from a java host instance.
- *
- * @param jhost The java host object from which get the native host.
- * @param env The environment of the current thread
- *
- * @return The function returns the native host associated to the java host object.
- *
- * @exception If the class Host is not found the function throws the ClassNotFoundException. If the field bind of
- * this class is not found the function throws the exception NotSuchFieldException.
- */
+/** Extracts the native instance associated to a java instance. */
msg_host_t jhost_get_native(JNIEnv * env, jobject jhost);
-/**
- * This function returns the name of a MSG host.
- *
- * @param jhost A java host object.
- * @param env The environment of the current thread
- *
- * @return The name of the host.
- */
-const char *jhost_get_name(jobject jhost, JNIEnv * env);
-
-/**
- * This function tests if a java host instance is valid.
- * A java host object is valid if it is bind to a native host.
- *
- * @param jhost The host to test the validity.
- * @param env The environment of the current thread
- *
- * @return If the java host is valid the function returns true. Otherwise the function returns false.
- */
-jboolean jhost_is_valid(jobject jhost, JNIEnv * env);
-
-/*
- * Class org_simgrid_msg_Host
- * Method nativeInit
- * Signature ();
- */
+/** Initialize the native world, called from the Java world at startup */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass cls);
-/*
- * Class org_simgrid_msg_Host
- * Method getByName
- * Signature (Ljava/lang/String;)Lsimgrid/msg/Host;
- */
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName (JNIEnv *env, jclass cls, jstring jname);
-
-/**
- * This function start the host if it is off
- *
- * @param jhost The host to test the validity.
- * @param env The environment of the current thread
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_on(JNIEnv *env, jobject jhost);
-
-/**
- * This function stop the host if it is on
- *
- * @param jhost The host to test the validity.
- * @param env The environment of the current thread
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_off(JNIEnv *env, jobject jhost);
-
-/*
- * Class org_simgrid_msg_Host
- * Method currentHost
- * Signature ()Lsimgrid/msg/Host;
- */
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost (JNIEnv *env, jclass cls);
-
-/*
- * Class org_simgrid_msg_Host
- * Method getCount
- * Signature ()I
- */
+/* Implement the Java API */
+
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName(JNIEnv* env, jclass cls, jstring jname);
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost(JNIEnv* env, jclass cls);
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getCount (JNIEnv *env, jclass cls);
-/*
- * Class org_simgrid_msg_Host
- * Method getSpeed
- * Signature ()D
- */
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_on(JNIEnv* env, jobject jhost);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_off(JNIEnv* env, jobject jhost);
+JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Host_isOn(JNIEnv* env, jobject jhost);
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed (JNIEnv *env, jobject jhost);
-
-/*
- * Class org_simgrid_msg_Host
- * Method getCoreNumber
- * Signature ()D
- */
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCoreNumber (JNIEnv *env, jobject jhost);
-
-/*
- * Class org_simgrid_msg_Host
- * Method getProperty
- * Signature (Ljava/lang/String;)Ljava/lang/String;
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getProperty(JNIEnv *env, jobject jhost, jobject jname);
-
-/*
- * Class org_simgrid_msg_Host
- * Method setProperty
- * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname, jobject jvalue);
-
-/*
- * Class org_simgrid_msg_Host
- * Method isOn
- * Signature ()Z
- */
-JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Host_isOn (JNIEnv *env, jobject jhost);
-
-/*
- * Class org_simgrid_msg_Host
- * Method getMountedStorage
- * Signature: ()[Lorg/simgrid/msg/Storage;
- */
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEnv * env, jobject jhost);
-
-/*
- * Class org_simgrid_msg_Host
- * Method getAttachedStorageList
- */
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getAttachedStorage(JNIEnv * env, jobject jhost);
-
-/*
- * Class org_simgrid_msg_Host
- * Method getStorageContent
- */
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getStorageContent(JNIEnv * env, jobject jhost);
-
-/**
- * Class org_simgrid_msg_Host
- * Method all
- */
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv *env, jclass cls);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setAsyncMailbox(JNIEnv * env, jclass cls_arg, jobject jname);
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getConsumedEnergy (JNIEnv *env, jobject jhost);
/* Functions related to the java process instances. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
jfieldID jprocess_field_Process_bind;
jfieldID jprocess_field_Process_host;
jfieldID jprocess_field_Process_killTime;
-jfieldID jprocess_field_Process_id;
+// jfieldID jprocess_field_Process_id;
jfieldID jprocess_field_Process_name;
jfieldID jprocess_field_Process_pid;
jfieldID jprocess_field_Process_ppid;
-jobject native_to_java_process(msg_process_t process)
+jobject jprocess_from_native(msg_process_t process)
{
simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) MSG_process_get_smx_ctx(process);
return context->jprocess;
}
-jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env)
+jobject jprocess_ref(jobject jprocess, JNIEnv* env)
{
return env->NewGlobalRef(jprocess);
}
-void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env)
+void jprocess_unref(jobject jprocess, JNIEnv* env)
{
env->DeleteGlobalRef(jprocess);
}
-void jprocess_join(jobject jprocess, JNIEnv * env)
-{
- msg_process_t process = jprocess_to_native_process(jprocess,env);
- simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) MSG_process_get_smx_ctx(process);
- xbt_os_thread_join(context->thread,nullptr);
-}
-
-msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
+msg_process_t jprocess_to_native(jobject jprocess, JNIEnv* env)
{
return (msg_process_t)(intptr_t)env->GetLongField(jprocess, jprocess_field_Process_bind);
}
env->SetLongField(jprocess, jprocess_field_Process_bind, (intptr_t)process);
}
-jlong jprocess_get_id(jobject jprocess, JNIEnv * env)
-{
- return (intptr_t)env->GetLongField(jprocess, jprocess_field_Process_id);
-}
-
jstring jprocess_get_name(jobject jprocess, JNIEnv * env)
{
jstring jname = (jstring) env->GetObjectField(jprocess, jprocess_field_Process_name);
return (jstring) env->NewGlobalRef(jname);
}
-jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env)
-{
- jfieldID id = jxbt_get_sfield(env, "org/simgrid/msg/Process", "bind", "J");
-
- if (!id)
- return JNI_FALSE;
-
- return env->GetLongField(jprocess, id) ? JNI_TRUE : JNI_FALSE;
-}
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls) {
jclass jprocess_class_Process = env->FindClass("org/simgrid/msg/Process");
xbt_assert(jprocess_class_Process, "Native initialization of msg/Process failed. Please report that bug");
jprocess_field_Process_name = jxbt_get_jfield(env, jprocess_class_Process, "name", "Ljava/lang/String;");
jprocess_field_Process_bind = jxbt_get_jfield(env, jprocess_class_Process, "bind", "J");
- jprocess_field_Process_id = jxbt_get_jfield(env, jprocess_class_Process, "id", "J");
jprocess_field_Process_pid = jxbt_get_jfield(env, jprocess_class_Process, "pid", "I");
jprocess_field_Process_ppid = jxbt_get_jfield(env, jprocess_class_Process, "ppid", "I");
jprocess_field_Process_host = jxbt_get_jfield(env, jprocess_class_Process, "host", "Lorg/simgrid/msg/Host;");
jprocess_field_Process_killTime = jxbt_get_jfield(env, jprocess_class_Process, "killTime", "D");
- xbt_assert(jprocess_field_Process_id && jprocess_field_Process_name && jprocess_field_Process_pid &&
- jprocess_field_Process_ppid && jprocess_field_Process_host,
+ xbt_assert(jprocess_field_Process_name && jprocess_field_Process_pid && jprocess_field_Process_ppid &&
+ jprocess_field_Process_host,
"Native initialization of msg/Process failed. Please report that bug");
}
}
/* create a global java process instance */
- jprocess = jprocess_new_global_ref(jprocess_arg, env);
+ jprocess = jprocess_ref(jprocess_arg, env);
if (!jprocess) {
jxbt_throw_jni(env, "Can't get a global ref to the java process");
return;
return nullptr;
}
- jobject jprocess = native_to_java_process(process);
+ jobject jprocess = jprocess_from_native(process);
if (!jprocess) {
jxbt_throw_jni(env, "get process failed");
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv *env, jobject jprocess, jobject jname) {
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
if (!process) {
jxbt_throw_notbound(env, "process", jprocess);
return nullptr;
}
- jprocess = native_to_java_process(process);
+ jprocess = jprocess_from_native(process);
if (!jprocess)
jxbt_throw_jni(env, xbt_strdup("SIMIX_process_get_jprocess() failed"));
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv * env, jobject jprocess)
{
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
if (!process) {
jxbt_throw_notbound(env, "process", jprocess);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv * env, jobject jprocess)
{
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
if (!process) {
jxbt_throw_notbound(env, "process", jprocess);
}
JNIEXPORT void
JNICALL Java_org_simgrid_msg_Process_setAutoRestart (JNIEnv *env, jobject jprocess, jboolean jauto_restart) {
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
xbt_ex_t e;
int auto_restart = jauto_restart == JNI_TRUE ? 1 : 0;
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart (JNIEnv *env, jobject jprocess) {
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
xbt_ex_t e;
if (!process) {
}
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env, jobject jprocess)
{
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
if (!process) {
jxbt_throw_notbound(env, "process", jprocess);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill(JNIEnv * env, jobject jprocess)
{
/* get the native instances from the java ones */
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
if (!process) {
jxbt_throw_notbound(env, "process", jprocess);
return;
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobject jprocess, jobject jhost)
{
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
if (!process) {
jxbt_throw_notbound(env, "process", jprocess);
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime (JNIEnv *env , jobject jprocess, jdouble jkilltime) {
- msg_process_t process = jprocess_to_native_process(jprocess, env);
+ msg_process_t process = jprocess_to_native(jprocess, env);
MSG_process_set_kill_time(process, (double)jkilltime);
}
/* Functions related to the java process instances. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#ifndef MSG_JPROCESS_H
#define MSG_JPROCESS_H
+#include "simgrid/msg.h"
#include <jni.h>
-#include <simgrid/msg.h>
-#include <simgrid/simix.h>
SG_BEGIN_DECL();
#endif
/* end of eclipse-mandated pimple */
-//Cached java fields
-extern jfieldID jprocess_field_Process_bind;
-extern jfieldID jprocess_field_Process_host;
-extern jfieldID jprocess_field_Process_killTime;
-extern jfieldID jprocess_field_Process_id;
-extern jfieldID jprocess_field_Process_name;
+// Cached java fields accessed by the rest of the code (FIXME: they should not)
extern jfieldID jprocess_field_Process_pid;
extern jfieldID jprocess_field_Process_ppid;
-jobject native_to_java_process(msg_process_t process);
-
-/**
- * This function returns a global reference to the java process instance specified by the parameter jprocess.
- *
- * @param jprocess The original java process instance.
- * @param env The env of the current thread
- *
- * @return The global reference to the original java process instance.
- */
-jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env);
-
-/**
- * This function delete a global reference to a java process instance.
- * If the java process is alive the function joins it and stops it before.
- *
- * @param jprocess The global refernce to delete.
- * @param env The env of the current thread
- *
- * @see jprocess_join()
- * @see jprocess_exit()
- */
-void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env);
-
-/**
- * This function waits for a java process to terminate.
- *
- * @param jprocess The java process to wait for.
- * @param env The env of the current thread
- *
- * @exception If the class Process is not found the function throws the ClassNotFoundException. If the method
- join() of this class is not found the function throws the exception NotSuchMethodException.
- */
-void jprocess_join(jobject jprocess, JNIEnv * env);
-
-/**
- * This function associated a native process to a java process instance.
- *
- * @param jprocess The java process instance.
- * @param process The native process to bind.
- * @param env The env of the current thread
- *
- * @exception If the class Process is not found the function throws the ClassNotFoundException. If the field
- * bind of this class is not found the function throws the exception NotSuchFieldException.
- */
+/** Take a ref onto the java instance (to prevent its collection) */
+jobject jprocess_ref(jobject jprocess, JNIEnv* env);
+
+/** Release a ref onto the java instance */
+void jprocess_unref(jobject jprocess, JNIEnv* env);
+
+/** Binds a native instance to a java instance. */
void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env);
-/**
- * This function returns a native process from a java process instance.
- *
- * @param jprocess The java process object from which get the native process.
- * @param env The env of the current thread
- *
- * @return The function returns the native process associated to the java process object.
- *
- * @exception If the class Process is not found the function throws the ClassNotFoundException. If the field
- * bind of this class is not found the function throws the exception NotSuchFieldException.
- */
-msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env);
-
-/**
- * This function gets the id of the specified java process.
- *
- * @param jprocess The java process to get the id.
- * @param env The env of the current thread
- *
- * @exception If the class Process is not found the function throws the ClassNotFoundException. If the field id
- * of this class is not found the function throws the exception NotSuchFieldException.
- *
- * @return The id of the specified java process.
- */
-jlong jprocess_get_id(jobject jprocess, JNIEnv * env);
-
-/**
- * This function tests if a java process instance is valid.
- * A java process object is valid if it is bind to a native process.
- *
- * @param jprocess The java process to test the validity.
- * @param env The env of the current thread
- *
- * @return If the java process is valid the function returns true. Otherwise the function returns false.
- */
-jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env);
-
-/**
- * This function gets the name of the specified java process.
- *
- * @param jprocess The java process to get the name.
- * @param env The env of the current thread
- *
- * @exception If the class Process is not found the function throws the ClassNotFoundException. If the field name
- * of this class is not found the function throws the exception NotSuchFieldException.
- *
- * @return The name of the specified java process.
- */
+/** Extract the java instance from the native one */
+jobject jprocess_from_native(msg_process_t process);
+
+/** Extract the native instance from the java one */
+msg_process_t jprocess_to_native(jobject jprocess, JNIEnv* env);
+
+/** Get the name of a java instance. */
jstring jprocess_get_name(jobject jprocess, JNIEnv * env);
-/*
- * Class org_simgrid_msg_Process
- * Method nativeInit
- * Signature ();
- */
+/** Initialize the native world, called from the Java world at startup */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls);
-/*
- * Class org_simgrid_msg_Process
- * Method create
- * Signature (Lorg/simgrid/msg/Host;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject jprocess_arg, jobject jhostname);
-
-/*
- * Class org_simgrid_msg_Process
- * Method killAll
- * Signature (I)I
- */
-JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll (JNIEnv *, jclass, jint);
-
-/*
- * Class org_simgrid_msg_Process
- * Method fromPID
- * Signature (I)Lorg/simgrid/msg/Process;
- */
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID (JNIEnv *, jclass, jint);
-
-/*
- * Class org_simgrid_msg_Process
- * Method getProperty
- * Signature (D)V
- */
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv *env, jobject jprocess, jobject jname);
-
-/*
- * Class org_simgrid_msg_Process
- * Method currentProcess
- * Signature ()Lorg/simgrid/msg/Process;
- */
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getCurrentProcess (JNIEnv *, jclass);
-
-/*
- * Class org_simgrid_msg_Process
- * Method suspend
- * Signature (Lorg/simgrid/msg/Process;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv * env, jobject jprocess);
-
-/*
- * Class org_simgrid_msg_Process
- * Method resume
- * Signature (Lorg/simgrid/msg/Process;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Process
- * Method setAutoRestart
- * Signature (Lorg/simgrid/msg/Process;Z)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setAutoRestart (JNIEnv *, jobject, jboolean);
-
-/*
- * Class org_simgrid_msg_Process
- * Method restart
- * Signature (Lorg/simgrid/msg/Process;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Process
- * Method isSuspended
- * Signature (Lorg/simgrid/msg/Process;)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Process
- * Method sleep
- * Signature (DI)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep (JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class org_simgrid_msg_Process
- * Method waitFor
- * Signature (D)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor (JNIEnv *, jobject, jdouble);
-
-/*
- * Class org_simgrid_msg_Process
- * Method kill
- * Signature (Lorg/simgrid/msg/Process;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Process
- * Method migrate
- * Signature (Lorg/simgrid/msg/Host;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate (JNIEnv *, jobject, jobject);
-
+/* Implement the Java API */
+
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject jprocess_arg, jobject jhostname);
+JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass, jint);
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv* env, jclass, jint);
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv* env, jobject jprocess, jobject jname);
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getCurrentProcess(JNIEnv* env, jclass);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv* env, jobject jprocess);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv* env, jobject jprocess);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setAutoRestart(JNIEnv* env, jobject jprocess, jboolean);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart(JNIEnv* env, jobject jprocess);
+JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv* env, jobject jprocess);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv* env, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor(JNIEnv* env, jobject jprocess, jdouble);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill(JNIEnv* env, jobject jprocess);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv* env, jobject jprocess, jobject);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_yield(JNIEnv* env, jclass cls);
-/*
- * Class org_simgrid_msg_Process
- * Method setKillTime
- * Signature (D)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime (JNIEnv *, jobject, jdouble);
-
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime(JNIEnv* env, jobject jprocess, jdouble);
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls);
SG_END_DECL();
-/* Functions related to the RngStream Java port */
+/* Java binding of the RngStream library */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <xbt/sysdep.h>
+#include "xbt/sysdep.h"
#include "jmsg_rngstream.h"
#include "jxbt_utilities.h"
-/* Functions related to the RngStream Java port */
+/* Java binding of the RngStream library */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#ifndef MSG_RNGSTREAM_H
#define MSG_RNGSTREAM_H
+
+#include "xbt/RngStream.h"
#include <jni.h>
-#include <xbt/RngStream.h>
SG_BEGIN_DECL()
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream);
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_nativeInit(JNIEnv *env, jclass cls);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_create(JNIEnv *env, jobject jrngstream, jstring name);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_nativeFinalize(JNIEnv *env, jobject jrngstream);
-
-JNIEXPORT jboolean JNICALL
-Java_org_simgrid_msg_RngStream_setPackageSeed(JNIEnv *env, jobject jrngstream, jintArray seed);
-
+JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_RngStream_setPackageSeed(JNIEnv* env, jobject jrngstream,
+ jintArray seed);
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetStart(JNIEnv *env, jobject jrngstream);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetStartSubstream(JNIEnv *env, jobject jrngstream);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetNextSubstream(JNIEnv *env, jobject jrngstream);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_setAntithetic(JNIEnv *env, jobject jrngstream, jboolean ja);
-
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_RngStream_setSeed(JNIEnv *env, jobject jrngstream, jintArray jseed);
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_advanceState(JNIEnv *env, jobject jrngstream, jint e, jint g);
-
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_RngStream_randU01(JNIEnv *env, jobject jrngstream);
-
JNIEXPORT jint JNICALL Java_org_simgrid_msg_RngStream_randInt(JNIEnv *env, jobject jrngstream, jint i, jint j);
SG_END_DECL()
-/* Functions related to the java storage API. */
+/* Java bindings of the Storage API. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <xbt/str.h>
-#include <surf/surf_routing.h>
-
#include "simgrid/msg.h"
+#include "surf/surf_routing.h"
+
#include "jmsg.h"
#include "jmsg_storage.h"
#include "jxbt_utilities.h"
env->DeleteGlobalRef(jstorage);
}
-const char *jstorage_get_name(jobject jstorage, JNIEnv * env) {
- msg_storage_t storage = jstorage_get_native(env, jstorage);
- return MSG_storage_get_name(storage);
-}
-
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, jclass cls, jstring jname) {
msg_storage_t storage;
jobject jstorage;
-/* Functions related to the java storage API. */
+/* Java bindings of the Storage API. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#ifndef MSG_JSTORAGE_H
#define MSG_JSTORAGE_H
-#include <jni.h>
+
#include "simgrid/msg.h"
+#include <jni.h>
SG_BEGIN_DECL()
-/**
- * This function returns a new java storage instance.
- *
- * @param env The environment of the current thread
- *
- * @return A new java storage object.
- *
- * @exception If the class Storage is not found the function throws the ClassNotFoundException. If the constructor of
- * this class is not found the function throws the exception NotSuchMethodException.
- */
+/** Returns a new java instance of a storage. */
jobject jstorage_new_instance(JNIEnv * env);
-/**
- * This function associated a native storage to a java storage instance.
- *
- * @param jstorage The java storage instance.
- * @param storage The native storage to bind.
- * @param env The environment of the current thread
- *
- * @exception If the class Storage is not found the function throws the ClassNotFoundException. If the field bind
- * of this class is not found the function throws the exception NotSuchFieldException.
- */
+/** Binds a native instance to a java instance. */
void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env);
-/**
- * This function returns a native storage from a java storage instance.
- *
- * @param jstorage The java storage object from which get the native storage.
- * @param env The environment of the current thread
- *
- * @return The function returns the native storage associated to the java storage object.
- *
- * @exception If the class Storage is not found the function throws the ClassNotFoundException. If the field bind
- * of this class is not found the function throws the exception NotSuchFieldException.
- */
+/** Extracts the native instance associated to a java instance. */
msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage);
-/**
- * Class org_simgrid_msg_Storage
- * Method nativeInit
- * Signature ()V
- */
+/** Initialize the native world, called from the Java world at startup */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_nativeInit(JNIEnv *env, jclass cls);
-/**
- * This function returns a global reference to the java storage instance specified by the parameter jstorage.
- *
- * @param jstorage The original java storage instance.
- * @param env The environment of the current thread
- *
- * @return The global reference to the original java storage instance.
- */
+/** Take a ref onto the java instance (to prevent its collection) */
jobject jstorage_ref(JNIEnv * env, jobject jstorage);
-/**
- * This function delete a global reference to a java storage instance.
- *
- * @param The global reference to delete.
- * @param env The environment of the current thread
- */
+/** Release a ref onto the java instance */
void jstorage_unref(JNIEnv * env, jobject jstorage);
-/**
- * This function returns the name of a MSG storage.
- *
- * @param jstorage A java storage object.
- * @param env The environment of the current thread
- *
- * @return The name of the storage.
- */
+/** Get the name of a java instance. */
const char *jstorage_get_name(jobject jstorage, JNIEnv * env);
-/*
- * Class org_simgrid_msg_Storage
- * Method getByName
- * Signature (Ljava/lang/String;)Lsimgrid/msg/Storage;
- */
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv *env, jclass cls, jstring jname);
+/* Implement the Java API */
-/*
- * Class org_simgrid_msg_Storage
- * Method getSize
- * Signature ()D
- */
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv* env, jclass cls, jstring jname);
JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *env, jobject jstorage);
-
-/*
- * Class org_simgrid_msg_Storage
- * Method getFreeSize
- * Signature ()D
- */
JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *env, jobject jstorage);
-
-/*
- * Class org_simgrid_msg_Storage
- * Method getUsedSize
- * Signature ()D
- */
JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *env, jobject jstorage);
-
-/*
- * Class org_simgrid_msg_Storage
- * Method getProperty
- * Signature (Ljava/lang/String;)Ljava/lang/String;
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname);
-
-/*
- * Class org_simgrid_msg_Storage
- * Method setProperty
- * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT void JNICALL
-Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue);
-
-/*
- * Class org_simgrid_msg_Storage
- * Method getHost
- * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_setProperty(JNIEnv* env, jobject jstorage, jobject jname,
+ jobject jvalue);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage);
-
-/**
- * Class org_simgrid_msg_Storage
- * Method all
- */
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv *env, jclass cls);
SG_END_DECL()
-/* Functions exporting the simgrid synchronization mechanisms to the Java world */
+/* Java bindings of the Synchronization API. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-/* Functions related to the java process instances. */
+/* Java bindings of the Synchronization API. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#define MSG_JSYNCHRO_H
#include <jni.h>
-#include <simgrid/msg.h>
-#include <simgrid/simix.h>
SG_BEGIN_DECL()
/* Functions related to the java task instances. */
-/* Copyright (c) 2007, 2009-2010, 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <xbt/log.h>
-#include <xbt/str.h>
-#include <xbt/sysdep.h>
-
-#include <simgrid/msg.h>
#include <simgrid/s4u/host.hpp>
#include "jmsg.h"
env->SetLongField(jtask, jtask_field_Task_bind, (intptr_t)task);
}
-msg_task_t jtask_to_native_task(jobject jtask, JNIEnv * env)
+msg_task_t jtask_to_native(jobject jtask, JNIEnv* env)
{
return (msg_task_t)(intptr_t)env->GetLongField(jtask, jtask_field_Task_bind);
}
-jboolean jtask_is_valid(jobject jtask, JNIEnv * env)
-{
- return env->GetLongField(jtask, jtask_field_Task_bind) ? JNI_TRUE : JNI_FALSE;
-}
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass cls) {
jclass jtask_class_Comm = env->FindClass("org/simgrid/msg/Comm");
jclass jtask_class_Task = env->FindClass("org/simgrid/msg/Task");
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jtask)
{
- msg_task_t ptask = jtask_to_native_task(jtask, env);
+ msg_task_t ptask = jtask_to_native(jtask, env);
if (!ptask) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBound(JNIEnv * env, jobject jtask, jdouble bound)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
}
JNIEXPORT jstring JNICALL Java_org_simgrid_msg_Task_getName(JNIEnv * env, jobject jtask) {
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSender(JNIEnv * env, jobject jtask) {
msg_process_t process;
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
if (process == nullptr) {
return nullptr;
}
- return (jobject) native_to_java_process(process);
+ return (jobject)jprocess_from_native(process);
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSource(JNIEnv * env, jobject jtask)
{
msg_host_t host;
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Task_getFlopsAmount(JNIEnv * env, jobject jtask)
{
- msg_task_t ptask = jtask_to_native_task(jtask, env);
+ msg_task_t ptask = jtask_to_native(jtask, env);
if (!ptask) {
jxbt_throw_notbound(env, "task", jtask);
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setName(JNIEnv *env, jobject jtask, jobject jname) {
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setPriority(JNIEnv * env, jobject jtask, jdouble priority)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setFlopsAmount (JNIEnv *env, jobject jtask, jdouble computationAmount)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBytesAmount (JNIEnv *env, jobject jtask, jdouble dataSize)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
jxbt_throw_notbound(env, "task", jtask);
msg_error_t rv;
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
env->ReleaseStringUTFChars(jalias, alias);
msg_error_t rv;
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
env->ReleaseStringUTFChars(jalias, alias);
jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
env->ReleaseStringUTFChars(jmailbox, mailbox);
jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
mailbox = env->GetStringUTFChars(jmailbox, 0);
- task = jtask_to_native_task(jtask, env);
+ task = jtask_to_native(jtask, env);
if (!task) {
env->ReleaseStringUTFChars(jmailbox, mailbox);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeFinalize(JNIEnv * env, jobject jtask)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
- jxbt_throw_notbound(env, "task", jtask);
- return;
+ if (!task) {
+ jxbt_throw_notbound(env, "task", jtask);
+ return;
}
MSG_task_destroy(task);
{
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
env->ReleaseStringUTFChars(jalias, alias);
{
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
if (!task) {
env->ReleaseStringUTFChars(jalias, alias);
/* Functions related to the java task instances. */
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
SG_BEGIN_DECL()
-/**
- * This function associated a native task to a java task instance.
- *
- * @param jtask The java task instance.
- * @param task The native task to bind.
- * @param env The environment of the current thread.
- *
- * @exception If the class Task is not found the function throws the ClassNotFoundException. If the field bind of
- * this class is not found the function throws the exception NotSuchFieldException.
- */
+/** Binds a native instance to a java instance. */
void jtask_bind(jobject jtask, msg_task_t task, JNIEnv * env);
-/**
- * This function returns a native task from a java task instance.
- *
- * @param jtask The java task object from which get the native task.
- * @param env The environment of the current thread.
- *
- * @return The function returns the native task associated to the java task object.
- *
- * @exception If the class Task is not found the function throws the ClassNotFoundException. If the field bind of
- * this class is not found the function throws the exception NotSuchFieldException.
- */
-msg_task_t jtask_to_native_task(jobject jtask, JNIEnv * env);
+/** Extract the native instance from the java one */
+msg_task_t jtask_to_native(jobject jtask, JNIEnv* env);
-/**
- * This function tests if a java task instance is valid.
- * A java task object is valid if it is bind to a native task.
- *
- * @param jtask The java task to test the validity.
- * @param env The environment of the current thread.
- *
- * @return If the java task is valid the function returns true. Otherwise the function returns false.
- */
-jboolean jtask_is_valid(jobject jtask, JNIEnv * env);
-
-/*
- * Class org_simgrid_msg_Task
- * Method nativeInit
- * Signature ();
- */
+/** Initialize the native world, called from the Java world at startup */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass cls);
-/*
- * Class org_simgrid_msg_Task
- * Method create
- */
+/* Implement the Java API */
+
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_create (JNIEnv * env, jobject jtask, jstring jname,
jdouble jcomputeDuration, jdouble jmessageSize);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeFinalize(JNIEnv * env, jobject jtask);
-
-/*
- * Class org_simgrid_msg_Task
- * Method parallelCreate
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate (JNIEnv *, jobject, jstring, jobjectArray,
jdoubleArray, jdoubleArray);
-
-/*
- * Class org_simgrid_msg_Task
- * Method destroy
- * Signature (Lsimgrid/msg/Task;)V
- */
-/* JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_destroy (JNIEnv *, jobject); */
-
-/*
- * Class org_simgrid_msg_Task
- * Method cancel
- * Signature ()V
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Task
- * Method execute
- * Signature ()V
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Task
- * Method setBound
- * Signature ()V
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBound (JNIEnv *, jobject, jdouble);
-
-/*
- * Class org_simgrid_msg_Task
- * Method getName
- * Signature ()Ljava/lang/String;
- */
JNIEXPORT jstring JNICALL Java_org_simgrid_msg_Task_getName (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Task
- * Method getSender
- * Signature ()Lsimgrid/msg/Process;
- */
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setName(JNIEnv* env, jobject jtask, jobject jname);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSender (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Task
- * Method getSource
- * Signature ()Lsimgrid/msg/Host;
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSource (JNIEnv *, jobject);
-
-/*
- * Class org_simgrid_msg_Task
- * Method getFlopsAmount
- * Signature ()D
- */
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Task_getFlopsAmount (JNIEnv *, jobject);
-
-/**
- * Class org_simgrid_msg_Task
- * Method setName
- * Signature (Ljava/lang/string;)V
- */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setName(JNIEnv *env, jobject jtask, jobject jname);
-
-/*
- * Class org_simgrid_msg_Task
- * Method setPriority
- * Signature (D)V
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setPriority (JNIEnv *, jobject, jdouble);
-
-/**
- * Class org_simgrid_msg_Task
- * Method setComputeDuration
- * Signature (D)V
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setFlopsAmount (JNIEnv *env, jobject jtask, jdouble computationAmount);
-
-/**
- * Class org_simgrid_msg_Task
- * Method setDataSize
- * Signature (D)V
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBytesAmount (JNIEnv *env, jobject jtask, jdouble dataSize);
-/**
- * Class org_simgrid_msg_Task
- * Method send
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_send (JNIEnv *, jobject, jstring, jdouble);
-
-/**
- * Class org_simgrid_msg_Task
- * Method sendBounded
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded (JNIEnv *, jobject, jstring, jdouble, jdouble);
-
-/**
- * Class org_simgrid_msg_Task
- * Method receive
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive (JNIEnv *, jclass, jstring, jdouble, jobject);
-
-/**
- * Class org_simgrid_msg_Task
- * Method irecv
- * Signature (Ljava/lang/String;)Lorg/simgrid/msg/Comm;
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass cls, jstring jmailbox);
-
-/**
- * Class org_simgrid_msg_Task
- * Method receiveBounded
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv * env, jclass cls, jstring jalias,
jdouble jtimeout, jobject jhost, jdouble rate);
-
-/**
- * Class org_simgrid_msg_Task
- * Method irecvBounded
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv * env, jclass cls, jstring jmailbox,
jdouble rate);
-
-/**
- * Class org_simgrid_msg_Task
- * Method isend
- * Signature (Lorg/simgrid/msg/Task;Ljava/lang/String;)Lorg/simgrid/msg/Comm;
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject jtask, jstring jmailbox);
-
-/**
- * Class org_simgrid_msg_Task
- * Method isendBounded
- */
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isendBounded(JNIEnv *env, jobject jtask, jstring jmailbox,
jdouble maxrate);
-
-/**
- * Class org_simgrid_msg_Task
- * Method dsend
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jtask, jstring jalias);
-
-/**
- * Class org_simgrid_msg_Task
- * Method dsendBounded
- */
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobject jtask, jstring jalias,
jdouble maxrate);
-
-/**
- * Class org_simgrid_msg_Task
- * Method listen
- */
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Task_listen(JNIEnv *, jclass, jstring);
-
-/**
- * Class org_simgrid_msg_Task
- * Method listenFromHost
- */
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFromHost(JNIEnv *, jclass, jstring, jobject);
-
-/**
- * Class org_simgrid_msg_Task
- * Method listenFrom
- */
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv *, jclass, jstring);
SG_END_DECL()
-/* Functions related to the MSG VM API. */
+/* Functions related to the Virtual Machines. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <xbt/ex.hpp>
-
-#include "jmsg.h"
#include "jmsg_vm.h"
#include "jmsg_host.h"
-#include "jmsg_process.h"
#include "jxbt_utilities.h"
-#include "simgrid/msg.h"
-#include <surf/surf_routing.h>
+#include "xbt/ex.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
-/* Functions related to the MSG VM API. */
+/* Functions related to the Virtual Machines. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-/* Java Wrappers to the TRACE API. */
+/* Java bindings of the Trace API. */
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-// Please note, this file strongly relies on the jmsg.cpp,
-// It will be great that a JNI expert gives a look to validate it - Adrien ;)
-
#include "jtrace.h"
-#include <simgrid/instr.h>
+#include "simgrid/instr.h"
/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
#ifndef JNIEXPORT
-/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved. */
+/* Java bindings of the Trace API. */
+
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#ifndef _Included_org_simgrid_trace_Trace
#define _Included_org_simgrid_trace_Trace
+
+/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
+#ifndef JNIEXPORT
+#define JNIEXPORT
+#endif
+#ifndef JNICALL
+#define JNICALL
+#endif
+/* end of eclipse-mandated pimple */
+
#ifdef __cplusplus
extern "C" {
#endif
/* Various JNI helper functions */
-/* Copyright (c) 2007-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <stdlib.h> /* abort */
-#include "xbt/misc.h"
#include "xbt/sysdep.h"
-#include "xbt/str.h"
#include "jxbt_utilities.h"
+#include <stdlib.h> /* abort */
+
SG_BEGIN_DECL()
jclass jxbt_get_class(JNIEnv * env, const char *name)
/* Various JNI helper functions */
-/* Copyright (c) 2007-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */