summaryrefslogtreecommitdiff
path: root/src/arch/operand.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-08-22 17:57:19 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-08-22 17:59:06 (GMT)
commitf94210f2617968774277078a8db9097c56029039 (patch)
treeb65eb802595a4496e931fe124010ad6f7b995272 /src/arch/operand.c
parent1e4bc888ff02d21b8fe4a45c70298624f35e758a (diff)
Defined paths to access to the instruction operands.
Diffstat (limited to 'src/arch/operand.c')
-rw-r--r--src/arch/operand.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/arch/operand.c b/src/arch/operand.c
index 237cc76..92fb1d6 100644
--- a/src/arch/operand.c
+++ b/src/arch/operand.c
@@ -193,6 +193,68 @@ int g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b)
/******************************************************************************
* *
+* Paramètres : operand = opérande à consulter. *
+* target = instruction à venir retrouver. *
+* *
+* Description : Détermine le chemin conduisant à un opérande interne. *
+* *
+* Retour : Chemin d'accès à l'opérande ou NULL en cas d'absence. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *g_arch_operand_find_inner_operand_path(const GArchOperand *operand, const GArchOperand *target)
+{
+ char *result; /* Chemin à retourner */
+ GArchOperandClass *class; /* Classe associée à l'objet */
+
+ class = G_ARCH_OPERAND_GET_CLASS(operand);
+
+ if (class->find_inner != NULL)
+ result = class->find_inner(operand, target);
+
+ else
+ result = NULL;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* path = chemin d'accès à un opérande à retrouver. *
+* *
+* Description : Obtient l'opérande correspondant à un chemin donné. *
+* *
+* Retour : Opérande trouvé ou NULL en cas d'échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_arch_operand_get_inner_operand_from_path(const GArchOperand *operand, const char *path)
+{
+ GArchOperand *result; /* Opérande trouvée à renvoyer */
+ GArchOperandClass *class; /* Classe associée à l'objet */
+
+ class = G_ARCH_OPERAND_GET_CLASS(operand);
+
+ if (class->get_inner != NULL)
+ result = class->get_inner(operand, path);
+
+ else
+ result = NULL;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = opérande à traiter. *
* line = ligne tampon où imprimer l'opérande donné. *
* *