Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This commit concerned the reimplementation of the xbt context switch mechanism.
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Nov 2007 18:06:01 +0000 (18:06 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Nov 2007 18:06:01 +0000 (18:06 +0000)
The gaol of this reimplementation is to separate the context switch mechanism of its implementation
(context switch implementation based ucontext, based native threads or java threads).
To do this, the code introduce a new concept : the context factory. This factory is responsible of
the construction of the context adapted to the desired context implementation. Normally, the context factory
to use is selected during the compilation process. But, for the java implementation of the context switch,
the simgrid library select dynamically the context factory to use (the java context factory to use). This
change also introduce three new concepts : the xbt_ucontext_t, the xbt_jcontext_t and the xbt_thread_context_t
which derived from the concept xbt_context_t. Each of them is specialized to respect an interface contract.
This contract is represented by function pointers such (start, stop, kill, schedule, yield...). For more details
on this function pointers see the source code file xbt_context.c.

The continuation gives the list of the modified, deleted and added files by this change.

Modified files:

src/msg/global.c get_pid is a function pointer
src/msg/private.h use xbt_context.h instead context.h

src/include/simix/simix.h        java process management functions are not needed now

src/java/simgrid/msg/ApplicationHandler.java   remove an useless printed message
src/java/simgrid/msg/msg.java        simgrid for java and simgrid are now the same library so the name of the java library is also simgrid
       add the call of the native function selectContextFactory() for the context switch based on the java threads

src/java/jmsg.c include the xbt_context_private.h which declare the context based java thread (jxbt_context.h  doesn't exist any more)
declare an define a new function native_to_java_process which returns the java process associated with a msg process
define the native function java_simgrid_msg_Msg_selectContextFactory()
use the xbt_context_stop() function to signal the end of the java thread instead the function xbt_context_exit()
src/java/jmsg.h add the declaration of the java_simgrid_msg_Msg_selectContextFactory() function
src/java/jmsg_host.c this file is now inclued from the file src/xbt/xbt_jcontext.c which declare the log category for java, so the macro XBT_LOG_EXTERNAL_CATEGORY is useless
src/java/jmsg_parallel_task.c the same reason of the file src/java/jmsg_host.c
src/java/jmsg_process.c the same reason of the file src/java/jmsg_host.c and this file needs to include src/xbt/xbt_jprocess.h instead the file src/xbt/context_private.h to get
the definition of the java context
src/java/jmsg_process.h include xbt_context.h instead the context.h header
src/java/jxbt_utilities.c the same reason of the file src/java/jmsg_host.c

src/simix/private.h include xbt_context.h instead the header context.h
src/simix/smx_process.c modify the function SIMIX_jprocess_create() : this function doesn't use any more the simix java process management and the jprocess object is now passed as
the fourth parameter of the function xbt_context_new().
src/surf/network.c it's pointers to functions
src/surf/surfxml_parse.c just initialize the variable surf_file_to_parse to NULL
src/surf/workstation_KCCFLN05.c         function pointers usage and ANSI C variable declarations
src/surf/workstation_ptask_L07.c function pointers usage and ANSI C variable declarations
src/surf/surf.c adapt the code to the specific path separator of Windows

src/xbt/xbt_main.c the function xbt_context_init() and xbt_context_exit() are now renamed xbt_context_mod_init() and xbt_context_mod_exit()
src/xbt/xbt_modinter.h declaration of xbt_context_mod_init() and xbt_context_mod_exit() functions
src/xbt/xbt_str.c avoid the warning thrown by the Visual C++ compiler when it meets a comparison between a signed and a unsigned integer

src/gras/rl_stubs.c use xbt_context_mod_init() and xbt_context_mod_exit() instead xbt_context_init() and xbt_context_exit()

src/makefile.am the java library build is now useless
src/makefile.in this is the consequence of the previous change (makefile.am)

Files to add:

src/xbt/xbt_context_private.h this header replace the file context_private.h
src/xbt/xbt_context.c this source file replace the file context.c
include/xbt/xbt_context.h this file replace the file context.h
src/xbt/xbt_context_factory.h this header declares the context factory structure used by xbt to build the adapted context
src/xbt/xbt_thread_context.h this header declares the structure used in the switch context process based on the native threads
src/xbt/xbt_thread_context.c this source file contains the implementation of the thread context
src/xbt/xbt_ucontext.h this header declares the structure used in the switch context process based on the ucontext
src/xbt/xbt_ucontext.c this source code file contains the implementation of the context based on the ucontext
src/xbt/xbt_jcontext.h this header contains the declaration of the structure used in the switch context process based on the java thread
src/xbt/xbt_jcontext.c this source code file contains the implementation of the context based on java thread

Files to delete:
src/xbt/context.c this file is replaced by the file src/xbt/xbt_context.c
src/include/xbt/context.h this file is replaced by the file include/xbt/xbt_context.h
src/xbt/context_private.h this file is replaced by the file src/xbt/xbt_context_private.h
src/java/jxbt_context.h this file is useless (reimplemented in xbt_context.h)
src/java/jxbt_context.c this file is useless (reimplemented in xbt_context.c)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5040 48e7efb5-ca39-0410-a469-dd3cf9ba447f

23 files changed:
src/gras/rl_stubs.c
src/include/simix/simix.h
src/java/jmsg.c
src/java/jmsg.h
src/java/jmsg_host.c
src/java/jmsg_parallel_task.c
src/java/jmsg_process.c
src/java/jmsg_process.h
src/java/jxbt_utilities.c
src/java/simgrid/msg/ApplicationHandler.java
src/java/simgrid/msg/Msg.java
src/msg/global.c
src/msg/private.h
src/simix/private.h
src/simix/smx_process.c
src/surf/network.c
src/surf/surf.c
src/surf/surfxml_parse.c
src/surf/workstation_KCCFLN05.c
src/surf/workstation_ptask_L07.c
src/xbt/xbt_main.c
src/xbt/xbt_str.c
src/xbt_modinter.h

index f9474fe..526b8a9 100644 (file)
@@ -11,6 +11,6 @@
 #include "xbt_modinter.h"
 #include "xbt/sysdep.h"
 
-void xbt_context_init(void) {}
+void xbt_context_mod_init(void) {}
    
-void xbt_context_exit(void) {}
+void xbt_context_mod_exit(void) {}
index 4d56103..a3d6ec0 100644 (file)
@@ -151,12 +151,6 @@ XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(char * name,
 
 void SIMIX_display_process_status(void);
 
-/* Helper functions for jMSG: manipulate the context data without breaking the module separation */
-void  SIMIX_process_set_jprocess(smx_process_t process, void *jp);
-void* SIMIX_process_get_jprocess(smx_process_t process);
-void  SIMIX_process_set_jenv(smx_process_t process, void *je);
-void* SIMIX_process_get_jenv(smx_process_t process);
-
 
 SG_END_DECL()
 
index d40d249..2495f52 100644 (file)
@@ -12,7 +12,7 @@
 #include "msg/msg.h"
 #include "msg/private.h"
 #include "simix/private.h"
-#include "java/jxbt_context.h"
+#include "xbt/xbt_context_private.h"
 
 #include "jmsg_process.h"
 #include "jmsg_host.h"
 #include "jmsg_channel.h"
 #include "jxbt_utilities.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(jmsg,"MSG for Java(TM)");
-
 #include "jmsg.h"
 
 static JavaVM * __java_vm = NULL;
 
+static jobject
+native_to_java_process(m_process_t process);
+
 JavaVM *
 get_java_VM(void) {
        return __java_vm;
@@ -41,6 +42,12 @@ get_current_thread_env(void) {
         return env;
 }
 
+static jobject
+native_to_java_process(m_process_t process)
+{
+       return ((xbt_jcontext_t)(process->simdata->s_process->simdata->context))->jprocess;     
+}
+
 
 /*
  * The MSG process connected functions implementation.                                 
@@ -108,6 +115,8 @@ Java_simgrid_msg_Msg_processCreate(JNIEnv* env, jclass cls, jobject jprocess_arg
                        /*data*/ (void*)process,
                        jprocess,env,
                        &process->simdata->s_process);
+
+  
   DEBUG1("context created (s_process=%p)",process->simdata->s_process);
 
 
@@ -176,7 +185,7 @@ Java_simgrid_msg_Msg_processKill(JNIEnv* env, jclass cls, jobject jprocess) {
   }
 
   /* delete the global reference */
-  jprocess_delete_global_ref(SIMIX_process_get_jprocess(process->simdata->s_process),env);
+  jprocess_delete_global_ref(native_to_java_process(process),env);
        
   /* kill the native process (this wrapper is call by the destructor of the java 
    * process instance)
@@ -216,12 +225,12 @@ Java_simgrid_msg_Msg_processFromPID(JNIEnv* env, jclass cls, jint PID) {
     return NULL;
   }
 
-  if(!SIMIX_process_get_jprocess(process->simdata->s_process)) {
+  if(!native_to_java_process(process)) {
     jxbt_throw_native(env, xbt_strdup("SIMIX_process_get_jprocess() failed"));
     return NULL;
   }
 
-  return (jobject)SIMIX_process_get_jprocess(process->simdata->s_process);
+  return (jobject)(native_to_java_process(process));
 }
 
 
@@ -260,7 +269,7 @@ Java_simgrid_msg_Msg_processSelf(JNIEnv* env, jclass cls) {
     return NULL;
   }
 
-  jprocess = SIMIX_process_get_jprocess(process->simdata->s_process);
+  jprocess = native_to_java_process(process);
 
   if(!jprocess)
     jxbt_throw_native(env, xbt_strdup("SIMIX_process_get_jprocess() failed"));
@@ -583,7 +592,7 @@ Java_simgrid_msg_Msg_taskGetSender(JNIEnv* env , jclass cls , jobject jtask) {
   }
        
   process = MSG_task_get_sender(task);
-  return SIMIX_process_get_jprocess(process->simdata->s_process);
+  return (jobject)native_to_java_process(process);
 }
 
 JNIEXPORT jobject JNICALL 
@@ -600,7 +609,7 @@ Java_simgrid_msg_Msg_parallelTaskGetSender(JNIEnv* env , jclass cls , jobject jt
        
   process = MSG_task_get_sender(task);
        
-  return SIMIX_process_get_jprocess(process->simdata->s_process);
+  return (jobject)native_to_java_process(process);
 }
 
 JNIEXPORT jobject JNICALL 
@@ -1099,7 +1108,7 @@ Java_simgrid_msg_Msg_processExit(JNIEnv* env, jclass cls, jobject jprocess) {
     return;
   }
 
-  jcontext_exit(process->simdata->s_process->simdata->context,0,get_current_thread_env());
+  xbt_context_stop(0);
 }
 
 JNIEXPORT void JNICALL 
@@ -1160,4 +1169,20 @@ Java_simgrid_msg_Msg_allHosts(JNIEnv * env, jclass cls_arg) {
   return jtable;
 }
 
+
+JNIEXPORT void JNICALL 
+Java_simgrid_msg_Msg_selectContextFactory(JNIEnv * env, jclass class,jstring jname)
+{
+       int rv;
+       
+       /* get the C string from the java string*/
+       const char* name = (*env)->GetStringUTFChars(env, jname, 0);
+
+       rv = xbt_context_select_factory(name);
+               
+       (*env)->ReleaseStringUTFChars(env, jname, name);
+       
+       if(rv)
+               jxbt_throw_native(env, xbt_strdup("xbt_select_context_factory() failed"));       
+}
   
index d38fa2c..2dbd5f2 100644 (file)
@@ -29,6 +29,8 @@ get_current_thread_env(void);
 JNIEXPORT void JNICALL 
 Java_simgrid_msg_Msg_processCreate(JNIEnv* env,jclass cls,jobject jprocess,jobject jhost);
 
+
+
 /*
  * Class               simgrid_msg_Msg
  * Method              processSuspend
@@ -457,4 +459,8 @@ Java_simgrid_msg_Msg_createEnvironment(JNIEnv* env, jclass cls,jstring jplatform
 JNIEXPORT void JNICALL 
 Java_simgrid_msg_Msg_platformLoad(JNIEnv* env, jclass cls, jobject jplatform);
 
+
+JNIEXPORT void JNICALL 
+Java_simgrid_msg_Msg_selectContextFactory(JNIEnv *, jclass, jstring);
+
 #endif /* !MSG4JAVA_H */ 
index e9b481b..1e76788 100644 (file)
@@ -15,8 +15,6 @@
 #include "jmsg_host.h"
 #include "jxbt_utilities.h"
 
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
-
 jobject jhost_new_instance(JNIEnv* env) {
        
   jclass cls = jxbt_get_class(env,"simgrid/msg/Host"); 
index 1af0f30..7f9b834 100644 (file)
@@ -15,8 +15,6 @@
 #include "jmsg_parallel_task.h"
 #include "jxbt_utilities.h"
 
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
-
 jobject
 jparallel_task_ref(JNIEnv* env, jobject jparallel_task) {
   jobject newref = (*env)->NewGlobalRef(env,jparallel_task); 
index d8bb153..286dbd8 100644 (file)
 #include "jmsg.h"
 #include "jxbt_utilities.h"
 
-#ifndef JAVA_SIMGRID
-#define JAVA_SIMGRID
-#endif 
-
-
-#include "xbt/context_private.h"
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
+#include "xbt/xbt_jcontext.h"
 
 
 jobject
@@ -194,7 +187,7 @@ jprocess_schedule(xbt_context_t context) {
        if(!id)
                return;
        
-       (*env)->CallVoidMethod(env,context->jprocess,id);
+       (*env)->CallVoidMethod(env,((xbt_jcontext_t)context)->jprocess,id);
 }
 
 
@@ -212,6 +205,6 @@ jprocess_unschedule(xbt_context_t context) {
        if(!id)
                return;
        
-       (*env)->CallVoidMethod(env,context->jprocess,id);
+       (*env)->CallVoidMethod(env,((xbt_jcontext_t)context)->jprocess,id);
 }
 
index 85bb943..7f563fc 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <jni.h>
 #include "msg/msg.h"
-#include "xbt/context.h"
+#include "xbt/xbt_context.h"
 
 /**
  * This function returns a global reference to the  java process instance 
index 6b9b7d1..aa2b5c6 100644 (file)
@@ -16,8 +16,6 @@
 #include "xbt/str.h"
 #include "jxbt_utilities.h"
 
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
-
 /* *********** */
 /* JNI GETTERS */
 /* *********** */
index a5c13c0..16bef1d 100644 (file)
@@ -94,14 +94,12 @@ public final class ApplicationHandler extends DefaultHandler
                public void createProcess(){
                        try {
                                
-                               System.out.println("Create process " + function + " on the host " + hostName);
                        Class cls = Class.forName(this.function);
                        simgrid.msg.Process process = (simgrid.msg.Process)cls.newInstance();
                        process.name = process.getName(); //this.function;
                        process.id = simgrid.msg.Process.nextProcessId++;
                        Host host = Host.getByName(this.hostName);
                        Msg.processCreate(process,host);
-                       
                        Vector args = processFactory.args;
                        int size = args.size();
                        
index 00384e7..7666926 100644 (file)
@@ -83,9 +83,15 @@ public final class Msg {
      */
     static {
         try {
-            System.loadLibrary("simgrid4java");
+            System.loadLibrary("simgrid");
+            Msg.selectContextFactory("jcontext_factory");
+        } catch(NativeException e)
+        {
+                 System.err.println(e.toString());
+                 e.printStackTrace();
+                 System.exit(1);
         } catch(UnsatisfiedLinkError e){
-            System.err.println("Cannot load simgrid4java library : ");
+            System.err.println("Cannot load simgrid library : ");
             e.printStackTrace();
            System.err.println("Please check your LD_LIBRARY_PATH, "+
                               "or copy the library to the current directory");
@@ -93,6 +99,9 @@ public final class Msg {
         }
     }
     
+    final static native 
+    void selectContextFactory(String name) throws NativeException;
+    
     /******************************************************************
      * The natively implemented methods connected to the MSG Process  *
      ******************************************************************/
index 7109a43..3436087 100644 (file)
@@ -43,7 +43,7 @@ void MSG_global_init_args(int *argc, char **argv)
  */
 void MSG_global_init(int *argc, char **argv)
 {
-  xbt_getpid = &MSG_process_self_PID;
+  xbt_getpid = MSG_process_self_PID;
   if (!msg_global) {
     SIMIX_global_init(argc, argv);
 
index bdaea3c..42c5d75 100644 (file)
@@ -18,7 +18,7 @@
 #include "xbt/dynar.h"
 #include "xbt/swag.h"
 #include "xbt/dict.h"
-#include "xbt/context.h"
+#include "xbt/xbt_context.h"
 #include "xbt/config.h"
 
 /**************** datatypes **********************************/
index 8a31f69..ccc29de 100644 (file)
@@ -15,7 +15,7 @@
 #include "xbt/fifo.h"
 #include "xbt/swag.h"
 #include "xbt/dict.h"
-#include "xbt/context.h"
+#include "xbt/xbt_context.h"
 #include "xbt/config.h"
 #include "xbt/function_types.h"
 
index 610b85c..548c9c6 100644 (file)
@@ -135,23 +135,24 @@ void SIMIX_jprocess_create(const char *name, smx_host_t host,
   simdata->argc = 0;
   simdata->argv = NULL;
 
-  simdata->context = xbt_context_new(name,NULL, NULL, NULL,
+  simdata->context = xbt_context_new(name,NULL, NULL, jprocess,
                                     simix_global->
                                     cleanup_process_function, process,
                                     /* argc/argv */ 0, NULL);
-
+       
   /* Process structure */
   process->name = xbt_strdup(name);
   process->simdata = simdata;
   process->data = data;
-  SIMIX_process_set_jprocess(process, jprocess);
-  SIMIX_process_set_jenv(process, jenv);
 
   xbt_swag_insert(process, host->simdata->process_list);
 
   /* fix current_process, about which xbt_context_start mocks around */
   self = simix_global->current_process;
   xbt_context_start(process->simdata->context);
   simix_global->current_process = self;
 
   xbt_swag_insert(process, simix_global->process_list);
@@ -388,25 +389,3 @@ int SIMIX_process_is_suspended(smx_process_t process)
 }
 
 
-/* Helper functions for jMSG: manipulate the context data without breaking the module separation */
-#include "xbt/context.h"       /* to pass java objects from MSG to the context */
-
-void SIMIX_process_set_jprocess(smx_process_t process, void *jp)
-{
-  xbt_context_set_jprocess(process->simdata->context, jp);
-}
-
-void *SIMIX_process_get_jprocess(smx_process_t process)
-{
-  return xbt_context_get_jprocess(process->simdata->context);
-}
-
-void SIMIX_process_set_jenv(smx_process_t process, void *je)
-{
-  xbt_context_set_jenv(process->simdata->context, je);
-}
-
-void *SIMIX_process_get_jenv(smx_process_t process)
-{
-  return xbt_context_get_jenv(process->simdata->context);
-}
index c63e89d..a754926 100644 (file)
@@ -174,7 +174,7 @@ static void parse_route_set_route(void)
   }
 }
 
-static void add_loopback()
+static void add_loopback(void)
 {
   int i;
   /* Adding loopback if needed */
@@ -191,13 +191,14 @@ static void add_loopback()
     }
 }
 
-static void add_route()
+static void add_route(void)
 {
   xbt_ex_t e;
   int nb_link = 0;
   unsigned int cpt = 0;    
   int link_list_capacity = 0;
   link_CM02_t *link_list = NULL;
+  char* link;
 
   if (routing_table == NULL) create_routing_table();
 
@@ -207,7 +208,7 @@ static void add_route()
   src_id = atoi(xbt_dynar_get_as(keys, 0, char*));
   dst_id = atoi(xbt_dynar_get_as(keys, 1, char*));
  
-  char* link = NULL;
+  link = NULL;
   xbt_dynar_foreach (links, cpt, link) {
       TRY {
        link_list[nb_link++] = xbt_dict_get(link_set, link);
@@ -228,15 +229,15 @@ static void count_hosts(void)
 static void define_callbacks(const char *file)
 {
   /* Figuring out the network links */
-  surfxml_add_callback(STag_surfxml_host_cb_list, &count_hosts);
-  surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
-  surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
-  surfxml_add_callback(STag_surfxml_platform_cb_list, &init_route_table);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
+  surfxml_add_callback(STag_surfxml_host_cb_list, count_hosts);
+  surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init);
+  surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties);
+  surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints);
+  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem);
+  surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route);
+  surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback);
 }
 
 static void *name_service(const char *name)
index 637ebf2..84ccf39 100644 (file)
@@ -379,7 +379,11 @@ FILE *surf_fopen(const char *name, const char *mode)
        path_name_len = strlen(path) + strlen(name) + 1;        /* plus '/' */
        path_name = xbt_realloc(path_name, path_name_len + 1);
       }
+      #ifdef WIN32
+      sprintf(path_name, "%s\\%s", path, name);
+      #else
       sprintf(path_name, "%s/%s", path, name);
+      #endif
       file = fopen(path_name, mode);
       if (file)
        return file;
index 49fd6ac..b0803d5 100644 (file)
@@ -49,7 +49,7 @@ static xbt_dynar_t surf_file_to_parse_stack = NULL;
 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t);
 
 YY_BUFFER_STATE surf_input_buffer;
-FILE *surf_file_to_parse;
+FILE *surf_file_to_parse = NULL;
 
 void make_route_table(void)
 {
@@ -359,6 +359,6 @@ void parse_route_elem(void)
 void parse_platform_file(const char* file)
 {
   surf_parse_open(file);
-  xbt_assert1((!surf_parse()), "Parse error in %s", file);
+  xbt_assert1((!(*surf_parse)()), "Parse error in %s", file);
   surf_parse_close();
 }
index 5732232..f64ae93 100644 (file)
@@ -1165,7 +1165,7 @@ static void parse_route_set_route(void)
   }
 }
 
-static void add_loopback()
+static void add_loopback(void)
 {
   int i;
   /* Adding loopback if needed */
@@ -1183,13 +1183,14 @@ static void add_loopback()
   }
 }
 
-static void add_route()
+static void add_route(void)
 {  
   xbt_ex_t e;
   int nb_link = 0;
   unsigned int cpt = 0;    
   int link_list_capacity = 0;
   link_KCCFLN05_t *link_list = NULL;
+  char* link;
 
   if (routing_table == NULL) create_routing_table();
 
@@ -1203,7 +1204,7 @@ static void add_route()
   impact_on_src_with_other_recv = atof(xbt_dynar_get_as(keys, 4, char*));
   impact_on_dst_with_other_send = atof(xbt_dynar_get_as(keys, 5, char*));
 
-  char* link = NULL;
+  link = NULL;
   xbt_dynar_foreach (links, cpt, link) {
       TRY {
         link_list[nb_link++] = xbt_dict_get(link_set, link);
@@ -1224,16 +1225,16 @@ static void define_callbacks(const char *file)
                                   
   /* Adding callback functions */
   surf_parse_reset_parser();
-  surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
-  surfxml_add_callback(STag_surfxml_router_cb_list, &parse_routers);
-  surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
-  surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
-  surfxml_add_callback(STag_surfxml_platform_cb_list, &init_route_table);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
+  surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
+  surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties);
+  surfxml_add_callback(STag_surfxml_router_cb_list, parse_routers);
+  surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init);
+  surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints);
+  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem);
+  surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route);
+  surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback);
 }
 
 /**************************************/
index 2eb7dcb..ca617a9 100644 (file)
@@ -898,13 +898,14 @@ static void add_loopback(void)
     }
 }
 
-static void add_route()
+static void add_route(void)
 {
     xbt_ex_t e;
     int nb_link = 0;
     unsigned int cpt = 0;
     int link_list_capacity = 0;
     link_L07_t *link_list = NULL;
+       char* link;
 
     if (routing_table == NULL) create_routing_table();
 
@@ -914,7 +915,7 @@ static void add_route()
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(link_L07_t, link_list_capacity);
 
-    char* link = NULL;
+    link = NULL;
     xbt_dynar_foreach (links, cpt, link) {
       TRY {
         link_list[nb_link++] = xbt_dict_get(link_set, link);
@@ -930,15 +931,15 @@ static void define_callbacks(const char *file)
 {
   /* Adding callback functions */
   surf_parse_reset_parser();
-  surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
-  surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
-  surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
-  surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
-  surfxml_add_callback(STag_surfxml_platform_cb_list, &init_route_table);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
+  surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
+  surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties);
+  surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init);
+  surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints);
+  surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem);
+  surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route);
+  surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback);
 }
 
 /**************************************/
index e1410b3..6023ad0 100644 (file)
@@ -37,7 +37,7 @@ xbt_init(int *argc, char **argv) {
   
   xbt_log_init(argc,argv);
   xbt_os_thread_mod_init();
-  xbt_context_init();
+  xbt_context_mod_init();
 }
 
 /** @brief Finalize the xbt mechanisms. */
@@ -47,7 +47,7 @@ xbt_exit(){
   if (xbt_initialized == 0) {
     xbt_fifo_exit();
     xbt_dict_exit();
-    xbt_context_exit();
+    xbt_context_mod_exit();
     xbt_os_thread_mod_exit();
     xbt_log_exit();
   }
index 6167b1f..edd062b 100644 (file)
@@ -454,7 +454,7 @@ char *xbt_str_join(xbt_dynar_t dyn, const char*sep) {
   res = xbt_malloc(len);
   p=res;
   xbt_dynar_foreach(dyn,cpt,cursor) {
-    if (cpt<dyn_len-1)
+    if ((int)cpt<dyn_len-1)
       p+=sprintf(p,"%s%s",cursor,sep);    
     else
       p+=sprintf(p,"%s",cursor);    
index 1064e47..2b3be41 100644 (file)
@@ -17,8 +17,8 @@ void xbt_log_exit(void);
 void xbt_fifo_exit(void);
 void xbt_dict_exit(void);
 
-void xbt_context_init(void);
-void xbt_context_exit(void);
+void xbt_context_mod_init(void);
+void xbt_context_mod_exit(void);
 
 void xbt_os_thread_mod_init(void);
 void xbt_os_thread_mod_exit(void);