Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Yet some more cleanups in ruby (and this time, I go to bed)
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 2 Mar 2010 01:20:09 +0000 (01:20 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 2 Mar 2010 01:20:09 +0000 (01:20 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7160 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/bindings/ruby/MasterSlave.rb
src/bindings/ruby/RubyXML.rb [deleted file]
src/bindings/ruby/essai2.c [deleted file]
src/bindings/ruby/rb_msg.c [deleted file]
src/bindings/ruby/rb_msg_process.c
src/bindings/ruby/simgrid.rb
src/bindings/ruby/simgrid_ruby.c
src/bindings/ruby_bindings.h

index 0156cc9..19afa26 100644 (file)
@@ -9,40 +9,36 @@ include MSG
 #################################################
 
 class Master < MsgProcess  
 #################################################
 
 class Master < MsgProcess  
-  # msg_main : that function that will be executed when Running Simulation
-  def msg_main(args) # args is an array containing arguments for function master
-    info("Hello From Master")
-    size = args.size
-    info ("Number of Args for Master = " + size.to_s)
+  # main : that function that will be executed when Running Simulation
+  def main(args) # args is an array containing arguments for function master
+   size = args.size
    for i in 0..size-1
    for i in 0..size-1
-      info("args["+String(i)+"]="+args[i])
+     info("args["+String(i)+"]="+args[i])
    end
    end
-   
+  
    raise "Master needs 3 arguments" if size < 3 
    numberOfTask = Integer(args[0]) 
    taskComputeSize = Float(args[1])
    taskCommunicationSize = Float(args[2])
    slaveCount = Integer(args[3]) 
    
    raise "Master needs 3 arguments" if size < 3 
    numberOfTask = Integer(args[0]) 
    taskComputeSize = Float(args[1])
    taskCommunicationSize = Float(args[2])
    slaveCount = Integer(args[3]) 
    
-   #Creating & Sending Task
+   # Creates and sends the tasks
    for i in 0..numberOfTask-1
    for i in 0..numberOfTask-1
-  
-     
-     task = Task.new("Task_"+ i.to_s, taskComputeSize , taskCommunicationSize );
-     s_alias = "slave>>" + (i%slaveCount).to_s
-     info("Master Sending "+ Task.name(task) + " to " + s_alias + " with Comput Size " + Task.compSize(task).to_s)
-     Task.send(task,s_alias)
-     info("Master Done Sending " +Task.name(task) + " to " + s_alias)
-#       sameTask = Task.receive(s_alias)
-#      puts "Master Receiving its Own Task"
+     task = Task.new("Task_"+ i.to_s, taskComputeSize , taskCommunicationSize);
+     mailbox = "slave " + (i%slaveCount).to_s
+     info("Master Sending "+ Task.name(task) + " to " + mailbox + " with Comput Size " + 
+          Task.compSize(task).to_s)
+#          task.compSize.to_s) # FIXME: This version creates a deadlock. Interesting
+     Task.send(task,mailbox)
+     info("Master Done Sending " +Task.name(task) + " to " + mailbox)
    end
   
    # Sending Finalize Tasks
    info ("Master: All tasks have been dispatched. Let's tell everybody the computation is over.")
    for i in 0..slaveCount-1
    end
   
    # Sending Finalize Tasks
    info ("Master: All tasks have been dispatched. Let's tell everybody the computation is over.")
    for i in 0..slaveCount-1
-     s_alias = "slave " + i.to_s
-     info ("Master Sending Finalize to " + s_alias)
-     Task.send(Task.new("finalize",0,0),s_alias)
+     mailbox = "slave " + i.to_s
+     info ("Master Sending Finalize to " + mailbox)
+     Task.send(Task.new("finalize",0,0),mailbox)
    end
    info("Master : Everything's Done")
   end    
    end
    info("Master : Everything's Done")
   end    
@@ -52,28 +48,24 @@ end
 # Class Slave
 #################################################
 class Slave < MsgProcess
 # Class Slave
 #################################################
 class Slave < MsgProcess
- # msg_main : that function that will be executed when Running Simulation
-  def msg_main(args)
-    info("Hello From Slave")
-    s_mailbox = "slave>>" + args[0]
+  def main(args)
+    mailbox = "slave " + args[0]
 
     while true
 
     while true
-        
        info("Ready to Receive Task")
        info("Ready to Receive Task")
-       task = Task.receive(s_mailbox)
+       task = Task.receive(mailbox)
        task_name = Task.name(task)
        info ("Task Received : " + task.name)
        task_name = Task.name(task)
        info ("Task Received : " + task.name)
-      if (task_name == "finalize")
-       info("Slave" + s_mailbox + "got finalize msg")
-       break
-      end
-      info("Slave " + s_mailbox + " ...Processing" + Task.name(task))
+       if (task_name == "finalize")
+              info("Slave" + s_mailbox + "got finalize msg")
+              break
+       end
+       info("Slave " + s_mailbox + " ...Processing" + Task.name(task))
        Task.execute(task)
     end
     info("Slave " + s_mailbox +  "I'm Done , See You !!")
        Task.execute(task)
     end
     info("Slave " + s_mailbox +  "I'm Done , See You !!")
-    end
-    
-  end
+  end    
+end
 
 
 #################################################
 
 
 #################################################
@@ -86,7 +78,7 @@ if (ARGV.length == 2)
 else 
        MSG.createEnvironment("platform.xml")
        MSG.deployApplication("deploy.xml")
 else 
        MSG.createEnvironment("platform.xml")
        MSG.deployApplication("deploy.xml")
-  Thread.list.each {|t| p t}
+  #Thread.list.each {|t| p t}
 end
 
 # Thread.list.each {|t| p t}
 end
 
 # Thread.list.each {|t| p t}
diff --git a/src/bindings/ruby/RubyXML.rb b/src/bindings/ruby/RubyXML.rb
deleted file mode 100644 (file)
index 821b25f..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'rubygems'
-require 'nokogiri'
-require 'open-uri'
-
-
-
-class RubyXML 
-  
-    attr_accessor :host, :function, :args, :file, :doc
-    
-    def initialize()
-    
-      @host = Array.new()
-      @function = Array.new()
-      @args = Array.new()
-      
-    end
-  
-#     Parse Application File
-    
-    def parseApplication(fileName) 
-      @file = File.new(fileName);
-      @doc = Nokogiri::XML(@file)
-      index = 0
-      for process in @doc.root.xpath("//process")
-       
-       @host[index] = process['host']
-       @function[index] = process['function']
-       @args[index] = Array.new()
-       arg_index = 0
-       for arg in process.xpath("./argument")
-         
-         @args[index][arg_index] = arg['value']
-         arg_index += 1
-        end
-       index += 1 
-      end
-      
-      
-      
-       @file.close();
-    end
-
-#     Print All
-    def printAll()
-      
-#       puts @host.size
-        for i in 0..@host.size-1
-         puts "> Host :" + @host[i]
-         puts ">> Function :" + @function[i]
-         for j in 0..@args[i].size-1
-           puts ">>> Arguments :" + @args[i][j]
-        end
-       end
-    end
-end
-
-
diff --git a/src/bindings/ruby/essai2.c b/src/bindings/ruby/essai2.c
deleted file mode 100644 (file)
index 4707095..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <ruby.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-
-
-
-VALUE oProcess;
-
-void r_init()
-{
-  
-  ruby_init();
-  ruby_init_loadpath();
-  rb_require("RubyProcess.rb");
-  oProcess = rb_funcall3(rb_const_get(rb_cObject, rb_intern("RbProcess")),  rb_intern("new"), 0, 0);
-  
-}
-
-
-VALUE getID(VALUE current)
-{
-  
-   
-   
-   return rb_funcall(current,rb_intern("getID"),0);
-  
-  
-}
-
-VALUE isAlive(VALUE current)
-{
-  
-   
-   
-   return rb_funcall(current,rb_intern("alive?"),0);
-  
-  
-}
-  
-void List(VALUE current)
-{
-  
-  rb_funcall(current,rb_intern("processList"),0);
-  
-}
-
-
-int main(int argc, char ** argv) 
-{
-
-  
-  
-  
-  r_init();
-  VALUE test = isAlive(oProcess);
-  
-  if (TYPE(test) == T_TRUE)
-    printf("Aliiiive\n");
-  
-  getID(oProcess);
-  List(oProcess);
-   
-  
-  
-  
-  //keep...
-  /*VALUE current = rb_thread_current(); // main One
-  test = isAlive(current);
-  
-  if(TYPE(test) == T_TRUE)
-    printf("The Current Thread is Alive\n");*/
-    
-  
-  
- /*application_handler_on_start_document();
- application_handler_on_end_document();
- application_handler_on_begin_process();
- application_handler_property();
- application_handler_on_process_arg();
-
- application_handler_on_end_process();
- */
-   
-}
-
-// compile command : gcc -I/usr/lib/ruby/1.8/i486-linux essai2.c  -o essai2 -lruby1.8 
-
-// gcc -o libProcess.so  -I/usr/lib/ruby/1.8/i486-linux  -lruby1.8 -lsimgrid  -shared rb_msg_process.c
-
diff --git a/src/bindings/ruby/rb_msg.c b/src/bindings/ruby/rb_msg.c
deleted file mode 100644 (file)
index b71f556..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/* 
- * 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.
- */ 
-
-#include "rb_msg.h"
-#include "msg/msg.h"
-#include "msg/datatypes.h"
-#include "xbt/sysdep.h"        
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-#include "surf/surfxml_parse.h"
-#include "rb_msg_task.c"
-#include "rb_msg_host.c"
-#include "rb_msg_process.c"
-#include "rb_application_handler.c"
-
-#define MY_DEBUG
-//Init Msg_Init From Ruby
-static void msg_init(VALUE Class,VALUE args)
-{ 
-  char **argv=NULL;    
-  const char *tmp;
-  int argc,type,i;
-  VALUE *ptr ;
-  // Testing The Args Type
-  type =  TYPE(args);
-  if (type != T_ARRAY )
-  {
-    rb_raise(rb_eRuntimeError,"Argh!!! Bad Arguments to msg_init");
-    return;
-  }
-  ptr= RARRAY(args)->ptr;
-  argc= RARRAY(args)->len;
-//  Create C Array to Hold Data_Get_Struct 
-  argc++; 
-  argv = xbt_new0(char *, argc);  
-  argv[0] = strdup("ruby");
-  for (i=0;i<argc-1;i++)
-  {
-   VALUE value = ptr[i];
-   type = TYPE(value);
-//  if (type == T_STRING)
-   tmp = RSTRING(value)->ptr;
-   argv[i+1] = strdup(tmp); 
-  }
-  // Calling C Msg_Init Method
-  MSG_global_init(&argc,argv);
-  MSG_set_channel_number(10); // Okey !! Okey !! This Must Be Fixed Dynamiclly , But Later ;)
-  SIMIX_context_select_factory("ruby");
-       
-  // Free Stuffs 
-  for (i=0;i<argc;i++)
-   free(argv[i]) ;
-  
-  free (argv);
-  #ifdef MY_DEBUG
-  INFO0("Msg Init...Done");
-  #endif
-  return;
-}
-
-//Init Msg_Run From Ruby
-static void msg_run(VALUE class)
-{
-  
- #ifdef MY_DEBUG
- INFO0("Start Running...");
- #endif
- xbt_fifo_item_t item = NULL;
- m_host_t host = NULL;
- VALUE rbHost;  
- // Let's Run
- //printf("msg_run3\n");
- if (MSG_OK != MSG_main()){
-   rb_raise(rb_eRuntimeError,"MSG_main() failed");
- }
-  DEBUG
-    ("MSG_main finished. Bail out before cleanup since there is a bug in this part.");
-     /* Cleanup Ruby hosts */
-   DEBUG("Clean Ruby World");
-   xbt_fifo_foreach(msg_global->host, item, host, m_host_t) {
-     //rbHost = (VALUE)host->data;// ??!!
-      }
- #ifdef MY_DEBUG
- INFO0("Start Cleaning...");
- #endif
-   
-   if (MSG_OK != MSG_clean()){
-     rb_raise(rb_eRuntimeError,"MSG_clean() failed");
-   }
-    return;
-} 
-
-//Create Environment
-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;
-   MSG_create_environment(platform);
-   printf("Create Environment...Done\n");
-
- return; 
-}
-//deploy Application
-static void msg_deployApplication(VALUE class,VALUE deploymentFile )
-{   
-  
-    int type = TYPE(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();
-    surfxml_add_callback(STag_surfxml_process_cb_list,
-                        application_handler_on_begin_process);
-    
-    surfxml_add_callback(ETag_surfxml_argument_cb_list,
-                        application_handler_on_process_arg);
-
-    surfxml_add_callback(STag_surfxml_prop_cb_list,
-                        application_handler_on_property);
-                        
-    surfxml_add_callback(ETag_surfxml_process_cb_list,
-                        application_handler_on_end_process);
-                         
-    surf_parse_open(dep_file);
-    application_handler_on_start_document();
-    if(surf_parse())
-       rb_raise(rb_eRuntimeError,"surf_parse() failed");
-    surf_parse_close();   
-    application_handler_on_end_document();
-    #ifdef MY_DEBUG
-    INFO0("Deploy Application...Done");
-    #endif
-}
-// INFO
-static void msg_info(VALUE class,VALUE msg)
-{
- const char *s = RSTRING(msg)->ptr;
- INFO1("%s",s);
-}
-
-// Get Clock
-static void msg_get_clock(VALUE class)
-{
-  printf("Simulation time %f\n",MSG_get_clock());
-  
-}   
-
-//pajeOutput
-static void msg_paje_out(VALUE class,VALUE pajeFile)
-{
-  const char *pfile = RSTRING(pajeFile)->ptr;
-  MSG_paje_output(pfile);
-  
-}
-
-// Ruby intropspection : Instanciate a ruby Class From its Name 
-// Used by ProcessFactory::createProcess
-
-static VALUE msg_new_ruby_instance(VALUE class,VALUE className)
-{
-  ruby_init();
-  ruby_init_loadpath();
-  char * p_className = RSTRING(className)->ptr;
-  
-  return rb_funcall3(rb_const_get(rb_cObject, rb_intern(p_className)),rb_intern("new"),0, 0);
-  
-}
-//This Time With Args
-static VALUE msg_new_ruby_instance_with_args(VALUE class,VALUE className,VALUE args)
-{
-  ruby_init();
-  ruby_init_loadpath();
-  char * p_className = RSTRING(className)->ptr;
-  return rb_funcall(rb_const_get(rb_cObject, rb_intern(p_className)),rb_intern("new"), 1, args); 
-}
-/*****************************************************************************************************************
-
-Wrapping MSG module and its Class ( Task,Host) & Methods ( Process's method...ect)
-To Ruby 
-
-the part after "Init_" is the name of the C extension specified in extconf.rb , not the name of C source file
-*****************************************************************************************************************/
-void Init_msg()
-{
-   // Modules
-   rb_msg = rb_define_module("MSG");
-   //Associated Environment Methods!
-   rb_define_method(rb_msg,"init",msg_init,1);
-   rb_define_method(rb_msg,"run",msg_run,0);
-   rb_define_method(rb_msg,"createEnvironment",msg_createEnvironment,1);
-   rb_define_method(rb_msg,"deployApplication",msg_deployApplication,1);
-   rb_define_method(rb_msg,"info",msg_info,1);
-   rb_define_method(rb_msg,"getClock",msg_get_clock,0);
-   rb_define_method(rb_msg,"pajeOutput",msg_paje_out,1);
-   rb_define_method(rb_msg,"rubyNewInstance",msg_new_ruby_instance,1);
-   rb_define_method(rb_msg,"rubyNewInstanceArgs",msg_new_ruby_instance_with_args,2);
-     
-   // Associated Process Methods
-   rb_define_method(rb_msg,"processCreate",processCreate,2);
-   rb_define_method(rb_msg,"processSuspend",processSuspend,1);
-   rb_define_method(rb_msg,"processResume",processResume,1);
-   rb_define_method(rb_msg,"processIsSuspend",processIsSuspend,1);
-   rb_define_method(rb_msg,"processKill",processKill,1);
-   rb_define_method(rb_msg,"processGetHost",processGetHost,1);
-   rb_define_method(rb_msg,"processExit",processExit,1);
-   
-   //Classes       
-   rb_task = rb_define_class_under(rb_msg,"Task",rb_cObject);
-   rb_host = rb_define_class_under(rb_msg,"Host",rb_cObject);
-    
-   //Task Methods    
-   rb_define_module_function(rb_task,"new",task_new,3);
-   rb_define_module_function(rb_task,"compSize",task_comp,1);
-   rb_define_module_function(rb_task,"name",task_name,1);
-   rb_define_module_function(rb_task,"execute",task_execute,1);
-   rb_define_module_function(rb_task,"send",task_send,2); 
-   rb_define_module_function(rb_task,"receive",task_receive,1);
-   rb_define_module_function(rb_task,"receive2",task_receive2,2);
-   rb_define_module_function(rb_task,"sender",task_sender,1);
-   rb_define_module_function(rb_task,"source",task_source,1);
-   rb_define_module_function(rb_task,"listen",task_listen,2);
-   rb_define_module_function(rb_task,"listenFromHost",task_listen_host,3);
-   rb_define_module_function(rb_task,"put",task_put,2);
-   rb_define_module_function(rb_task,"get",task_get,0);
-   
-   //Host Methods  
-   rb_define_module_function(rb_host,"getByName",host_get_by_name,1);
-   rb_define_module_function(rb_host,"name",host_name,1);
-   rb_define_module_function(rb_host,"speed",host_speed,1);
-   rb_define_module_function(rb_host,"number",host_number,0); 
-   rb_define_module_function(rb_host,"setData",host_set_data,2);
-   rb_define_module_function(rb_host,"getData",host_get_data,1);
-   //rb_define_module_function(rb_host,"hasData",host_has_data,1);
-   rb_define_module_function(rb_host,"isAvail",host_is_avail,1);
-   
-}  
index 505b8a2..b0bd1ee 100644 (file)
@@ -89,19 +89,17 @@ void rb_process_bind(VALUE ruby_process,m_process_t process) {
 
 
 // processCreate
 
 
 // processCreate
+// FIXME: don't mess with MSG internals here, use MSG_process_create_with_arguments()
 
 void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
 
 void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
-  VALUE rbName;      // Name of Java Process instance
+  VALUE rbName;      // Name of ruby Process instance
   m_process_t process; // Native Process to Create
   const char * name ; // Name of C Native Process
   m_process_t process; // Native Process to Create
   const char * name ; // Name of C Native Process
-  char alias[MAX_ALIAS_NAME + 1 ] = {0};
-  msg_mailbox_t mailbox;
   rbName = rb_process_getName(ruby_process);
 
   rbName = rb_process_getName(ruby_process);
 
-  if(!rbName) {
-    rb_raise(rb_eRuntimeError,"Internal error : Process Name Cannot be NULL");
-    return;
-  }
+  if(!rbName)
+    rb_raise(rb_eRuntimeError,"Internal error: Process name cannot be NULL");
+
   // Allocate the data for the simulation
   process = xbt_new0(s_m_process_t,1);
   process->simdata = xbt_new0(s_simdata_process_t,1);
   // Allocate the data for the simulation
   process = xbt_new0(s_m_process_t,1);
   process->simdata = xbt_new0(s_simdata_process_t,1);
@@ -112,13 +110,11 @@ void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
   process->name = xbt_strdup(name);
   Data_Get_Struct(host,s_m_host_t,process->simdata->m_host);
 
   process->name = xbt_strdup(name);
   Data_Get_Struct(host,s_m_host_t,process->simdata->m_host);
 
-  if(!(process->simdata->m_host)) // Not Binded
-  {
+  if(!(process->simdata->m_host)) { // Not Binded
     free(process->simdata);
     free(process->data);
     free(process);
     free(process->simdata);
     free(process->data);
     free(process);
-    rb_raise(rb_eRuntimeError,"Host not bound...while creating native process");
-    return;
+    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++; //  msg_global ??
 
@@ -138,23 +134,16 @@ void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
           process->simdata->m_host->simdata->smx_host->name,
           1,argv,NULL);
 
           process->simdata->m_host->simdata->smx_host->name,
           1,argv,NULL);
 
- DEBUG1("context created (s_process=%p)",process->simdata->s_process);
 DEBUG1("context created (s_process=%p)",process->simdata->s_process);
 
   if (SIMIX_process_self()) { // SomeOne Created Me !!
     process->simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data);
 
   if (SIMIX_process_self()) { // SomeOne Created Me !!
     process->simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data);
-  }
-  else
-  {
+  } else {
     process->simdata->PPID = -1;
   }
   process->simdata->last_errno = MSG_OK;
   // let's Add the Process to the list of the Simulation's Processes
   xbt_fifo_unshift(msg_global->process_list,process);
     process->simdata->PPID = -1;
   }
   process->simdata->last_errno = MSG_OK;
   // let's Add the Process to the list of the Simulation's Processes
   xbt_fifo_unshift(msg_global->process_list,process);
-  sprintf(alias,"%s:%s",(process->simdata->m_host->simdata->smx_host)->name,
-      process->name);
-
-  mailbox = MSG_mailbox_new(alias);
-
 }
 
 
 }
 
 
index c8788e5..b3cc65b 100644 (file)
@@ -67,14 +67,13 @@ class MsgProcess < Thread
         @name = ""
         @pargs = Array.new()
         start()
         @name = ""
         @pargs = Array.new()
         start()
-        if $DEBUG
-               puts "Init Default Initializer...Nothing to do...Bye"
-        end  
+        debug "Initializer without any argument"
       }
        
     # 2 arguments: (HostName,Name) Or (Host , Name)
     elsif argc == 2   
       super(){
       }
        
     # 2 arguments: (HostName,Name) Or (Host , Name)
     elsif argc == 2   
       super(){
+        debug "Initilize with 2 args"
         type = args[0].type()
         if ( type.to_s == "String")
           host = Host.getByName(args[0])
         type = args[0].type()
         if ( type.to_s == "String")
           host = Host.getByName(args[0])
@@ -94,14 +93,12 @@ class MsgProcess < Thread
         @pargs = Array.new()    # No Args[] Passed in Arguments
         start()
         createProcess(self,host)
         @pargs = Array.new()    # No Args[] Passed in Arguments
         start()
         createProcess(self,host)
-             if $DEBUG
-               puts "Initilize with 2 args"
-        end
       }
        
     # 3 arguments: (hostName,Name,args[]) or (Host,Name,args[])
     elsif argc == 3  
       super(){
       }
        
     # 3 arguments: (hostName,Name,args[]) or (Host,Name,args[])
     elsif argc == 3  
       super(){
+       debug "Initilize with 3 args"
         type = args[0].type()
         if ( type.to_s == "String")
           host = Host.getByName(args[0])
         type = args[0].type()
         if ( type.to_s == "String")
           host = Host.getByName(args[0])
@@ -121,19 +118,16 @@ class MsgProcess < Thread
         @pargs = args[3]
         createProcess(self,host)  
         
         @pargs = args[3]
         createProcess(self,host)  
         
-      if $DEBUG
-       puts "Initilize with 3 args"
-      end      
           }
   else 
           }
   else 
