Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
basic layer for simdag bindings ( modifyin' the return value of simulate from SD_tas...
authorcoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 15 Jun 2010 14:46:46 +0000 (14:46 +0000)
committercoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 15 Jun 2010 14:46:46 +0000 (14:46 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7864 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/bindings/rubyDag/Makefile
src/bindings/rubyDag/example.rb
src/bindings/rubyDag/rb_SD_task.c
src/bindings/rubyDag/rb_SD_workstation.c
src/bindings/rubyDag/rb_simdag.c

index 48d3c0d..b7d9c73 100644 (file)
@@ -40,8 +40,8 @@ sitelibdir = $(sitedir)/$(ruby_version)
 CC = gcc
 LIBRUBY = $(LIBRUBY_SO)
 LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
-LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) -I . ../../.libs/libsimgrid.a -I /usr/include/lua5.1/ -ldl -llua5.1
-LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static 
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) -I . ../../../lib/libsimgrid_static.a
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
 
 RUBY_EXTCONF_H = 
 CFLAGS   =  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC $(cflags) 
index c3993a0..e828d53 100644 (file)
@@ -47,16 +47,19 @@ class Example
     
     rate = -1
     
+    
 #     Scheduling
     
-    DAG::Task.schedule(taskA,workstation_number,workstation_list,computation_amount,communication_amount,rate)
+    DAG::Task.schedule(taskA,workstation_number,workstation_list,computation_amount,communication_amount,rate) 
     DAG::Task.schedule(taskB,workstation_number,workstation_list,computation_amount,communication_amount,rate)
     DAG::Task.schedule(taskC,workstation_number,workstation_list,computation_amount,communication_amount,rate)
     DAG::Task.schedule(taskD,workstation_number,workstation_list,computation_amount,communication_amount,rate)
-   
+  
+       
     changed_tasks = Array.new()
     changed_tasks = DAG::Task.simulate(-1.0)
 
+
     for i in 0..changed_tasks.size-1
       puts "Task "+ changed_tasks[i].name + " Started at " + changed_tasks[i].startTime.to_s + " has been done at "+ changed_tasks[i].finishTime.to_s
       
index 076599f..740084b 100644 (file)
@@ -4,6 +4,7 @@
 /* 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 "ruby_simdag.h"
 #include "rb_SD_task.h"
 
 // Free Method
@@ -160,16 +161,17 @@ static VALUE rb_SD_task_finish_time(VALUE class,VALUE task)
 static VALUE rb_SD_simulate(VALUE class,VALUE how_long)
 {
   int i;
+  SD_task_t  task ; 
   double hl = NUM2DBL(how_long);
-  SD_task_t * tasks = SD_simulate(hl); 
+  xbt_dynar_t simulated_tasks = SD_simulate(hl) ;
+  
   VALUE rb_tasks = rb_ary_new();
-  for (i = 0; tasks[i] != NULL; i++)
-    {
-      VALUE tk = Qnil;
-      tk = Data_Wrap_Struct(class, 0, SD_task_free, tasks[i]);
-      rb_ary_push(rb_tasks,tk);
-      
-    }
+  xbt_dynar_foreach(simulated_tasks, i, task){
+    VALUE tk = Qnil;
+    tk = Data_Wrap_Struct(class, 0, SD_task_free, task);
+    rb_ary_push(rb_tasks,tk);
+  }
+  
   return  rb_tasks;
  
 }
index 615a745..6b81d1b 100644 (file)
@@ -4,8 +4,10 @@
 /* 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 "ruby_simdag.h"
 #include "rb_SD_workstation.h"
 
+
 static void SD_workstation_free(SD_workstation_t wrk)
 {
   //NOTHING TO DO
index 0e2e06a..322afdf 100644 (file)
@@ -15,6 +15,7 @@
  *(GNU LGPL) which comes with this package. 
  */ 
 
+//FIXME #include "ruby_simdag.h"
 #include "rb_SD_task.c"
 #include "rb_SD_workstation.c"
 #include <simdag/simdag.h>