Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename all MSG_zone_* functions (backward compatible)
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 6 May 2017 21:08:02 +0000 (23:08 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 6 May 2017 21:08:02 +0000 (23:08 +0200)
ChangeLog
examples/msg/platform-properties/platform-properties.c
include/simgrid/msg.h
include/xbt/base.h
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/msg/msg_environment.cpp

index 7953389..e8b8c03 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,10 @@ SimGrid (3.16) UNRELEASED
     simulation round, s/he has to allocate and free a dynar and use it as argument 
     to this function. The former SD_simulate (double how_long) now returns void.
 
+ MSG
+  - The netzone are now available from the MSG API. 
+    The old names still work, but are now deprecated.
+
  SMPI
   - New algorithm to privatize globals: dlopen, with dynamic loading tricks
   - New option: smpi/keep-temps to not cleanup temp files
index 83acf80..9e1de6d 100644 (file)
@@ -65,11 +65,11 @@ static int david(int argc, char *argv[]) {/* Dump what we have on a remote host
 static int bob(int argc, char *argv[])
 {
   /* this host also tests the properties of the AS*/
-  msg_as_t root = MSG_environment_get_routing_root();
+  msg_as_t root = MSG_zone_get_root();
   XBT_INFO("== Print the properties of the AS");
-  XBT_INFO("   Process property: filename -> %s", MSG_environment_as_get_property_value(root, "filename"));
-  XBT_INFO("   Process property: date -> %s", MSG_environment_as_get_property_value(root, "date"));
-  XBT_INFO("   Process property: author -> %s", MSG_environment_as_get_property_value(root, "author"));
+  XBT_INFO("   Process property: filename -> %s", MSG_zone_get_property_value(root, "filename"));
+  XBT_INFO("   Process property: date -> %s", MSG_zone_get_property_value(root, "date"));
+  XBT_INFO("   Process property: author -> %s", MSG_zone_get_property_value(root, "author"));
 
   /* Get the property list of current bob process */
   xbt_dict_t props = MSG_process_get_properties(MSG_process_self());
index df2c744..bb2c594 100644 (file)
@@ -176,14 +176,44 @@ XBT_PUBLIC(void) MSG_set_function(const char *host_id,
 XBT_PUBLIC(double) MSG_get_clock();
 XBT_PUBLIC(unsigned long int) MSG_get_sent_msg();
 
-/************************** Environment ***********************************/
-XBT_PUBLIC(msg_netzone_t) MSG_environment_get_routing_root();
-XBT_PUBLIC(const char*) MSG_environment_as_get_name(msg_netzone_t as);
-XBT_PUBLIC(msg_netzone_t) MSG_environment_as_get_by_name(const char* name);
-XBT_PUBLIC(xbt_dict_t) MSG_environment_as_get_routing_sons(msg_netzone_t as);
-XBT_PUBLIC(const char*) MSG_environment_as_get_property_value(msg_netzone_t as, const char* name);
-XBT_PUBLIC(void) MSG_environment_as_set_property_value(msg_netzone_t netzone, const char* name, char* value);
-XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_netzone_t as);
+/************************** Net Zones ***********************************/
+XBT_PUBLIC(msg_netzone_t) MSG_zone_get_root();
+XBT_PUBLIC(const char*) MSG_zone_get_name(msg_netzone_t zone);
+XBT_PUBLIC(msg_netzone_t) MSG_zone_get_by_name(const char* name);
+XBT_PUBLIC(xbt_dict_t) MSG_zone_get_sons(msg_netzone_t zone);
+XBT_PUBLIC(const char*) MSG_zone_get_property_value(msg_netzone_t as, const char* name);
+XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
+XBT_PUBLIC(xbt_dynar_t) MSG_zone_get_hosts(msg_netzone_t zone);
+
+/* Deprecated forms of the previous functions */
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_root since v3.16")
+    msg_netzone_t MSG_environment_get_routing_root() {
+  return MSG_zone_get_root();
+}
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_name since v3.16")
+    const char* MSG_environment_as_get_name(msg_netzone_t zone) {
+  return MSG_zone_get_name(zone);
+}
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_by_name since v3.16")
+    msg_netzone_t MSG_environment_as_get_by_name(const char* name) {
+  return MSG_zone_get_by_name(name);
+}
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_sons since v3.16")
+    xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t zone) {
+  return MSG_zone_get_sons(zone);
+}
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_property_value since v3.16")
+    const char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name) {
+  return MSG_zone_get_property_value(zone, name);
+}
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_set_property_value since v3.16")
+    void MSG_environment_as_set_property_value(msg_netzone_t zone, const char* name, char* value) {
+  MSG_zone_set_property_value(zone, name, value);
+}
+static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_hosts since v3.16")
+    xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t zone) {
+  return MSG_zone_get_hosts(zone);
+}
 
 /************************** File handling ***********************************/
 XBT_PUBLIC(sg_size_t) MSG_file_read(msg_file_t fd, sg_size_t size);
