diff options
Diffstat (limited to 'src/core')
-rwxr-xr-x | src/core/Makefile.am | 1 | ||||
-rw-r--r-- | src/core/core.c | 5 | ||||
-rw-r--r-- | src/core/global.c | 73 | ||||
-rw-r--r-- | src/core/global.h | 40 |
4 files changed, 119 insertions, 0 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index f76f520..26d43a5 100755 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -5,6 +5,7 @@ libcore_la_SOURCES = \ collections.h collections.c \ core.h core.c \ formats.h formats.c \ + global.h global.c \ params.h params.c \ processors.h processors.c diff --git a/src/core/core.c b/src/core/core.c index b382e34..5b60384 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -35,6 +35,7 @@ #include "collections.h" #include "formats.h" +#include "global.h" #include "params.h" #include "processors.h" #include "../analysis/db/keymgn.h" @@ -61,6 +62,7 @@ bool load_all_basic_components(void) { static bool result = false; /* Bilan à retourner */ char *cfgdir; /* Répertoire de configuration */ + GWorkQueue *queue; /* Singleton pour tâches */ /** * On mémorise les passages réussis. @@ -91,6 +93,9 @@ bool load_all_basic_components(void) result &= g_generic_config_read(get_main_configuration()); + queue = g_work_queue_new(); + set_work_queue(queue); + result &= init_segment_content_hash_table(); result &= load_hard_coded_processors_definitions(); diff --git a/src/core/global.c b/src/core/global.c new file mode 100644 index 0000000..86c7e5f --- /dev/null +++ b/src/core/global.c @@ -0,0 +1,73 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * global.c - conservation et accès aux variables globales + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "global.h" + + +#include <assert.h> + + + +/* Gestionnaire de tâches parallèles */ +static GWorkQueue *_queue = NULL; + + + +/****************************************************************************** +* * +* Paramètres : queue = nouveau gestionnaire à mémoriser ou NULL. * +* * +* Description : Définit le gestionnaire de traitements parallèles courant. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void set_work_queue(GWorkQueue *queue) +{ + assert(_queue == NULL); + + _queue = queue; + +} + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Fournit le gestionnaire de traitements parallèles courant. * +* * +* Retour : Gestionnaire de traitements parallèles courant. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GWorkQueue *get_work_queue(void) +{ + return _queue; + +} diff --git a/src/core/global.h b/src/core/global.h new file mode 100644 index 0000000..d29cb76 --- /dev/null +++ b/src/core/global.h @@ -0,0 +1,40 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * global.h - prototypes pour la conservation et l'accès aux variables globales + * + * Copyright (C) 2017 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _CORE_GLOBAL_H +#define _CORE_GLOBAL_H + + +#include "../glibext/delayed.h" + + + +/* Définit le gestionnaire de traitements parallèles courant. */ +void set_work_queue(GWorkQueue *); + +/* Fournit le gestionnaire de traitements parallèles courant. */ +GWorkQueue *get_work_queue(void); + + + +#endif /* _CORE_GLOBAL_H */ |