Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the coupling between main library and ruby bindings
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 26 Nov 2010 21:43:29 +0000 (21:43 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 26 Nov 2010 21:43:29 +0000 (21:43 +0000)
commitaa4388c7780ebcbc130f17b5e473f4d356ec567f
tree8be37493babbb844a31101240a7b703b3a5742b1
parent3cf2cf4d9d0c0ba567528989c9d24624683ad64b
Reduce the coupling between main library and ruby bindings

Instead of using a char*xbt_ctx_factory_to_use and then having
SIMIX_context_select_factory() finding the right function from that
name (which induces having SIMIX_context_select_factory hardcoding a
call to the factory initializer), use a direct pointer to that
initializer

From RUBY:
-extern const char *xbt_ctx_factory_to_use;
+typedef void (*SIMIX_ctx_factory_initializer_t)(smx_context_factory_t*);
+extern SIMIX_ctx_factory_initializer_t factory_initializer_to_use;

-  xbt_ctx_factory_to_use = "ruby";
+  factory_initializer_to_use = SIMIX_ctx_ruby_factory_init;

From main lib:
-    if (xbt_ctx_factory_to_use) {
-      SIMIX_context_select_factory(xbt_ctx_factory_to_use);
+    if (factory_initializer_to_use) {
+      (*factory_initializer_to_use)(&(simix_global->context_factory));
(and kill any occurence of SIMIX_ctx_ruby_factory_init() in main lib

Also inlined the SIMIX_context_init_factory_by_name() function which
was called from only one location.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8688 48e7efb5-ca39-0410-a469-dd3cf9ba447f
src/bindings/ruby/simgrid_ruby.c
src/simix/private.h
src/simix/smx_context.c