Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make simix headers public so that we can write external bindings
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 2 Dec 2010 20:39:32 +0000 (20:39 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 2 Dec 2010 20:39:32 +0000 (20:39 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8924 48e7efb5-ca39-0410-a469-dd3cf9ba447f

14 files changed:
buildtools/Cmake/DefinePackages.cmake
include/msg/msg.h
include/simix/context.h [moved from include/bindings/smx_context.h with 56% similarity]
include/simix/datatypes.h [moved from src/include/simix/datatypes.h with 98% similarity]
include/simix/simix.h [moved from src/include/simix/simix.h with 98% similarity]
src/msg/m_process.c
src/simix/private.h
src/simix/smx_context.c
src/simix/smx_context_base.c
src/simix/smx_context_sysv.c
src/simix/smx_context_sysv_private.h
src/simix/smx_process.c
src/smpi/smpi_bench.c
src/smpi/smpi_global.c

index 7e3677a..72109a6 100644 (file)
@@ -62,8 +62,6 @@ set(EXTRA_DIST
        src/include/xbt/xbt_os_thread.h
        src/include/mc/datatypes.h
        src/include/mc/mc.h
-       src/include/simix/simix.h
-       src/include/simix/datatypes.h
        src/include/simix/context.h
        src/msg/private.h
        src/msg/mailbox.h
@@ -388,7 +386,9 @@ set(install_HEADERS
        ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
        include/gras.h 
        include/xbt.h
-       include/bindings/smx_context.h
+       include/simix/simix.h
+       include/simix/datatypes.h
+       include/simix/context.h
 )
 
 ### depend of some variables setted upper
index f83be03..56b15b3 100644 (file)
@@ -232,5 +232,10 @@ MSG_error_t MSG_action_trace_run(char *path);
 
 #include "instr/instr.h"
 
+/* Used only by the bindings */
+#include "simix/simix.h"
+XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(m_process_t process);
+
+
 SG_END_DECL()
 #endif
similarity index 56%
rename from include/bindings/smx_context.h
rename to include/simix/context.h
index 4c9cacf..1a10dc3 100644 (file)
 #define _XBT_CONTEXT_H
 
 #include "xbt/swag.h"
-#include "simix/private.h"
+#include "simix/datatypes.h"
+#include "simix/context.h"
 
 SG_BEGIN_DECL()
+/******************************** Context *************************************/
+typedef struct s_smx_context *smx_context_t;
+typedef struct s_smx_context_factory *smx_context_factory_t;
+
+/* Process creation/destruction callbacks */
+typedef void (*void_pfn_smxprocess_t) (smx_process_t);
+
+
+/* The following function pointer types describe the interface that any context
+   factory should implement */
+
+
+typedef smx_context_t(*smx_pfn_context_factory_create_context_t)
+  (xbt_main_func_t, int, char **, void_pfn_smxprocess_t, void* data);
+typedef int (*smx_pfn_context_factory_finalize_t) (smx_context_factory_t*);
+typedef void (*smx_pfn_context_free_t) (smx_context_t);
+typedef void (*smx_pfn_context_start_t) (smx_context_t);
+typedef void (*smx_pfn_context_stop_t) (smx_context_t);
+typedef void (*smx_pfn_context_suspend_t) (smx_context_t context);
+typedef void (*smx_pfn_context_runall_t) (xbt_swag_t processes);
+typedef smx_context_t (*smx_pfn_context_self_t) (void);
+typedef void* (*smx_pfn_context_get_data_t) (smx_context_t context);
+
+/* interface of the context factories */
+typedef struct s_smx_context_factory {
+  const char *name;
+  smx_pfn_context_factory_create_context_t create_context;
+  smx_pfn_context_factory_finalize_t finalize;
+  smx_pfn_context_free_t free;
+  smx_pfn_context_stop_t stop;
+  smx_pfn_context_suspend_t suspend;
+  smx_pfn_context_runall_t runall;
+  smx_pfn_context_self_t self;
+  smx_pfn_context_get_data_t get_data;
+} s_smx_context_factory_t;
+
+
+
 /*Hack: let msg load directly the right factory */
 typedef void (*SIMIX_ctx_factory_initializer_t)(smx_context_factory_t*);
 extern SIMIX_ctx_factory_initializer_t factory_initializer_to_use;
similarity index 98%
rename from src/include/simix/datatypes.h
rename to include/simix/datatypes.h
index 1064d27..f905acf 100644 (file)
@@ -9,6 +9,7 @@
 #include "xbt/misc.h"
 #include "xbt/swag.h"
 #include "xbt/fifo.h"
+#include "xbt/dict.h"
 
 SG_BEGIN_DECL()
 
@@ -67,7 +68,6 @@ typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized acti
 typedef struct s_smx_process *smx_process_t;
 /** @} */
 
-typedef struct s_smx_context *smx_context_t;
 
 /* User create and kill process, the function must accept the folling parameters:
  * const char *name: a name for the object. It is for user-level information and can be NULL
similarity index 98%
rename from src/include/simix/simix.h
rename to include/simix/simix.h
index a35d716..449aed0 100644 (file)
@@ -12,7 +12,7 @@
 #include "xbt/dict.h"
 #include "xbt/function_types.h"
 #include "simix/datatypes.h"
-#include "surf/surf.h"
+#include "simix/context.h"
 
 SG_BEGIN_DECL()
 
@@ -21,8 +21,6 @@ SG_BEGIN_DECL()
 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
 XBT_PUBLIC(void) SIMIX_clean(void);
 
-/* Process creation/destruction callbacks */
-typedef void (*void_pfn_smxprocess_t) (smx_process_t);
 
 XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
 XBT_PUBLIC(void) SIMIX_function_register_process_create(smx_creation_func_t function);
@@ -74,6 +72,8 @@ XBT_PUBLIC(smx_process_t) SIMIX_process_create(const char *name,
                                                                       const char *hostname,
                                                                       int argc, char **argv,
                                                                       xbt_dict_t properties);
+XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t);
+XBT_PUBLIC(void) SIMIX_process_set_context(smx_process_t p,smx_context_t c);
 
 /****************************** Communication *********************************/
 XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, size_t));
