summaryrefslogtreecommitdiff
path: root/src/arch/operand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/operand.c')
-rw-r--r--src/arch/operand.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/arch/operand.c b/src/arch/operand.c
index e98683e..667921a 100644
--- a/src/arch/operand.c
+++ b/src/arch/operand.c
@@ -24,6 +24,10 @@
#include "operand.h"
+#include <malloc.h>
+#include <string.h>
+
+
#include "operand-int.h"
@@ -107,6 +111,41 @@ bool g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b)
/******************************************************************************
* *
* Paramètres : operand = opérande à traiter. *
+* text = représentation lisible alternative. *
+* tag = style d'impression pour le remplacement. *
+* *
+* Description : Définit une autre représentation textuelle pour l'opérande. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_arch_operand_set_alt_text(GArchOperand *operand, const char *text, RenderingTagType tag)
+{
+ if (operand->alt_text != NULL)
+ free(operand->alt_text);
+
+ if (text != NULL)
+ {
+ operand->alt_text = strdup(text);
+ operand->alt_len = strlen(text);
+ operand->alt_tag = tag;
+ }
+ else
+ {
+ operand->alt_text = NULL;
+ operand->alt_len = 0;
+ operand->alt_tag = RTT_COUNT;
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
* line = ligne tampon où imprimer l'opérande donné. *
* syntax = type de représentation demandée. *
* *
@@ -120,6 +159,13 @@ bool g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b)
void g_arch_operand_print(const GArchOperand *operand, GBufferLine *line, AsmSyntax syntax)
{
- return operand->print(operand, line, syntax);
+ if (operand->alt_text != NULL)
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY,
+ operand->alt_text,
+ operand->alt_len,
+ operand->alt_tag);
+
+ else
+ operand->print(operand, line, syntax);
}