Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I comment all the calls to used_routing, in order to use global routing.
[simgrid.git] / src / bindings / ruby / rb_application_handler.c
index 66d46d9..4ddbf61 100644 (file)
@@ -1,16 +1,16 @@
-/*
- * Copyright 2010. The SimGrid Team. All right 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.
- */
+/* Copyright (c) 2010. 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 "bindings/ruby_bindings.h"
 #include "surf/surfxml_parse.h"
 #include "msg/private.h" /* s_simdata_process_t FIXME: don't mess with MSG internals that way */
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ruby);
 
-// Used to instanciate the Process
+// Used to instanciate the Process 
 static  VALUE args;
 static  VALUE prop;
 static  VALUE function_name;
@@ -24,7 +24,8 @@ static VALUE rb_process_instance(VALUE fct_name,VALUE arguments,VALUE properties
 }
 
 // FIXME: don't mess with MSG internals here, use MSG_process_create_with_arguments()
-static void rb_process_create_with_args(VALUE fct_name,VALUE arguments,VALUE properties,VALUE ht_name) {
+static void rb_process_create_with_args(VALUE fct_name, VALUE arguments,
+                                        VALUE properties, VALUE ht_name) {
   
   VALUE ruby_process = rb_process_instance(fct_name,arguments,properties);
   m_process_t process; // Native Process to Create
@@ -52,7 +53,8 @@ static void rb_process_create_with_args(VALUE fct_name,VALUE arguments,VALUE pro
     free(process);
     rb_raise(rb_eRuntimeError,"Host not bound while creating native process");
   }
-  process->simdata->PID = msg_global->PID++; //  msg_global ??
+
+  process->simdata->PID = msg_global->PID++; 
 
   DEBUG7("fill in process %s/%s (pid=%d) %p (sd=%p , host=%p, host->sd=%p)",
       process->name , process->simdata->m_host->name,process->simdata->PID,
@@ -85,25 +87,28 @@ static void rb_process_create_with_args(VALUE fct_name,VALUE arguments,VALUE pro
 
 void rb_application_handler_on_start_document(void) {
   
-   args = rb_ary_new();  // Max lenght = 16 ?!
+
+   args = rb_ary_new();  // Max length = 16 !!
    prop = rb_ary_new();
+
 }
 
 void rb_application_handler_on_end_document(void) {
-  // FIXME: probably leaking
-  //application_handler_class = Qnil;
+
   args = Qnil;
   prop = Qnil;
   function_name = Qnil;
-  host_name = Qnil;
-  
+  host_name = Qnil;  
 }
 
 void rb_application_handler_on_begin_process(void) {
   
   host_name = rb_str_new2(A_surfxml_process_host);
   function_name = rb_str_new2(A_surfxml_process_function);
-  
+
+  args = rb_ary_new();  // Max length = 16 ?!
+  prop = rb_ary_new();
+
 }
 
 void rb_application_handler_on_process_arg(void) {
@@ -113,7 +118,7 @@ void rb_application_handler_on_process_arg(void) {
 }
 
 void rb_application_handler_on_property(void) {
-  // FIXME: properties are never added to the ruby process
+
   VALUE id = rb_str_new2(A_surfxml_prop_id);
   VALUE val =  rb_str_new2(A_surfxml_prop_value);
   int i_id = NUM2INT (id);
@@ -121,11 +126,8 @@ void rb_application_handler_on_property(void) {
 
 }
 
-
 void rb_application_handler_on_end_process(void) {
 
   rb_process_create_with_args(function_name,args,prop,host_name);
     
 }
-
-