X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6a921002725af476cba5bffbbb228dbcec625fee..488566dad1ae2b42f26a8e291824ff9b16a976f7:/src/bindings/rubyDag/rb_SD_task.c diff --git a/src/bindings/rubyDag/rb_SD_task.c b/src/bindings/rubyDag/rb_SD_task.c index 740084b28c..2114e36dd8 100644 --- a/src/bindings/rubyDag/rb_SD_task.c +++ b/src/bindings/rubyDag/rb_SD_task.c @@ -8,44 +8,51 @@ #include "rb_SD_task.h" // Free Method -static void SD_task_free(SD_task_t tk) { +static void SD_task_free(SD_task_t tk) +{ // SD_task_destroy(tk); } -static void rb_SD_task_destroy(VALUE class,VALUE task) +static void rb_SD_task_destroy(VALUE class, VALUE task) { - SD_task_t tk ; - Data_Get_Struct(task, SD_task_t, tk); - SD_task_destroy(tk); + SD_task_t tk; + Data_Get_Struct(task, SD_task_t, tk); + SD_task_destroy(tk); } + // New Method -static VALUE rb_SD_task_new(VALUE class, VALUE name,VALUE amount) +static VALUE rb_SD_task_new(VALUE class, VALUE name, VALUE amount) { //data Set to NULL - SD_task_t task = SD_task_create(RSTRING(name)->ptr,NULL,NUM2DBL(amount)); + SD_task_t task = + SD_task_create(RSTRING(name)->ptr, NULL, NUM2DBL(amount)); // Wrap m_task_t to a Ruby Value return Data_Wrap_Struct(class, 0, SD_task_free, task); } //Get Name -static VALUE rb_SD_task_name(VALUE class,VALUE task) +static VALUE rb_SD_task_name(VALUE class, VALUE task) { // Wrap Ruby Value to m_task_t struct SD_task_t tk; Data_Get_Struct(task, SD_task_t, tk); return rb_str_new2(SD_task_get_name(tk)); - + } // Schedule Task -static void rb_SD_task_schedule(VALUE class,VALUE task,VALUE workstation_nb,VALUE workstation_list,VALUE computation_amount,VALUE communication_amount,VALUE rate) +static void rb_SD_task_schedule(VALUE class, VALUE task, + VALUE workstation_nb, + VALUE workstation_list, + VALUE computation_amount, + VALUE communication_amount, VALUE rate) { // Wrap Ruby Value to m_task_t struct - int i,wrk_nb,comp_nb,comm_nb; - double *comp_amount,*comm_amount; + int i, wrk_nb, comp_nb, comm_nb; + double *comp_amount, *comm_amount; double rt; - VALUE *ptr_wrk,*ptr_comp,*ptr_comm; + VALUE *ptr_wrk, *ptr_comp, *ptr_comm; SD_task_t tk; Data_Get_Struct(task, SD_task_t, tk); wrk_nb = NUM2INT(workstation_nb); @@ -53,125 +60,131 @@ static void rb_SD_task_schedule(VALUE class,VALUE task,VALUE workstation_nb,VALU comm_nb = RARRAY(communication_amount)->len; rt = NUM2DBL(rate); SD_workstation_t *wrk_list; - + ptr_wrk = RARRAY(workstation_list)->ptr; ptr_comp = RARRAY(computation_amount)->ptr; ptr_comm = RARRAY(communication_amount)->ptr; - - wrk_list = xbt_new0(SD_workstation_t,wrk_nb); - comp_amount = xbt_new0(double,wrk_nb); - comm_amount = xbt_new0(double,wrk_nb); - + + wrk_list = xbt_new0(SD_workstation_t, wrk_nb); + comp_amount = xbt_new0(double, wrk_nb); + comm_amount = xbt_new0(double, wrk_nb); + // wrk_nb == comp_nb == comm_nb ??? - for (i=0;iptr; ptr_comp = RARRAY(computation_amount)->ptr; ptr_comm = RARRAY(communication_amount)->ptr; - - wrk_list = xbt_new0(SD_workstation_t,wrk_nb); - comp_amount = xbt_new0(double,wrk_nb); - comm_amount = xbt_new0(double,wrk_nb); - - for (i=0;i