summaryrefslogtreecommitdiff
path: root/src/core/processors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/processors.c')
-rw-r--r--src/core/processors.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/core/processors.c b/src/core/processors.c
index 3211009..666ddac 100644
--- a/src/core/processors.c
+++ b/src/core/processors.c
@@ -24,6 +24,7 @@
#include "processors.h"
+#include <assert.h>
#include <malloc.h>
#include <pthread.h>
#include <string.h>
@@ -37,6 +38,9 @@
+/* Cache des singletons d'opérandes */
+static GSingletonFactory *__operands_factory = NULL;
+
/* Caractéristiques d'un processeur */
typedef struct _proc_t
{
@@ -85,6 +89,74 @@ void register_arch_gtypes(void)
/******************************************************************************
* *
+* Paramètres : - *
+* *
+* Description : Met en place le fournisseur d'instances uniques d'opérandes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void init_operands_factory(void)
+{
+ assert(__operands_factory == NULL);
+
+ __operands_factory = g_singleton_factory_new();
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit l'usine à opérandes pour toutes les instructions. *
+* *
+* Retour : Producteur d'instances uniques. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GSingletonFactory *get_operands_factory(void)
+{
+ GSingletonFactory *result; /* Usine à renvoyer */
+
+ result = __operands_factory;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
+
+}
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Supprime le fournisseur d'instances uniques d'opérandes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void exit_operands_factory(void)
+{
+ assert(__operands_factory != NULL);
+
+ g_clear_object(&__operands_factory);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : type = type GLib représentant le type à instancier. *
* *
* Description : Enregistre un processeur pour une architecture donnée. *