/* Functions related to the java host instances. */
-/* Copyright (c) 2007-2014. The SimGrid Team.
+/* Copyright (c) 2007-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. */
#include "xbt/str.h"
-#include "msg/msg.h"
+#include "simgrid/msg.h"
#include "jmsg.h"
#include "jmsg_host.h"
#include "jxbt_utilities.h"
}
void jhost_bind(jobject jhost, msg_host_t host, JNIEnv * env) {
- (*env)->SetLongField(env, jhost, jhost_field_Host_bind, (jlong) (long) (host));
+ (*env)->SetLongField(env, jhost, jhost_field_Host_bind, (jlong) (uintptr_t) (host));
}
msg_host_t jhost_get_native(JNIEnv * env, jobject jhost) {
- return (msg_host_t) (long) (*env)->GetLongField(env, jhost, jhost_field_Host_bind);
+ return (msg_host_t) (uintptr_t) (*env)->GetLongField(env, jhost, jhost_field_Host_bind);
}
const char *jhost_get_name(jobject jhost, JNIEnv * env) {
}
const char *name = (*env)->GetStringUTFChars(env, jname, 0);
/* get the host by name (the hosts are created during the grid resolution) */
- host = MSG_get_host_by_name(name);
+ host = MSG_host_by_name(name);
if (!host) { /* invalid name */
jxbt_throw_host_not_found(env, name);
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Host_off(JNIEnv *env, jobject jhost) {
msg_host_t host = jhost_get_native(env, jhost);
- MSG_host_off(host);
+ MSG_host_off(host);
}
JNIEXPORT jint JNICALL
}
const char *name = (*env)->GetStringUTFChars(env, jname, 0);
const char *value_java = (*env)->GetStringUTFChars(env, jvalue, 0);
- char *value = strdup(value_java);
+ char *value = xbt_strdup(value_java);
MSG_host_set_property_value(host, name, value, xbt_free_f);
}
JNIEXPORT jboolean JNICALL
-Java_org_simgrid_msg_Host_isAvail(JNIEnv * env, jobject jhost) {
+Java_org_simgrid_msg_Host_isOn(JNIEnv * env, jobject jhost) {
msg_host_t host = jhost_get_native(env, jhost);
if (!host) {
return 0;
}
- return (jboolean) MSG_host_is_avail(host);
+ return (jboolean) MSG_host_is_on(host);
}
JNIEXPORT jobjectArray JNICALL