summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rwxr-xr-xsrc/core/Makefile.am15
-rw-r--r--src/core/core.c76
-rw-r--r--src/core/core.h40
-rw-r--r--src/core/params.c112
-rw-r--r--src/core/params.h58
5 files changed, 301 insertions, 0 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
new file mode 100755
index 0000000..0724a3f
--- /dev/null
+++ b/src/core/Makefile.am
@@ -0,0 +1,15 @@
+
+noinst_LTLIBRARIES = libcore.la
+
+libcore_la_SOURCES = \
+ core.h core.c \
+ params.h params.c
+
+libcore_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS)
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS =
diff --git a/src/core/core.c b/src/core/core.c
new file mode 100644
index 0000000..d90dd5c
--- /dev/null
+++ b/src/core/core.c
@@ -0,0 +1,76 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * core.c - chargement et le déchargement du tronc commun
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 "core.h"
+
+
+#include "params.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Charge les éléments de base du programme. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool load_all_basic_components(void)
+{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
+ result &= load_main_config_parameters();
+
+ result &= g_generic_config_read(get_main_configuration());
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Décharge les éléments de base du programme. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void unload_all_basic_components(void)
+{
+ g_generic_config_write(get_main_configuration());
+
+ unload_main_config_parameters();
+
+}
diff --git a/src/core/core.h b/src/core/core.h
new file mode 100644
index 0000000..2b0ef76
--- /dev/null
+++ b/src/core/core.h
@@ -0,0 +1,40 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * core.h - prototypes pour le chargement et le déchargement du tronc commun
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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_CORE_H
+#define _CORE_CORE_H
+
+
+#include <stdbool.h>
+
+
+
+/* Charge les éléments de base du programme. */
+bool load_all_basic_components(void);
+
+/* Décharge les éléments de base du programme. */
+void unload_all_basic_components(void);
+
+
+
+#endif /* _CORE_CORE_H */
diff --git a/src/core/params.c b/src/core/params.c
new file mode 100644
index 0000000..c8263f0
--- /dev/null
+++ b/src/core/params.c
@@ -0,0 +1,112 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * params.c - éléments de la configuration principale
+ *
+ * Copyright (C) 2009-2012 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 "params.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Procède au chargement de la configuration principale. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool load_main_config_parameters(void)
+{
+ GGenConfig *config; /* Configuration à charger */
+ GCfgParam *param; /* Paramètre chargé */
+
+ config = g_generic_config_new("main");
+ set_main_configuration(config);
+
+ param = g_generic_config_create_param(config, MPK_LAST_PROJECT, CPT_STRING, NULL);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_ELLIPSIS_HEADER, CPT_INTEGER, 54);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_ELLIPSIS_TAB, CPT_INTEGER, 35);
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_KEYBINDINGS_EDIT, CPT_STRING, "<Shift>F2");
+ if (param == NULL) return false;
+
+ param = g_generic_config_create_param(config, MPK_AUTO_SAVE, CPT_BOOLEAN, true);
+ if (param == NULL) return false;
+
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Procède au déchargement de la configuration principale. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void unload_main_config_parameters(void)
+{
+ GGenConfig *config; /* Configuration à décharger */
+
+ config = get_main_configuration();
+
+ g_object_unref(G_OBJECT(config));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : config = éventuelle configuration à définir comme principale.*
+* *
+* Description : Fournit un lien vers la configuration principale. *
+* *
+* Retour : Configuration prête à emploi ou NULL si aucune définie. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GGenConfig *_get_main_configuration(GGenConfig *config)
+{
+ static GGenConfig *result = NULL; /* Structure à retourner */
+
+ if (config != NULL)
+ result = config;
+
+ return result;
+
+}
diff --git a/src/core/params.h b/src/core/params.h
new file mode 100644
index 0000000..b79cc3a
--- /dev/null
+++ b/src/core/params.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * params.h - prototypes pour les éléments de la configuration principale
+ *
+ * Copyright (C) 2009-2012 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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_PARAMS_H
+#define _CORE_PARAMS_H
+
+
+#include "../glibext/configuration.h"
+
+
+
+/**
+ * Clefs de paramètres de configuration principale.
+ */
+
+#define MPK_LAST_PROJECT "gui.editor.last_project"
+#define MPK_ELLIPSIS_HEADER "gui.editor.panels.ellipsis_header"
+#define MPK_ELLIPSIS_TAB "gui.editor.panels.ellipsis_tab"
+#define MPK_KEYBINDINGS_EDIT "gui.key_bindings.global.edit"
+#define MPK_AUTO_SAVE "project.autosave"
+
+
+
+/* Procède au chargement de la configuration principale. */
+bool load_main_config_parameters(void);
+
+/* Procède au déchargement de la configuration principale. */
+void unload_main_config_parameters(void);
+
+#define set_main_configuration(cfg) _get_main_configuration(cfg)
+#define get_main_configuration() _get_main_configuration(NULL)
+
+/* Fournit un lien vers la configuration principale. */
+GGenConfig *_get_main_configuration(GGenConfig *);
+
+
+
+#endif /* _CORE_PARAMS_H */