Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove unused include "simgrid_config.h"
[simgrid.git] / src / bindings / ruby / simgrid_ruby.c
index f77f534..96bc897 100644 (file)
@@ -31,8 +31,8 @@ static void msg_init(VALUE Class, VALUE args)
              "Bad arguments to msg_init (expecting an array)");
     return;
   }
-  ptr = RARRAY(args)->ptr;
-  argc = RARRAY(args)->len;
+  ptr = RARRAY_PTR(args);
+  argc = RARRAY_LEN(args);
   //  Create C array to hold data_get_struct
   argc++;
   argv = xbt_new0(char *, argc);
@@ -41,7 +41,7 @@ static void msg_init(VALUE Class, VALUE args)
     VALUE value = ptr[i];
     type = TYPE(value);
     //  if (type == T_STRING)
-    tmp = RSTRING(value)->ptr;
+    tmp = RSTRING_PTR(value);
     argv[i + 1] = strdup(tmp);
   }
   // Calling C Msg_Init Method
@@ -56,7 +56,7 @@ static void msg_init(VALUE Class, VALUE args)
 //Init Msg_Run From Ruby
 static void msg_run(VALUE class)
 {
-  DEBUG0("Start Running...");
+  XBT_DEBUG("Start Running...");
   m_host_t *hosts;
   int cpt, host_count;
   VALUE rbHost;
@@ -66,10 +66,10 @@ static void msg_run(VALUE class)
     rb_raise(rb_eRuntimeError, "MSG_main() failed");
   }
 
-  DEBUG0
+  XBT_DEBUG
       ("MSG_main finished. Bail out before cleanup since there is a bug in this part.");
   /* Cleanup Ruby hosts */
-  DEBUG0("Clean Ruby World  ");
+  XBT_DEBUG("Clean Ruby World  ");
   hosts = MSG_get_host_table();
   host_count = MSG_get_host_number();
   for (cpt = 0; cpt < host_count; cpt++) {
@@ -91,9 +91,9 @@ static void msg_createEnvironment(VALUE class, VALUE plateformFile)
   int type = TYPE(plateformFile);
   if (type != T_STRING)
     rb_raise(rb_eRuntimeError, "Bad Argument's Type");
-  const char *platform = RSTRING(plateformFile)->ptr;
+  const char *platform = RSTRING_PTR(plateformFile);
   MSG_create_environment(platform);
-  DEBUG1("Create Environment (%s)...Done", platform);
+  XBT_DEBUG("Create Environment (%s)...Done", platform);
 }
 
 //deploy Application
@@ -104,8 +104,8 @@ static void msg_deployApplication(VALUE class, VALUE deploymentFile)
   if (type != T_STRING)
     rb_raise(rb_eRuntimeError,
              "Bad Argument's Type for deployApplication ");
-  const char *dep_file = RSTRING(deploymentFile)->ptr;
-  surf_parse_reset_parser();
+  const char *dep_file = RSTRING_PTR(deploymentFile);
+  surf_parse_reset_callbacks();
   surfxml_add_callback(STag_surfxml_process_cb_list,
                        rb_application_handler_on_begin_process);
   surfxml_add_callback(ETag_surfxml_argument_cb_list,
@@ -125,20 +125,20 @@ static void msg_deployApplication(VALUE class, VALUE deploymentFile)
 
   rb_application_handler_on_end_document();
 
-  DEBUG1("Deploy Application(%s)...Done", dep_file);
+  XBT_DEBUG("Deploy Application(%s)...Done", dep_file);
 }
 
 // INFO
 static void msg_info(VALUE class, VALUE msg)
 {
-  const char *s = RSTRING(msg)->ptr;
-  INFO1("%s", s);
+  const char *s = RSTRING_PTR(msg);
+  XBT_INFO("%s", s);
 }
 
 static void msg_debug(VALUE class, VALUE msg)
 {
-  const char *s = RSTRING(msg)->ptr;
-  DEBUG1("%s", s);
+  const char *s = RSTRING_PTR(msg);
+  XBT_DEBUG("%s", s);
 }
 
 // get Clock
@@ -148,15 +148,10 @@ static VALUE msg_get_clock(VALUE class)
 
 }
 
-/*Hack: let msg load directly the right factory */
-typedef void (*SIMIX_ctx_factory_initializer_t)(smx_context_factory_t *);
-extern SIMIX_ctx_factory_initializer_t factory_initializer_to_use;
-
-
 typedef VALUE(*rb_meth) (ANYARGS);
 void Init_libsimgrid()
 {
-  factory_initializer_to_use = SIMIX_ctx_ruby_factory_init;
+  smx_factory_initializer_to_use = SIMIX_ctx_ruby_factory_init;
 
   // Modules
   rb_msg = rb_define_module("MSG");