* under the terms of the license (GNU LGPL) which comes with this package. */
#include "jmsg_file.h"
#include "jxbt_utilities.h"
+
void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t stream) {
- (*env)->SetLongField(env, jfile, jfile_field_bind, (jlong) (long) (stream));
+ (*env)->SetLongField(env, jfile, jfile_field_bind, (intptr_t)stream);
}
msg_file_t jfile_get_native(JNIEnv *env, jobject jfile) {
- msg_file_t file = (msg_file_t)(*env)->GetLongField(env, jfile, jfile_field_bind);
+ msg_file_t file =
+ (msg_file_t)(intptr_t)(*env)->GetLongField(env, jfile, jfile_field_bind);
return file;
}
msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
{
- return (msg_process_t) (long) (*env)->GetLongField(env, jprocess, jprocess_field_Process_bind);
+ return
+ (msg_process_t)(intptr_t)(*env)->GetLongField(env, jprocess,
+ jprocess_field_Process_bind);
}
void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env)
{
- (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind, (jlong)(process));
+ (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind,
+ (intptr_t)process);
}
jlong jprocess_get_id(jobject jprocess, JNIEnv * env)
{
- return (*env)->GetLongField(env, jprocess, jprocess_field_Process_id);
+ return
+ (intptr_t)(*env)->GetLongField(env, jprocess, jprocess_field_Process_id);
}
jstring jprocess_get_name(jobject jprocess, JNIEnv * env)
jfieldID jrngstream_bind;
RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream) {
- RngStream rngstream = (RngStream) (*env)->GetLongField(env, jrngstream, jrngstream_bind);
+ RngStream rngstream =
+ (RngStream)(intptr_t)(*env)->GetLongField(env, jrngstream, jrngstream_bind);
if (!rngstream) {
jxbt_throw_notbound(env, "rngstream", jrngstream);
return NULL;
const char *name = (*env)->GetStringUTFChars(env, jname, 0);
RngStream rngstream = RngStream_CreateStream(name);
//Bind the RngStream object
- (*env)->SetLongField(env, jrngstream, jrngstream_bind, (jlong)rngstream);
+ (*env)->SetLongField(env, jrngstream, jrngstream_bind, (intptr_t)rngstream);
(*env)->ReleaseStringUTFChars(env, jname, name);
}
Java_org_simgrid_msg_RngStream_destroy(JNIEnv *env, jobject jrngstream) {
RngStream rngstream = jrngstream_to_native(env, jrngstream);
RngStream_DeleteStream(&rngstream);
- (*env)->SetLongField(env, jrngstream, jrngstream_bind, (jlong)NULL);
+ (*env)->SetLongField(env, jrngstream, jrngstream_bind, (intptr_t)NULL);
}
JNIEXPORT jboolean JNICALL
Java_org_simgrid_msg_RngStream_setPackageSeed(JNIEnv *env, jobject jrngstream, jintArray jseed) {
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
void jvm_bind(JNIEnv *env, jobject jvm, msg_vm_t vm) {
- (*env)->SetLongField(env, jvm, jvm_field_bind, (jlong) (long) (vm));
+ (*env)->SetLongField(env, jvm, jvm_field_bind, (intptr_t)vm);
}
msg_vm_t jvm_get_native(JNIEnv *env, jobject jvm) {
- msg_vm_t vm = (msg_vm_t)(*env)->GetLongField(env, jvm, jvm_field_bind);
- return vm;
+ return (msg_vm_t)(intptr_t)(*env)->GetLongField(env, jvm, jvm_field_bind);
}
JNIEXPORT void JNICALL
#define JXBT_UTILITY_H
#include <jni.h>
+#include <stdint.h>
/* *********** */
/* JNI GETTERS */
else if (!java_context->bound) {
java_context->bound = 1;
smx_process_t process = SIMIX_process_self();
- (*global_env)->SetLongField(global_env, java_context->jprocess, jprocess_field_Process_bind, (jlong)process);
+ (*global_env)->SetLongField(global_env, java_context->jprocess,
+ jprocess_field_Process_bind,
+ (intptr_t)process);
}
next_coroutine = java_context->jcoroutine;
else if (!java_context->bound) {
java_context->bound = 1;
smx_process_t process = SIMIX_process_self();
- (*global_env)->SetLongField(global_env, java_context->jprocess, jprocess_field_Process_bind, (jlong)process);
+ (*global_env)->SetLongField(global_env, java_context->jprocess,
+ jprocess_field_Process_bind, (intptr_t)process);
}
(*global_env)->CallStaticVoidMethod(global_env, coclass, coroutine_yieldTo, java_context->jcoroutine);
}
}
else {
smx_process_t process = SIMIX_process_self();
- (*env)->SetLongField(env, context->jprocess, jprocess_field_Process_bind, (jlong)process);
+ (*env)->SetLongField(env, context->jprocess, jprocess_field_Process_bind,
+ (intptr_t)process);
}
xbt_assert((context->jprocess != NULL), "Process not created...");
//wait for the process to be able to begin