X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8e5967203f4ea512a321daeb1dafb5eac209d69a..7cb1f8f04ea7ad3bf6a0eedec6f8e28e3f961970:/src/bindings/ruby_bindings.h diff --git a/src/bindings/ruby_bindings.h b/src/bindings/ruby_bindings.h index 2b60085378..7277ef4ab0 100644 --- a/src/bindings/ruby_bindings.h +++ b/src/bindings/ruby_bindings.h @@ -1,6 +1,7 @@ /* SimGrid -- Ruby bindings */ -/* Copyright (c) 2010, the SimGrid team. All right reserved */ +/* 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. */ @@ -25,7 +26,8 @@ #include "xbt/sysdep.h" #include "xbt/log.h" #include "xbt/asserts.h" -//#include "rb_msg_host.h" + +#include "simix/smx_context_private.h" /* Damn Ruby. They load their full config.h, which breaks since we also load ours. * So, we undef the offending defines @@ -38,19 +40,17 @@ #undef _GNU_SOURCE #include - - /* ********************* * * Context related stuff * * ********************* */ typedef struct s_smx_ctx_ruby { - SMX_CTX_BASE_T; + s_smx_ctx_base_t super; /* Fields of super implementation */ VALUE process; // The Ruby Process Instance //... }s_smx_ctx_ruby_t,*smx_ctx_ruby_t; void SIMIX_ctx_ruby_factory_init(smx_context_factory_t *factory); -void Init_simgrid_ruby(void); /* Load the bindings */ +void Init_libsimgrid(void); /* Load the bindings */ void initRuby(void); // Mandatory to call Ruby methods from C /* *********************************************** * @@ -69,7 +69,6 @@ void rb_process_join( VALUE ruby_process ); void rb_process_unschedule( VALUE ruby_process ); void rb_process_schedule( VALUE ruby_process ); - /* ********************************************** * * Function for Native Process (Bound) Management * * * @@ -100,10 +99,17 @@ VALUE rb_host_speed(VALUE Class,VALUE host); void rb_host_set_data(VALUE Class,VALUE host,VALUE data); VALUE rb_host_get_data(VALUE Class,VALUE host); VALUE rb_host_is_avail(VALUE Class,VALUE host); +VALUE rb_host_process(VALUE Class,VALUE process); +VALUE rb_host_get_all_hosts(VALUE Class); /* Functions related to tasks */ + +typedef struct ruby_data { + void *ruby_task; // Pointer to send the ruby_task + void *user_data; // Pointer on the user data +}s_ruby_data_t,*rb_data_t; + void rb_task_free(m_task_t tk); -// New Method >>> Data NULL VALUE rb_task_new(VALUE Class, VALUE name,VALUE comp_size,VALUE comm_size); VALUE rb_task_comp(VALUE Class,VALUE task); // Get Computation Size VALUE rb_task_name(VALUE Class,VALUE task); @@ -115,6 +121,11 @@ VALUE rb_task_sender(VALUE Class,VALUE task); VALUE rb_task_source(VALUE Class,VALUE task); VALUE rb_task_listen(VALUE Class,VALUE task,VALUE alias); //Listen From Alias (=mailbox) VALUE rb_task_listen_host(VALUE Class,VALUE task,VALUE alias,VALUE host); //Listen from Host +void rb_task_set_priority(VALUE Class,VALUE task,VALUE priority); // Set Priority +void rb_task_cancel(VALUE Class,VALUE task); // Cancel +VALUE rb_task_has_data(VALUE Class,VALUE task); // check if the task contains a data +VALUE rb_task_get_data(VALUE Class,VALUE task); // get data +void rb_task_set_data(VALUE Class,VALUE task,VALUE data); // set data /* Upcalls for the application handler */ void rb_application_handler_on_start_document(void);