Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Importing the documentation !!! :)
[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 void 
31 xbt_init(int *argc, char **argv) {
32   xbt_init_defaultlog(argc, argv, NULL);
33 }
34
35 /**
36  * xbt_init_defaultlog:
37  * @argc:
38  * @argv:
39  *
40  * Initialize the xbt mecanisms.
41  */
42 void
43 xbt_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
44   static short int first_run = 1;
45   if (!first_run)
46     return;
47   
48   first_run = 0;
49   INFO0("Initialize XBT");
50   
51   xbt_log_init(argc,argv,defaultlog);
52 }
53
54 /**
55  * xbt_exit:
56  *
57  * Finalize the xbt mecanisms.
58  */
59 void 
60 xbt_exit(){
61   xbt_log_exit();
62 }