diff options
Diffstat (limited to 'src/arch/register.c')
-rw-r--r-- | src/arch/register.c | 110 |
1 files changed, 105 insertions, 5 deletions
diff --git a/src/arch/register.c b/src/arch/register.c index 706fcd4..3094e0f 100644 --- a/src/arch/register.c +++ b/src/arch/register.c @@ -37,6 +37,12 @@ static void g_arch_register_class_init(GArchRegisterClass *); /* Initialise une instance de registre. */ static void g_arch_register_init(GArchRegister *); +/* Supprime toutes les références externes. */ +static void g_arch_register_dispose(GArchRegister *); + +/* Procède à la libération totale de la mémoire. */ +static void g_arch_register_finalize(GArchRegister *); + /* ------------------------- REGISTRE SOUS FORME D'OPERANDE ------------------------- */ @@ -48,6 +54,12 @@ static void g_register_operand_class_init(GRegisterOperandClass *); /* Initialise une instance d'opérande de registre. */ static void g_register_operand_init(GRegisterOperand *); +/* Supprime toutes les références externes. */ +static void g_register_operand_dispose(GRegisterOperand *); + +/* Procède à la libération totale de la mémoire. */ +static void g_register_operand_finalize(GRegisterOperand *); + /* Compare un opérande avec un autre. */ static bool g_register_operand_compare(const GRegisterOperand *, const GRegisterOperand *); @@ -79,6 +91,12 @@ G_DEFINE_TYPE(GArchRegister, g_arch_register, G_TYPE_OBJECT); static void g_arch_register_class_init(GArchRegisterClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_arch_register_dispose; + object->finalize = (GObjectFinalizeFunc)g_arch_register_finalize; } @@ -103,6 +121,44 @@ static void g_arch_register_init(GArchRegister *reg) /****************************************************************************** * * +* Paramètres : binary = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_arch_register_dispose(GArchRegister *reg) +{ + G_OBJECT_CLASS(g_arch_register_parent_class)->dispose(G_OBJECT(reg)); + +} + + +/****************************************************************************** +* * +* Paramètres : binary = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_arch_register_finalize(GArchRegister *reg) +{ + G_OBJECT_CLASS(g_arch_register_parent_class)->finalize(G_OBJECT(reg)); + +} + + +/****************************************************************************** +* * * Paramètres : reg = opérande à consulter pour le calcul. * * * * Description : Produit une empreinte à partir d'un registre. * @@ -261,6 +317,17 @@ G_DEFINE_TYPE(GRegisterOperand, g_register_operand, G_TYPE_ARCH_OPERAND); static void g_register_operand_class_init(GRegisterOperandClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + GArchOperandClass *operand; /* Version de classe parente */ + + object = G_OBJECT_CLASS(klass); + operand = G_ARCH_OPERAND_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_register_operand_dispose; + object->finalize = (GObjectFinalizeFunc)g_register_operand_finalize; + + operand->compare = (operand_compare_fc)g_register_operand_compare; + operand->print = (operand_print_fc)g_register_operand_print; } @@ -279,14 +346,47 @@ static void g_register_operand_class_init(GRegisterOperandClass *klass) static void g_register_operand_init(GRegisterOperand *operand) { - GArchOperand *parent; /* Instance parente */ + operand->is_written = false; - parent = G_ARCH_OPERAND(operand); +} - parent->compare = (operand_compare_fc)g_register_operand_compare; - parent->print = (operand_print_fc)g_register_operand_print; - operand->is_written = false; +/****************************************************************************** +* * +* Paramètres : binary = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_register_operand_dispose(GRegisterOperand *operand) +{ + g_object_unref(G_OBJECT(operand->reg)); + + G_OBJECT_CLASS(g_register_operand_parent_class)->dispose(G_OBJECT(operand)); + +} + + +/****************************************************************************** +* * +* Paramètres : binary = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_register_operand_finalize(GRegisterOperand *operand) +{ + G_OBJECT_CLASS(g_register_operand_parent_class)->finalize(G_OBJECT(operand)); } |