-    raise "Bad number of argument: Expecting either 1, 2 or 3, but got "+argc
+    raise "Bad number of argument: Expecting either 1, 2 or 3, but got "+argc.to_s
   end
     end
   
   # main
   end
     end
   
   # main
-  def msg_main(args) 
+  def main(args) 
     # To be overriden by childs
     # To be overriden by childs
-    raise("You must define a msg_main() function in your process, containing the code of this process")
+    raise("You must define a main() function in your process, containing the code of this process")
   end
      
   # Start : To keep the process alive and waiting via semaphore
   end
      
   # Start : To keep the process alive and waiting via semaphore
@@ -141,7 +135,7 @@ class MsgProcess < Thread
     @schedBegin.acquire
     # execute the main code of the process     
     debug("Begin execution")
     @schedBegin.acquire
     # execute the main code of the process     
     debug("Begin execution")
-    msg_main(@pargs)
+    main(@pargs)
     processExit(self) # Exit the Native Process
     @schedEnd.release
   end
     processExit(self) # Exit the Native Process
     @schedEnd.release
   end
index f879214..3dca774 100644 (file)
@@ -207,7 +207,5 @@ void Init_simgrid_ruby() {
   rb_define_module_function(rb_host,"number",(rb_meth)rb_host_number,0);
   rb_define_module_function(rb_host,"setData",(rb_meth)rb_host_set_data,2);
   rb_define_module_function(rb_host,"getData",(rb_meth)rb_host_get_data,1);
   rb_define_module_function(rb_host,"number",(rb_meth)rb_host_number,0);
   rb_define_module_function(rb_host,"setData",(rb_meth)rb_host_set_data,2);
   rb_define_module_function(rb_host,"getData",(rb_meth)rb_host_get_data,1);
-  //rb_define_module_function(rb_host,"hasData",host_has_data,1);
   rb_define_module_function(rb_host,"isAvail",(rb_meth)rb_host_is_avail,1);
   rb_define_module_function(rb_host,"isAvail",(rb_meth)rb_host_is_avail,1);
-
 }
 }
index fa20109..2b60085 100644 (file)
@@ -19,7 +19,6 @@
 #include "msg/msg.h"
 #include "msg/datatypes.h"
 
 #include "msg/msg.h"
 #include "msg/datatypes.h"
 
-#include "msg/mailbox.h" /* MAX_ALIAS_NAME (FIXME: kill it)*/
 #include "surf/surfxml_parse.h"
 #include "simix/simix.h"
 #include "simix/private.h"
 #include "surf/surfxml_parse.h"
 #include "simix/simix.h"
 #include "simix/private.h"