index b34debf..6e8f6ba 100644 (file)
@@ -457,3 +457,8 @@ int MSG_process_is_suspended(m_process_t process)
                && (process->simdata)), "Invalid parameters");
   return SIMIX_req_process_is_suspended(process->simdata->s_process);
 }
+
+
+smx_context_t MSG_process_get_smx_ctx(m_process_t process) {
+  return SIMIX_process_get_context(process->simdata->s_process);
+}
index 068baf4..c62284d 100644 (file)
 #include "network_private.h"
 #include "smurf_private.h"
 #include "synchro_private.h"
+#include "simix/context.h"
 
 /********************************** Simix Global ******************************/
 
-typedef struct s_smx_context_factory *smx_context_factory_t;
 
 typedef struct s_smx_global {
   smx_context_factory_t context_factory;
@@ -146,35 +146,6 @@ static XBT_INLINE e_smx_state_t SIMIX_action_map_state(e_surf_action_state_t sta
   }
 }
 
-/******************************** Context *************************************/
-
-/* The following function pointer types describe the interface that any context
-   factory should implement */
-
-
-typedef smx_context_t(*smx_pfn_context_factory_create_context_t)
-  (xbt_main_func_t, int, char **, void_pfn_smxprocess_t, void* data);
-typedef int (*smx_pfn_context_factory_finalize_t) (smx_context_factory_t*);
-typedef void (*smx_pfn_context_free_t) (smx_context_t);
-typedef void (*smx_pfn_context_start_t) (smx_context_t);
-typedef void (*smx_pfn_context_stop_t) (smx_context_t);
-typedef void (*smx_pfn_context_suspend_t) (smx_context_t context);
-typedef void (*smx_pfn_context_runall_t) (xbt_swag_t processes);
-typedef smx_context_t (*smx_pfn_context_self_t) (void);
-typedef void* (*smx_pfn_context_get_data_t) (smx_context_t context);
-
-/* interface of the context factories */
-typedef struct s_smx_context_factory {
-  const char *name;
-  smx_pfn_context_factory_create_context_t create_context;
-  smx_pfn_context_factory_finalize_t finalize;
-  smx_pfn_context_free_t free;
-  smx_pfn_context_stop_t stop;
-  smx_pfn_context_suspend_t suspend;
-  smx_pfn_context_runall_t runall;
-  smx_pfn_context_self_t self;
-  smx_pfn_context_get_data_t get_data;
-} s_smx_context_factory_t;
 
 
 void SIMIX_context_mod_init(void);
index f00c5b0..84bd8de 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt/log.h"
 #include "xbt/swag.h"
 #include "private.h"
-#include "bindings/smx_context.h"
+#include "simix/context.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_context, simix,
                                 "Context switching mecanism");
index 6e05383..64b965f 100644 (file)
@@ -8,7 +8,7 @@
 
 
 #include "xbt/function_types.h"
-#include "bindings/smx_context.h"
+#include "simix/context.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(bindings);
 
index c0c1a02..2bef17d 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "smx_context_sysv_private.h"
 #include "xbt/threadpool.h"
+#include "simix/private.h"
 
 #ifdef HAVE_VALGRIND_VALGRIND_H
 #  include <valgrind/valgrind.h>
index 2d2aea0..01f90d1 100644 (file)
@@ -10,7 +10,7 @@
 #define _XBT_CONTEXT_SYSV_PRIVATE_H
 
 #include "xbt/swag.h"
-#include "bindings/smx_context.h"
+#include "simix/smx_context.h"
 #include "portable.h"
 
 SG_BEGIN_DECL()
index f6bc39d..1c06a6c 100644 (file)
@@ -529,3 +529,10 @@ void SIMIX_process_exception_terminate(xbt_ex_t * e)
   xbt_ex_display(e);
   abort();
 }
+
+smx_context_t SIMIX_process_get_context(smx_process_t p) {
+  return p->context;
+}
+void SIMIX_process_set_context(smx_process_t p,smx_context_t c) {
+  p->context = c;
+}
index f10012e..4ecf4eb 100644 (file)
@@ -7,6 +7,7 @@
 #include "private.h"
 #include "xbt/dict.h"
 #include "xbt/sysdep.h"
+#include "surf/surf.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi,
                                 "Logging specific to SMPI (benchmarking)");
index 2b736c5..896facd 100644 (file)
@@ -10,6 +10,7 @@
 #include "private.h"
 #include "smpi_mpi_dt_private.h"
 #include "mc/mc.h"
+#include "surf/surf.h"
 
 XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories");