Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert the last bits of surf to C++
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 6 Feb 2016 00:48:01 +0000 (01:48 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 6 Feb 2016 00:48:01 +0000 (01:48 +0100)
include/simgrid/forward.h
include/surf/surfxml_parse.h
src/surf/instr_surf.cpp [moved from src/surf/instr_surf.c with 100% similarity]
src/surf/simgrid_dtd.c
src/surf/surfxml_parse.cpp [moved from src/surf/surfxml_parse.c with 99% similarity]
tools/cmake/DefinePackages.cmake
tools/cmake/MaintainerMode.cmake

index ecab7aa..8696b47 100644 (file)
@@ -247,7 +247,7 @@ typedef struct {
   sg_size_t size;
 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
 
-#define SG_PLATF_STORAGE_TYPE_INITIALIZER {NULL,NULL,NULL,NULL,NULL,NULL}
+#define SG_PLATF_STORAGE_TYPE_INITIALIZER {NULL,NULL,NULL,NULL,NULL,NULL,0}
 
 typedef struct {
   const char* type_id;
index 4479db1..b270f5d 100644 (file)
 #include "xbt/misc.h"
 #include "xbt/function_types.h"
 #include "xbt/dict.h"
-#include "surf/simgrid_dtd.h"
 
+SG_BEGIN_DECL()
+#include "surf/simgrid_dtd.h"
 
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
 typedef size_t yy_size_t;
 #endif
 
-SG_BEGIN_DECL()
-
 XBT_PUBLIC(void) surf_parse_open(const char *file);
 XBT_PUBLIC(void) surf_parse_close(void);
 XBT_PUBLIC(void) surf_parse_init_callbacks(void);
index 8fa6d34..09e0f06 100644 (file)
@@ -202,7 +202,7 @@ extern FILE *surf_parse_in, *surf_parse_out;
      */
     #define  YY_LESS_LINENO(n) \
             do { \
-                int yyl;\
+                unsigned int yyl;\
                 for ( yyl = n; yyl < surf_parse_leng; ++yyl )\
                     if ( surf_parse_text[yyl] == '\n' )\
                         --surf_parse_lineno;\
similarity index 99%
rename from src/surf/surfxml_parse.c
rename to src/surf/surfxml_parse.cpp
index 596a5b9..6652174 100644 (file)
@@ -447,7 +447,7 @@ void ETag_surfxml_host(void)    {
   }
   else {
          xbt_dynar_t pstate_list = xbt_str_split(buf, ",");
-         int i;
+         unsigned int i;
          for (i = 0; i < xbt_dynar_length(pstate_list); i++) {
                  double speed;
                  char* speed_str;
@@ -884,7 +884,7 @@ void STag_surfxml_AS(void){
 void ETag_surfxml_AS(void){
   if(as_prop_nb){
     char *name      = as_name_tab[as_prop_nb-1];
-    xbt_dict_t dict = as_dict_tab[as_prop_nb-1];
+    xbt_dict_t dict = (xbt_dict_t) as_dict_tab[as_prop_nb-1];
     as_prop_nb--;
     XBT_DEBUG("POP prop %p for AS '%s'",dict,name);
     xbt_lib_set(as_router_lib,
@@ -962,7 +962,7 @@ void ETag_surfxml_process(void){
 
 void STag_surfxml_argument(void){
   argc++;
-  argv = xbt_realloc(argv, (argc) * sizeof(char *));
+  argv = (char**)xbt_realloc(argv, (argc) * sizeof(char **));
   argv[(argc) - 1] = xbt_strdup(A_surfxml_argument_value);
 }
 
@@ -1067,6 +1067,6 @@ double parse_cpu_speed(const char *str_speed)
 
 xbt_dict_t get_as_router_properties(const char* name)
 {
-  return xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL);
+  return (xbt_dict_t)xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL);
 }
 
index d7e8133..f511724 100644 (file)
@@ -79,7 +79,7 @@ set(EXTRA_DIST
   src/surf/surf_routing_none.hpp
   src/surf/surf_routing_private.hpp
   src/surf/surf_routing_vivaldi.hpp
-  src/surf/surfxml_parse.c
+  src/surf/surfxml_parse.cpp
   src/surf/vm_hl13.hpp
   src/surf/PropertyHolder.hpp
   src/surf/virtual_machine.hpp
@@ -312,7 +312,7 @@ set(SURF_SRC
   src/surf/cpu_ti.cpp
   src/surf/fair_bottleneck.cpp
   src/surf/instr_routing.cpp
-  src/surf/instr_surf.c
+  src/surf/instr_surf.cpp
   src/surf/lagrange.cpp
   src/surf/maxmin.cpp
   src/surf/network_cm02.cpp
@@ -338,7 +338,7 @@ set(SURF_SRC
   src/surf/surf_routing_none.cpp
   src/surf/surf_routing_vivaldi.cpp
   src/surf/surfxml_private.h
-  src/surf/surfxml_parse.c
+  src/surf/surfxml_parse.cpp
   src/surf/surfxml_parseplatf.cpp
   src/surf/trace_mgr.hpp
   src/surf/trace_mgr.cpp
index fbedec0..bf8bd9c 100644 (file)
@@ -202,6 +202,7 @@ if(enable_maintainer_mode AND NOT WIN32)
       COMMAND ${FLEX_EXE} -o src/surf/simgrid_dtd.c -Psurf_parse_ --noline src/surf/simgrid_dtd.l
       COMMAND ${SED_EXE} -i ${string9} src/surf/simgrid_dtd.c
       COMMAND ${SED_EXE} -i ${string15} src/surf/simgrid_dtd.c
+      COMMAND ${SED_EXE} -i "s/int yyl;/unsigned int yyl;/" src/surf/simgrid_dtd.c
       COMMAND ${CMAKE_COMMAND} -E echo "surf/simgrid_dtd.c"
 
       #xbt/graphxml.c: xbt/graphxml.l