5 /* Copyright (c) 2004 Martin Quinson. All rights reserved. */
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. */
10 #include "xbt/sysdep.h"
12 #include "xbt/error.h"
13 #include "xbt/dynar.h"
14 #include "xbt/config.h"
16 #include "gras/process.h" /* FIXME: bad loop */
18 #include "xbt/module.h" /* this module */
20 #include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */
21 #include "gras_modinter.h" /* same in GRAS */
23 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
25 static int xbt_running_process = 0;
31 xbt_module_new_fct_t new;
32 xbt_module_finalize_fct_t finalize;
36 xbt_init(int *argc, char **argv) {
37 static short int first_run = 1;
39 xbt_init_defaultlog(argc, argv, NULL);
44 * xbt_init_defaultlog:
48 * Initialize the gras mecanisms.
51 xbt_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
52 INFO0("Initialize GRAS");
54 xbt_log_init(argc,argv,defaultlog);
56 gras_process_init(); /* calls procdata_init, which calls dynar_new */
57 /** init other submodules */
58 if (xbt_running_process++ == 0) {
68 * Finalize the gras mecanisms.
72 INFO0("Exiting GRAS");
74 if (--xbt_running_process == 0) {
80 DEBUG0("Exited GRAS");