Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move the type definition to a specific header so that we can share it with the code...
[simgrid.git] / src / xbt / module.c
1 /* $Id$ */
2
3 /* module handling                                                          */
4
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "xbt/sysdep.h"
11 #include "xbt/log.h"
12 #include "xbt/error.h"
13 #include "xbt/dynar.h"
14 #include "xbt/config.h"
15
16 #include "xbt/module.h" /* this module */
17
18 #include "xbt_modinter.h"  /* prototype of other module's init/exit in XBT */
19
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
21
22 struct xbt_module_ {
23   xbt_dynar_t *deps;
24   xbt_cfg_t *cfg;
25   int ref;
26   xbt_module_new_fct_t new;
27   xbt_module_finalize_fct_t finalize;
28 };
29
30 /** @brief Initialize the xbt mechanisms. */
31 void 
32 xbt_init(int *argc, char **argv) {
33   xbt_init_defaultlog(argc, argv, NULL);
34 }
35
36 /** @brief Initialize the xbt mechanisms. */
37 void
38 xbt_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
39   static short int first_run = 1;
40   if (!first_run)
41     return;
42   
43   first_run = 0;
44   INFO0("Initialize XBT");
45   
46   xbt_log_init(argc,argv,defaultlog);
47 }
48
49 /** @brief Finalize the xbt mechanisms. */
50 void 
51 xbt_exit(){
52   xbt_log_exit();
53 }
54