summaryrefslogtreecommitdiff
path: root/src/decomp/expr/assign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decomp/expr/assign.c')
-rw-r--r--src/decomp/expr/assign.c287
1 files changed, 0 insertions, 287 deletions
diff --git a/src/decomp/expr/assign.c b/src/decomp/expr/assign.c
deleted file mode 100644
index 6a614ae..0000000
--- a/src/decomp/expr/assign.c
+++ /dev/null
@@ -1,287 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * assign.c - représentation des assignations
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "assign.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une assignation quelconque (instance) */
-struct _GAssignExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *dest; /* Destination de l'assignat° */
- GDecExpression *src; /* Source de l'assignation */
-
-};
-
-
-/* Définition d'une assignation quelconque (classe) */
-struct _GAssignExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des assignations quelconques. */
-static void g_assign_expression_class_init(GAssignExpressionClass *);
-
-/* Initialise une instance d'assignation quelconque. */
-static void g_assign_expression_init(GAssignExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_assign_expression_visit(GAssignExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_assign_expression_replace(GAssignExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_assign_expression_print(const GAssignExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour une assignation quelconque. */
-G_DEFINE_TYPE(GAssignExpression, g_assign_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des assignations quelconques. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_assign_expression_class_init(GAssignExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'assignation quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_assign_expression_init(GAssignExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_assign_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_assign_expression_replace;
- instr->print = (dec_instr_print_fc)g_assign_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : dest = expression servant de destination. *
-* src = source de l'expression à transférer. *
-* *
-* Description : Assigne le contenu d'une expression dans une autre. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_assign_expression_new(GDecExpression *dest, GDecExpression *src)
-{
- GAssignExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_ASSIGN_EXPRESSION, NULL);
-
- result->dest = dest;
- result->src = src;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_assign_expression_visit(GAssignExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->dest), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- if (result)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->src), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_assign_expression_replace(GAssignExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->dest == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->dest));
- g_object_ref(G_OBJECT(new));
- expr->dest = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->dest), old, new);
-
- if (expr->src == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->src));
- g_object_ref(G_OBJECT(new));
- expr->src = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->src), old, new);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_assign_expression_print(const GAssignExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->dest),
- buffer, line, output);
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, " = ", 3, RTT_SIGNS, NULL);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->src),
- buffer, result, output);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : assign = expression à consulter. *
-* *
-* Description : Indique la destination d'une assignation. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_assign_expression_get_dest(const GAssignExpression *assign)
-{
- return assign->dest;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : assign = expression à consulter. *
-* *
-* Description : Indique la source d'une assignation. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_assign_expression_get_src(const GAssignExpression *assign)
-{
- return assign->src;
-
-}