Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sg_cmdline is a public dynar containing all command-line arguments we got
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 16 Oct 2012 00:12:07 +0000 (02:12 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 16 Oct 2012 00:12:07 +0000 (02:12 +0200)
ChangeLog
include/simgrid_config.h.in
src/surf/surf.c

index 393ab80..a93902a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,10 @@ SimGrid (3.8) NOT RELEASED; urgency=low
  * Implement the exchange of non-contiguous data.
    [Khalid Hasanov & Jean-Noel Quintin] Thanks for the patch, guys.
 
+ SimGrid:
+ * Export a sg_cmdline dynar containing all the arguments we got from
+   the command line.
+
  XBT:
  * Functions xbt_dict_hash() and xbt_dict_hash_ext() are made public,
    and renamed to xbt_str_hash() and xbt_str_hash_ext().
index 1c5edc8..06ecec8 100644 (file)
@@ -1,11 +1,12 @@
 /* simgrid_config.h - Results of the configure made visible to user code    */
 
-/* Copyright (c) 2009, 2010, 2011. Da SimGrid team. All rights reserved.    */
+/* Copyright (c) 2009-2012. Da 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. */
 
 #include "xbt/misc.h"           /* XBT_PUBLIC */
+#include "xbt/dynar.h"          /* sg_commandline */
 
 #ifndef SIMGRID_PUBLIC_CONFIG_H
 #define SIMGRID_PUBLIC_CONFIG_H
@@ -33,6 +34,9 @@ SG_BEGIN_DECL()
     SIMGRID_VERSION_MAJOR and friends give the version numbers of the used header files */
 XBT_PUBLIC(void) sg_version(int *major,int *minor,int *patch);
 
+/** Contains all the parameters we got from the command line */
+XBT_PUBLIC_DATA(xbt_dynar_t) sg_cmdline;
+
 /* take care of DLL usage madness */
 
 #ifdef _XBT_DLL_EXPORT
index 729e6c3..67cd8a4 100644 (file)
@@ -391,6 +391,8 @@ void sg_version(int *ver_major,int *ver_minor,int *ver_patch) {
   *ver_patch = SIMGRID_VERSION_PATCH;
 }
 
+xbt_dynar_t sg_cmdline = NULL;
+
 void surf_init(int *argc, char **argv)
 {
   XBT_DEBUG("Create all Libs");
@@ -411,6 +413,11 @@ void surf_init(int *argc, char **argv)
   SURF_WKS_LEVEL = xbt_lib_add_level(host_lib,surf_resource_free);
   SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,surf_resource_free);
 
+  sg_cmdline = xbt_dynar_new(sizeof(char*),NULL);
+  int i;
+  for (i=0;i<*argc;i++) {
+    xbt_dynar_push(sg_cmdline,&(argv[i]));
+  }
   xbt_init(argc, argv);
   if (!model_list)
     model_list = xbt_dynar_new(sizeof(surf_model_private_t), NULL);
@@ -482,6 +489,7 @@ void surf_exit(void)
 #endif
 
   xbt_dynar_free(&surf_path);
+  xbt_dynar_free(&sg_cmdline);
 
   xbt_lib_free(&host_lib);
   xbt_lib_free(&link_lib);