Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Getting rid of useless field
[simgrid.git] / src / xbt / module.c
index f21cd23..69b1db4 100644 (file)
@@ -2,58 +2,49 @@
 
 /* module handling                                                          */
 
-/* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2003 the OURAGAN project.                                  */
+/* Copyright (c) 2003, 2004 Martin Quinson. 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. */
* under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/dynar.h"
+#include "xbt/config.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,GRAS);
+#include "xbt/module.h" /* this module */
 
-extern void gras_log_finalize(void);
+#include "xbt_modinter.h"  /* prototype of other module's init/exit in XBT */
 
-struct gras_module_ {
-  gras_dynar_t *deps;
-  gras_cfg_t *cfg;
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
+
+char *xbt_binary_name=NULL; /* Mandatory to retrieve neat backtraces */
+
+struct xbt_module_ {
+  xbt_dynar_t *deps;
+  xbt_cfg_t *cfg;
   int ref;
-  gras_module_new_fct_t new;
-  gras_module_finalize_fct_t finalize;
+  xbt_module_new_fct_t new;
+  xbt_module_finalize_fct_t finalize;
 };
 
-
-/**
- * gras_init:
- * @argc:
- * @argv:
- *
- * Initialize the gras mecanisms.
- */
-void
-gras_init(int argc,char **argv) {
-  int i;
-  char *opt;
-  gras_error_t errcode;
-
-  INFO0("Initialize GRAS");
-  for (i=1; i<argc; i++) {
-    if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
-      opt=strchr(argv[i],'=');
-      opt++;
-      TRYFAIL(gras_log_control_set(opt));
-    }
-  }
+/** @brief Initialize the xbt mechanisms. */
+void 
+xbt_init(int *argc, char **argv) {
+  static short int first_run = 1;
+  if (!first_run)
+    return;
+
+  xbt_binary_name = strdup(argv[0]);
+  first_run = 0;
+  VERB0("Initialize XBT");
+  
+  xbt_log_init(argc,argv);
 }
 
-/**
- * gras_finalize:
- * @argc:
- * @argv:
- *
- * Finalize the gras mecanisms.
- */
+/** @brief Finalize the xbt mechanisms. */
 void 
-gras_finalize(){
-  gras_log_finalize();
+xbt_exit(){
+  xbt_log_exit();
 }
+