summaryrefslogtreecommitdiff
path: root/src/format/mangling/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/mangling/context.c')
-rw-r--r--src/format/mangling/context.c91
1 files changed, 84 insertions, 7 deletions
diff --git a/src/format/mangling/context.c b/src/format/mangling/context.c
index d0235db..706af9f 100644
--- a/src/format/mangling/context.c
+++ b/src/format/mangling/context.c
@@ -34,6 +34,12 @@ static void g_demangling_context_class_init(GDemanglingContextClass *);
/* Initialise une instance de contexte pour décodage. */
static void g_demangling_context_init(GDemanglingContext *);
+/* Supprime toutes les références externes. */
+static void g_demangling_context_dispose(GDemanglingContext *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_demangling_context_finalize(GDemanglingContext *);
+
/* Indique le type défini pour un contexte de décodage. */
@@ -54,6 +60,12 @@ G_DEFINE_TYPE(GDemanglingContext, g_demangling_context, G_TYPE_OBJECT);
static void g_demangling_context_class_init(GDemanglingContextClass *klass)
{
+ GObjectClass *object; /* Autre version de la classe */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_demangling_context_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_demangling_context_finalize;
}
@@ -72,7 +84,47 @@ static void g_demangling_context_class_init(GDemanglingContextClass *klass)
static void g_demangling_context_init(GDemanglingContext *context)
{
- context->routine = g_binary_routine_new();
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : demangler = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_demangling_context_dispose(GDemanglingContext *context)
+{
+ if (context->gobj != NULL)
+ g_object_unref(context->gobj);
+
+ G_OBJECT_CLASS(g_demangling_context_parent_class)->dispose(G_OBJECT(context));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : demangler = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_demangling_context_finalize(GDemanglingContext *context)
+{
+ G_OBJECT_CLASS(g_demangling_context_parent_class)->finalize(G_OBJECT(context));
}
@@ -80,18 +132,32 @@ static void g_demangling_context_init(GDemanglingContext *context)
/******************************************************************************
* *
* Paramètres : context = instance à consulter. *
+* desc = chaîne de caractères à décoder. *
* *
-* Description : Fournit la routine créé à l'issue du codage. *
+* Description : Fournit la routine créée à l'issue du codage. *
* *
-* Retour : Instance en place ou NULL en cas d'erreur fatale. *
+* Retour : Bilan de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-GBinRoutine *g_demangling_context_get_decoded_routine(const GDemanglingContext *context)
+GBinRoutine *g_demangling_context_get_decoded_routine(GDemanglingContext *context, const char *desc)
{
- return context->routine;
+ GBinRoutine *result; /* Construction à remonter */
+
+ context->routine = g_binary_routine_new();
+
+ if (G_DEMANGLING_CONTEXT_GET_CLASS(context)->demangle_routine(context, desc))
+ {
+ g_object_ref(context->routine);
+ result = context->routine;
+ }
+
+ else
+ result = NULL;
+
+ return result;
}
@@ -108,8 +174,19 @@ GBinRoutine *g_demangling_context_get_decoded_routine(const GDemanglingContext *
* *
******************************************************************************/
-GDataType *g_demangling_context_get_decoded_type(const GDemanglingContext *context)
+GDataType *g_demangling_context_get_decoded_type(GDemanglingContext *context, const char *desc)
{
- return context->type;
+ GBinRoutine *result; /* Construction à remonter */
+
+ if (G_DEMANGLING_CONTEXT_GET_CLASS(context)->demangle_type(context, desc))
+ {
+ g_object_ref(context->type);
+ result = context->type;
+ }
+
+ else
+ result = NULL;
+
+ return result;
}