summaryrefslogtreecommitdiff
path: root/src/arch/operands/proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/operands/proxy.c')
-rw-r--r--src/arch/operands/proxy.c126
1 files changed, 69 insertions, 57 deletions
diff --git a/src/arch/operands/proxy.c b/src/arch/operands/proxy.c
index 992c481..91690a7 100644
--- a/src/arch/operands/proxy.c
+++ b/src/arch/operands/proxy.c
@@ -43,6 +43,11 @@ static void g_proxy_operand_dispose(GProxyOperand *);
/* Procède à la libération totale de la mémoire. */
static void g_proxy_operand_finalize(GProxyOperand *);
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
/* Compare un opérande avec un autre. */
static int g_proxy_operand_compare(const GProxyOperand *, const GProxyOperand *, bool);
@@ -52,16 +57,11 @@ static void g_proxy_operand_print(const GProxyOperand *, GBufferLine *);
/* Fournit l'empreinte d'un candidat à une centralisation. */
static guint g_proxy_operand_hash(const GProxyOperand *, bool);
+/* Charge un contenu depuis une mémoire tampon. */
+static bool g_proxy_operand_load(GProxyOperand *, GObjectStorage *, packed_buffer_t *);
-
-/* --------------------- TRANSPOSITIONS VIA CACHE DES OPERANDES --------------------- */
-
-
-/* Charge un opérande depuis une mémoire tampon. */
-static bool g_proxy_operand_unserialize(GProxyOperand *, GAsmStorage *, GBinFormat *, packed_buffer_t *);
-
-/* Sauvegarde un opérande dans une mémoire tampon. */
-static bool g_proxy_operand_serialize(const GProxyOperand *, GAsmStorage *, packed_buffer_t *);
+/* Sauvegarde un contenu dans une mémoire tampon. */
+static bool g_proxy_operand_store(GProxyOperand *, GObjectStorage *, packed_buffer_t *);
@@ -103,8 +103,8 @@ static void g_proxy_operand_class_init(GProxyOperandClass *klass)
operand->hash = (operand_hash_fc)g_proxy_operand_hash;
- operand->unserialize = (unserialize_operand_fc)g_proxy_operand_unserialize;
- operand->serialize = (serialize_operand_fc)g_proxy_operand_serialize;
+ operand->load = (load_operand_fc)g_proxy_operand_load;
+ operand->store = (store_operand_fc)g_proxy_operand_store;
}
@@ -195,6 +195,37 @@ GArchOperand *g_proxy_operand_new(GProxyFeeder *feeder)
/******************************************************************************
* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Fournit le fournisseur représenté par l'opérande. *
+* *
+* Retour : Fournisseur associé à l'opérande. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GProxyFeeder *g_proxy_operand_get_feeder(const GProxyOperand *operand)
+{
+ GProxyFeeder *result; /* Instance à retourner */
+
+ result = operand->feeder;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
* Paramètres : a = premier opérande à consulter. *
* b = second opérande à consulter. *
* lock = précise le besoin en verrouillage. *
@@ -301,43 +332,11 @@ static guint g_proxy_operand_hash(const GProxyOperand *operand, bool lock)
/******************************************************************************
* *
-* Paramètres : operand = opérande à consulter. *
+* Paramètres : operand = élément GLib à constuire. *
+* storage = conservateur de données à manipuler ou NULL. *
+* pbuf = zone tampon à lire. *
* *
-* Description : Fournit le fournisseur représenté par l'opérande. *
-* *
-* Retour : Fournisseur associé à l'opérande. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GProxyFeeder *g_proxy_operand_get_feeder(const GProxyOperand *operand)
-{
- GProxyFeeder *result; /* Instance à retourner */
-
- result = operand->feeder;
-
- g_object_ref(G_OBJECT(result));
-
- return result;
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande d'assemblage à constituer. *
-* storage = mécanisme de sauvegarde à manipuler. *
-* format = format binaire chargé associé à l'architecture. *
-* pbuf = zone tampon à remplir. *
-* *
-* Description : Charge un opérande depuis une mémoire tampon. *
+* Description : Charge un contenu depuis une mémoire tampon. *
* *
* Retour : Bilan de l'opération. *
* *
@@ -345,17 +344,26 @@ GProxyFeeder *g_proxy_operand_get_feeder(const GProxyOperand *operand)
* *
******************************************************************************/
-static bool g_proxy_operand_unserialize(GProxyOperand *operand, GAsmStorage *storage, GBinFormat *format, packed_buffer_t *pbuf)
+static bool g_proxy_operand_load(GProxyOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
GArchOperandClass *parent; /* Classe parente à consulter */
+ GSerializableObject *feeder; /* Fournisseur manipulé */
parent = G_ARCH_OPERAND_CLASS(g_proxy_operand_parent_class);
- result = parent->unserialize(G_ARCH_OPERAND(operand), storage, format, pbuf);
+ result = parent->load(G_ARCH_OPERAND(operand), storage, pbuf);
if (result)
- result = g_proxy_feeder_unserialize(operand->feeder, format, pbuf);
+ {
+ feeder = g_object_storage_unpack_object(storage, "operands", pbuf);
+
+ result = (feeder != NULL);
+
+ if (result)
+ operand->feeder = G_PROXY_FEEDER(feeder);
+
+ }
return result;
@@ -364,11 +372,11 @@ static bool g_proxy_operand_unserialize(GProxyOperand *operand, GAsmStorage *sto
/******************************************************************************
* *
-* Paramètres : operand = opérande d'assemblage à consulter. *
-* storage = mécanisme de sauvegarde à manipuler. *
+* Paramètres : operand = élément GLib à consulter. *
+* storage = conservateur de données à manipuler ou NULL. *
* pbuf = zone tampon à remplir. *
* *
-* Description : Sauvegarde un opérande dans une mémoire tampon. *
+* Description : Sauvegarde un contenu dans une mémoire tampon. *
* *
* Retour : Bilan de l'opération. *
* *
@@ -376,17 +384,21 @@ static bool g_proxy_operand_unserialize(GProxyOperand *operand, GAsmStorage *sto
* *
******************************************************************************/
-static bool g_proxy_operand_serialize(const GProxyOperand *operand, GAsmStorage *storage, packed_buffer_t *pbuf)
+static bool g_proxy_operand_store(GProxyOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
- GArchOperandClass *parent; /* Classe parente à consulter */
+ GArchOperandClass *parent; /* Classe parente à consulter */
+ GSerializableObject *feeder; /* Fournisseur manipulé */
parent = G_ARCH_OPERAND_CLASS(g_proxy_operand_parent_class);
- result = parent->serialize(G_ARCH_OPERAND(operand), storage, pbuf);
+ result = parent->store(G_ARCH_OPERAND(operand), storage, pbuf);
if (result)
- result = g_proxy_feeder_serialize(operand->feeder, pbuf);
+ {
+ feeder = G_SERIALIZABLE_OBJECT(operand->feeder);
+ result = g_object_storage_pack_object(storage, "operands", feeder, pbuf);
+ }
return result;