index de8f8ce..108003c 100644 (file)
@@ -45,9 +45,9 @@
      __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
 #endif
 
-#define XBT_ATTRIB_NORETURN __attribute__((__noreturn__))
-#define XBT_ATTRIB_UNUSED  __attribute__((__unused__))
-#define XBT_ATTRIB_DEPRECATED(m)  __attribute__((__deprecated__(m)))
+#define XBT_ATTRIB_NORETURN __attribute__((noreturn))
+#define XBT_ATTRIB_UNUSED  __attribute__((unused))
+#define XBT_ATTRIB_DEPRECATED(m)  __attribute__((deprecated(m)))
 
 /* Constructor priorities exist since gcc 4.3.  Apparently, they are however not
  * supported on Macs. */
index 265fd61..ec98fde 100644 (file)
@@ -186,7 +186,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env,
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Msg_environmentGetRoutingRoot(JNIEnv * env, jclass cls)
 {
-  msg_netzone_t as = MSG_environment_get_routing_root();
+  msg_netzone_t as = MSG_zone_get_root();
   jobject jas      = jnetzone_new_instance(env);
   if (!jas) {
     jxbt_throw_jni(env, "java As instantiation failed");
index 9b4f7bf..cb796c4 100644 (file)
@@ -106,7 +106,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobje
   }
   const char *name = env->GetStringUTFChars(static_cast<jstring>(jname), 0);
 
-  const char *property = MSG_environment_as_get_property_value(as, name);
+  const char* property = MSG_zone_get_property_value(as, name);
   if (!property) {
     return nullptr;
   }
index a52541b..68c2a1c 100644 (file)
@@ -48,22 +48,22 @@ void MSG_post_create_environment() {
   }
 }
 
-msg_netzone_t MSG_environment_get_routing_root()
+msg_netzone_t MSG_zone_get_root()
 {
   return simgrid::s4u::Engine::instance()->netRoot();
 }
 
-const char* MSG_environment_as_get_name(msg_netzone_t netzone)
+const char* MSG_zone_get_name(msg_netzone_t netzone)
 {
   return netzone->name();
 }
 
-msg_netzone_t MSG_environment_as_get_by_name(const char* name)
+msg_netzone_t MSG_zone_get_by_name(const char* name)
 {
   return simgrid::s4u::Engine::instance()->netzoneByNameOrNull(name);
 }
 
-xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t netzone)
+xbt_dict_t MSG_zone_get_sons(msg_netzone_t netzone)
 {
   xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
   for (auto elem : *netzone->children()) {
@@ -72,17 +72,17 @@ xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t netzone)
   return res;
 }
 
-const char* MSG_environment_as_get_property_value(msg_netzone_t netzone, const char* name)
+const char* MSG_zone_get_property_value(msg_netzone_t netzone, const char* name)
 {
   return netzone->property(name);
 }
 
-void MSG_environment_as_set_property_value(msg_netzone_t netzone, const char* name, char* value)
+void MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value)
 {
   netzone->setProperty(name, value);
 }
 
-xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t netzone)
+xbt_dynar_t MSG_zone_get_hosts(msg_netzone_t netzone)
 {
   xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr);