summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-06-07 20:42:22 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-06-07 20:42:22 (GMT)
commitad1caf61fccd0d74be6ac92c41d83e9b0008ff2b (patch)
tree025d935a91ab84e43eb7a20e6192293ab2e87d55 /src
parentc87020ce7d1cd0a46f8122839c53ffa3e49fd172 (diff)
Reorganized the operands behaving like proxies.
Diffstat (limited to 'src')
-rw-r--r--src/arch/Makefile.am3
-rw-r--r--src/arch/operands/Makefile.am4
-rw-r--r--src/arch/operands/feeder-int.h (renamed from src/arch/feeder-int.h)6
-rw-r--r--src/arch/operands/feeder.c (renamed from src/arch/feeder.c)0
-rw-r--r--src/arch/operands/feeder.h (renamed from src/arch/feeder.h)12
-rw-r--r--src/arch/operands/proxy-int.h51
-rw-r--r--src/arch/operands/proxy.c (renamed from src/arch/proxy.c)44
-rw-r--r--src/arch/operands/proxy.h (renamed from src/arch/proxy.h)17
-rw-r--r--src/format/strsym.c2
9 files changed, 101 insertions, 38 deletions
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index af0c79a..a8f9fb0 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -5,8 +5,6 @@ libarch_la_SOURCES = \
archbase.h archbase.c \
context-int.h \
context.h context.c \
- feeder-int.h \
- feeder.h feeder.c \
instriter.h instriter.c \
instruction-int.h \
instruction.h instruction.c \
@@ -17,7 +15,6 @@ libarch_la_SOURCES = \
post.h post.c \
processor-int.h \
processor.h processor.c \
- proxy.h proxy.c \
register-int.h \
register.h register.c \
storage.h storage.c \
diff --git a/src/arch/operands/Makefile.am b/src/arch/operands/Makefile.am
index 4e52f58..74f057d 100644
--- a/src/arch/operands/Makefile.am
+++ b/src/arch/operands/Makefile.am
@@ -2,9 +2,13 @@
noinst_LTLIBRARIES = libarchoperands.la
libarchoperands_la_SOURCES = \
+ feeder-int.h \
+ feeder.h feeder.c \
immediate.h immediate.c \
register-int.h \
register.h register.c \
+ proxy-int.h \
+ proxy.h proxy.c \
rename-int.h \
rename.h rename.c \
targetable-int.h \
diff --git a/src/arch/feeder-int.h b/src/arch/operands/feeder-int.h
index 9312304..9a58dd5 100644
--- a/src/arch/feeder-int.h
+++ b/src/arch/operands/feeder-int.h
@@ -21,8 +21,8 @@
*/
-#ifndef _ARCH_FEEDER_INT_H
-#define _ARCH_FEEDER_INT_H
+#ifndef _ARCH_OPERANDS_FEEDER_INT_H
+#define _ARCH_OPERANDS_FEEDER_INT_H
#include "feeder.h"
@@ -63,4 +63,4 @@ typedef GProxyFeederIface GProxyFeederInterface;
-#endif /* _ARCH_FEEDER_INT_H */
+#endif /* _ARCH_OPERANDS_FEEDER_INT_H */
diff --git a/src/arch/feeder.c b/src/arch/operands/feeder.c
index 6d24efc..6d24efc 100644
--- a/src/arch/feeder.c
+++ b/src/arch/operands/feeder.c
diff --git a/src/arch/feeder.h b/src/arch/operands/feeder.h
index b01ebf0..7cea504 100644
--- a/src/arch/feeder.h
+++ b/src/arch/operands/feeder.h
@@ -21,17 +21,17 @@
*/
-#ifndef _ARCH_FEEDER_H
-#define _ARCH_FEEDER_H
+#ifndef _ARCH_OPERANDS_FEEDER_H
+#define _ARCH_OPERANDS_FEEDER_H
#include <glib-object.h>
#include <stdbool.h>
-#include "../common/packed.h"
-#include "../format/format.h"
-#include "../glibext/gbufferline.h"
+#include "../../common/packed.h"
+#include "../../format/format.h"
+#include "../../glibext/gbufferline.h"
@@ -67,4 +67,4 @@ bool g_proxy_feeder_serialize(const GProxyFeeder *, packed_buffer *);
-#endif /* _ARCH_FEEDER_H */
+#endif /* _ARCH_OPERANDS_FEEDER_H */
diff --git a/src/arch/operands/proxy-int.h b/src/arch/operands/proxy-int.h
new file mode 100644
index 0000000..c184986
--- /dev/null
+++ b/src/arch/operands/proxy-int.h
@@ -0,0 +1,51 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * proxy-int.h - définitions internes pour les opérandes renvoyant vers des éléments non architecturaux
+ *
+ * Copyright (C) 2020 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _ARCH_OPERANDS_PROXY_INT_H
+#define _ARCH_OPERANDS_PROXY_INT_H
+
+
+#include "proxy.h"
+#include "../operand-int.h"
+
+
+
+/* Définition d'un opérande renvoyant vers un élément (instance) */
+struct _GProxyOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ GProxyFeeder *feeder; /* Fournisseur de contenu */
+
+};
+
+/* Définition d'un opérande renvoyant vers un élément (classe) */
+struct _GProxyOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+
+#endif /* _ARCH_OPERANDS_PROXY_INT_H */
diff --git a/src/arch/proxy.c b/src/arch/operands/proxy.c
index 4548ef6..469e656 100644
--- a/src/arch/proxy.c
+++ b/src/arch/operands/proxy.c
@@ -24,30 +24,13 @@
#include "proxy.h"
-#include "operand-int.h"
+#include "proxy-int.h"
/* ------------------ OPERANDES CONSTITUANT DE PURS INTERMEDIAIRES ------------------ */
-/* Définition d'un opérande renvoyant vers un élément (instance) */
-struct _GProxyOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GProxyFeeder *feeder; /* Fournisseur de contenu */
-
-};
-
-/* Définition d'un opérande renvoyant vers un élément (classe) */
-struct _GProxyOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
/* Initialise la classe des opérandes renvoyant vers un élément. */
static void g_proxy_operand_class_init(GProxyOperandClass *);
@@ -249,6 +232,31 @@ static void g_proxy_operand_print(const GProxyOperand *operand, GBufferLine *lin
}
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Fournit le fournisseur représenté par l'opérande. *
+* *
+* Retour : Fournisseur associé à l'opérande. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GProxyFeeder *g_proxy_operand_get_feeder(const GProxyOperand *operand)
+{
+ GProxyFeeder *result; /* Instance à retourner */
+
+ result = operand->feeder;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
diff --git a/src/arch/proxy.h b/src/arch/operands/proxy.h
index 3e4cde6..16b07a8 100644
--- a/src/arch/proxy.h
+++ b/src/arch/operands/proxy.h
@@ -21,15 +21,15 @@
*/
-#ifndef _ARCH_PROXY_H
-#define _ARCH_PROXY_H
+#ifndef _ARCH_OPERANDS_PROXY_H
+#define _ARCH_OPERANDS_PROXY_H
#include <glib-object.h>
#include "feeder.h"
-#include "operand.h"
+#include "../operand.h"
@@ -37,11 +37,11 @@
#define G_TYPE_PROXY_OPERAND g_proxy_operand_get_type()
-#define G_PROXY_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PROXY_OPERAND, GDynOperand))
+#define G_PROXY_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PROXY_OPERAND, GProxyOperand))
#define G_IS_PROXY_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_PROXY_OPERAND))
-#define G_PROXY_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PROXY_OPERAND, GDynOperandClass))
+#define G_PROXY_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PROXY_OPERAND, GProxyOperandClass))
#define G_IS_PROXY_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PROXY_OPERAND))
-#define G_PROXY_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PROXY_OPERAND, GDynOperandClass))
+#define G_PROXY_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PROXY_OPERAND, GProxyOperandClass))
/* Définition d'un opérande renvoyant vers un élément (instance) */
@@ -57,6 +57,9 @@ GType g_proxy_operand_get_type(void);
/* Crée un opérande renvoyant vers un élément non architectural. */
GArchOperand *g_proxy_operand_new(GProxyFeeder *);
+/* Fournit le fournisseur représenté par l'opérande. */
+GProxyFeeder *g_proxy_operand_get_feeder(const GProxyOperand *);
-#endif /* _ARCH_PROXY_H */
+
+#endif /* _ARCH_OPERANDS_PROXY_H */
diff --git a/src/format/strsym.c b/src/format/strsym.c
index 97c62d9..5774a0c 100644
--- a/src/format/strsym.c
+++ b/src/format/strsym.c
@@ -31,7 +31,7 @@
#include "symbol-int.h"
-#include "../arch/feeder-int.h"
+#include "../arch/operands/feeder-int.h"
#include "../common/alloc.h"