summaryrefslogtreecommitdiff
path: root/src/decomp/expr
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-11-12 22:13:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-11-12 22:13:21 (GMT)
commitae8cf6257c8d929de1b7ee86e29fcb45ab4af91c (patch)
tree59fa356b2f83020e23df4cf6975ca5d97567df4d /src/decomp/expr
parentabaf85fdc0edb2bfe67d07d52ae734d50c6fbf61 (diff)
Changed the display of the pseudo registers by using an index.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@192 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/decomp/expr')
-rw-r--r--src/decomp/expr/pseudo.c30
-rw-r--r--src/decomp/expr/pseudo.h3
2 files changed, 32 insertions, 1 deletions
diff --git a/src/decomp/expr/pseudo.c b/src/decomp/expr/pseudo.c
index 393f32c..abfcd4d 100644
--- a/src/decomp/expr/pseudo.c
+++ b/src/decomp/expr/pseudo.c
@@ -24,6 +24,10 @@
#include "pseudo.h"
+#include <stdio.h>
+#include <string.h>
+
+
#include "../expression-int.h"
@@ -33,6 +37,8 @@ struct _GPseudoRegister
{
GDecExpression parent; /* A laisser en premier */
+ size_t index; /* Position dans l'ensemble */
+
};
@@ -141,8 +147,30 @@ GDecInstruction *g_pseudo_register_new(void)
static void g_pseudo_register_print(const GPseudoRegister *reg, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
{
+ char label[32];
+
+ snprintf(label, 32, "var%d", reg->index);
+
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY, label, strlen(label), RTT_RAW);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY, "varX", 4, RTT_RAW);
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = expression représentant un pseudo-registre à traiter.*
+* index = indice à associer au pseudo-registre. *
+* *
+* Description : Définit un indice unique pour un pseudo-registre donné. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+void g_pseudo_register_set_index(GPseudoRegister *reg, size_t index)
+{
+ reg->index = index;
}
diff --git a/src/decomp/expr/pseudo.h b/src/decomp/expr/pseudo.h
index 9734625..95612a9 100644
--- a/src/decomp/expr/pseudo.h
+++ b/src/decomp/expr/pseudo.h
@@ -54,6 +54,9 @@ GType g_pseudo_register_get_type(void);
/* Assigne le contenu d'une expression dans une autre. */
GDecInstruction *g_pseudo_register_new(void);
+/* Définit un indice unique pour un pseudo-registre donné. */
+void g_pseudo_register_set_index(GPseudoRegister *, size_t);
+
#endif /* _DECOMP_EXPR_PSEUDO_H */