diff options
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 158 |
1 files changed, 157 insertions, 1 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index d3d5285..2cd4f87 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -48,6 +48,9 @@ static void g_binary_symbol_init(GBinSymbol *); /* Procède à l'initialisation de l'interface de génération. */ static void g_binary_symbol_interface_init(GLineGeneratorInterface *); +/* Procède à l'initialisation de l'interface de sérialisation. */ +static void g_binary_symbol_serializable_init(GSerializableObjectInterface *); + /* Supprime toutes les références externes. */ static void g_binary_symbol_dispose(GBinSymbol *); @@ -76,6 +79,23 @@ static void g_binary_symbol_print(GBinSymbol *, GBufferLine *, size_t, size_t, c +/* -------------------- CONSERVATION ET RECHARGEMENT DES DONNEES -------------------- */ + + +/* Charge un contenu depuis une mémoire tampon. */ +static bool _g_binary_symbol_load(GBinSymbol *, GObjectStorage *, packed_buffer_t *); + +/* Charge un contenu depuis une mémoire tampon. */ +static bool g_binary_symbol_load(GBinSymbol *, GObjectStorage *, packed_buffer_t *); + +/* Sauvegarde un contenu dans une mémoire tampon. */ +static bool _g_binary_symbol_store(GBinSymbol *, GObjectStorage *, packed_buffer_t *); + +/* Sauvegarde un contenu dans une mémoire tampon. */ +static bool g_binary_symbol_store(GBinSymbol *, GObjectStorage *, packed_buffer_t *); + + + /* ---------------------------------------------------------------------------------- */ /* FONCTIONNALITES BASIQUES POUR SYMBOLES */ /* ---------------------------------------------------------------------------------- */ @@ -83,7 +103,8 @@ static void g_binary_symbol_print(GBinSymbol *, GBufferLine *, size_t, size_t, c /* Indique le type défini pour un symbole d'exécutable. */ G_DEFINE_TYPE_WITH_CODE(GBinSymbol, g_binary_symbol, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE(G_TYPE_LINE_GENERATOR, g_binary_symbol_interface_init)); + G_IMPLEMENT_INTERFACE(G_TYPE_LINE_GENERATOR, g_binary_symbol_interface_init) + G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_binary_symbol_serializable_init)); /****************************************************************************** @@ -107,6 +128,9 @@ static void g_binary_symbol_class_init(GBinSymbolClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_binary_symbol_dispose; object->finalize = (GObjectFinalizeFunc)g_binary_symbol_finalize; + klass->load = (load_symbol_fc)_g_binary_symbol_load; + klass->store = (store_symbol_fc)_g_binary_symbol_store; + } @@ -162,6 +186,26 @@ static void g_binary_symbol_interface_init(GLineGeneratorInterface *iface) /****************************************************************************** * * +* Paramètres : iface = interface GLib à initialiser. * +* * +* Description : Procède à l'initialisation de l'interface de sérialisation. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_binary_symbol_serializable_init(GSerializableObjectInterface *iface) +{ + iface->load = (load_serializable_object_cb)g_binary_symbol_load; + iface->store = (store_serializable_object_cb)g_binary_symbol_store; + +} + + +/****************************************************************************** +* * * Paramètres : symbol = instance d'objet GLib à traiter. * * * * Description : Supprime toutes les références externes. * @@ -871,3 +915,115 @@ static void g_binary_symbol_print(GBinSymbol *symbol, GBufferLine *line, size_t } } + + + +/* ---------------------------------------------------------------------------------- */ +/* CONSERVATION ET RECHARGEMENT DES DONNEES */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : symbol = élément GLib à constuire. * +* storage = conservateur de données à manipuler ou NULL. * +* pbuf = zone tampon à lire. * +* * +* Description : Charge un contenu depuis une mémoire tampon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool _g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf) +{ + bool result; /* Bilan à retourner */ + + result = true; + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = élément GLib à constuire. * +* storage = conservateur de données à manipuler ou NULL. * +* pbuf = zone tampon à lire. * +* * +* Description : Charge un contenu depuis une mémoire tampon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf) +{ + bool result; /* Bilan à retourner */ + GBinSymbolClass *class; /* Classe à activer */ + + class = G_BIN_SYMBOL_GET_CLASS(symbol); + + result = class->load(symbol, storage, pbuf); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = élément GLib à consulter. * +* storage = conservateur de données à manipuler ou NULL. * +* pbuf = zone tampon à remplir. * +* * +* Description : Sauvegarde un contenu dans une mémoire tampon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool _g_binary_symbol_store(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf) +{ + bool result; /* Bilan à retourner */ + + result = true; + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = élément GLib à consulter. * +* storage = conservateur de données à manipuler ou NULL. * +* pbuf = zone tampon à remplir. * +* * +* Description : Sauvegarde un contenu dans une mémoire tampon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool g_binary_symbol_store(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf) +{ + bool result; /* Bilan à retourner */ + GBinSymbolClass *class; /* Classe à activer */ + + class = G_BIN_SYMBOL_GET_CLASS(symbol); + + result = class->store(symbol, storage, pbuf); + + return result; + +} |