diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-11-05 19:45:08 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-11-05 19:45:08 (GMT) |
commit | c35d5d4ce62b812ec0aa4a5ebbacb84cd0901d53 (patch) | |
tree | ca0262ce4f0a24bdfbc1b9a4ffa1bbb202d47820 /src/arch/instruction.c | |
parent | f5df6496fa50927d3d274c939a888afde652b7ad (diff) |
Removed the old interface for rendering lines.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@278 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r-- | src/arch/instruction.c | 170 |
1 files changed, 1 insertions, 169 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 240ffbe..b553aec 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -38,12 +38,6 @@ static void g_arch_instruction_class_init(GArchInstructionClass *); /* Initialise une instance d'opérande d'architecture. */ static void g_arch_instruction_init(GArchInstruction *); -/* Ajoute du texte simple à un fichier ouvert en écriture. */ -static void g_arch_instruction_add_text(const GArchInstruction *, GRenderingOptions *, MainRendering, FILE *) __attribute__ ((deprecated)); - -/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */ -static void g_arch_instruction_to_buffer(const GArchInstruction *, GBufferLine *, GRenderingOptions *) __attribute__ ((deprecated)); - /* --------------------- CONVERSIONS DU FORMAT DES INSTRUCTIONS --------------------- */ @@ -55,7 +49,7 @@ static void _g_arch_instruction_print(const GArchInstruction *, GCodeBuffer *, M /* Indique le type défini pour une instruction d'architecture. */ -G_DEFINE_TYPE(GArchInstruction, g_arch_instruction, G_TYPE_CONTENT_EXPORTER); +G_DEFINE_TYPE(GArchInstruction, g_arch_instruction, G_TYPE_OBJECT); /****************************************************************************** @@ -90,13 +84,6 @@ static void g_arch_instruction_class_init(GArchInstructionClass *klass) static void g_arch_instruction_init(GArchInstruction *instr) { - GContentExporter *parent; /* Instance parente */ - - parent = G_CONTENT_EXPORTER(instr); - - parent->add_text = (add_text_fc)g_arch_instruction_add_text; - parent->export_buffer = (export_buffer_fc)g_arch_instruction_to_buffer; - DL_LIST_ITEM_INIT(&instr->flow); } @@ -104,114 +91,6 @@ static void g_arch_instruction_init(GArchInstruction *instr) /****************************************************************************** * * -* Paramètres : instr = instruction à transcrire. * -* options = options de rendu. * -* rendering = support effectif final des lignes de code. * -* stream = flux ouvert en écriture. * -* * -* Description : Ajoute du texte simple à un fichier ouvert en écriture. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_arch_instruction_add_text(const GArchInstruction *instr, GRenderingOptions *options, MainRendering rendering, FILE *stream) -{ - GContentExporter *exporter; /* Autre vision de l'objet */ - const char *key; /* Mot clef principal */ - size_t klen; /* Taille de ce mot clef */ - size_t i; /* Boucle de parcours */ - - exporter = G_CONTENT_EXPORTER(instr); - - key = instr->get_text(instr, - g_rendering_options_get_format(options), - g_rendering_options_get_syntax(options)); - klen = strlen(key); - - g_content_exporter_insert_text(exporter, stream, key, klen, RTT_INSTRUCTION); - - if (instr->operands_count > 0) - { - g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE); - - g_content_exporter_add_text(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[0]), - options, rendering, stream); - - for (i = 1; i < instr->operands_count; i++) - { - g_content_exporter_insert_text(exporter, stream, ",", 1, RTT_NONE/* FIXME */); - - g_content_exporter_insert_text(exporter, stream, " ", 1, RTT_NONE); - - g_content_exporter_add_text(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[i]), - options, rendering, stream); - - } - - } - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction d'assemblage à représenter. * -* buffer = espace où placer ledit contenu. * -* options = options de rendu. * -* * -* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_arch_instruction_to_buffer(const GArchInstruction *instr, GBufferLine *buffer, GRenderingOptions *options) -{ - GContentExporter *exporter; /* Autre vision de l'objet */ - const char *key; /* Mot clef principal */ - size_t klen; /* Taille de ce mot clef */ - size_t i; /* Boucle de parcours */ - - exporter = G_CONTENT_EXPORTER(instr); - - key = instr->get_text(instr, - g_rendering_options_get_format(options), - g_rendering_options_get_syntax(options)); - klen = strlen(key); - - g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY_HEAD, - key, klen, RTT_INSTRUCTION); - - if (instr->operands_count > 0) - { - g_content_exporter_to_buffer(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[0]), - buffer, options); - - for (i = 1; i < instr->operands_count; i++) - { - g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY, - ",", 1, RTT_NONE/* FIXME */); - - g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY, - " ", 1, RTT_NONE); - - g_content_exporter_to_buffer(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[i]), - buffer, options); - - } - - } - -} - - -/****************************************************************************** -* * * Paramètres : instr = instruction quelconque à modifier. * * offset = position physique dans le code binaire. * * length = taille de l'instruction. * @@ -385,53 +264,6 @@ void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *op } -/****************************************************************************** -* * -* Paramètres : instr = instruction à traiter. * -* format = format du binaire manipulé. * -* syntax = type de représentation demandée. * -* * -* Description : Traduit une instruction en version humainement lisible. * -* * -* Retour : Chaîne de caractères à libérer de la mémoire. * -* * -* Remarques : - * -* * -******************************************************************************/ - -char *g_arch_instruction_get_text(const GArchInstruction *instr, const GExeFormat *format, AsmSyntax syntax) -{ - char *result; /* Chaîne à retourner */ - size_t i; /* Boucle de parcours */ - char *opstr; /* Chaîne d'opérande */ - return strdup(""); - if (instr->operands_count == 0) - result = strdup(instr->get_text(instr, format, syntax)); - - else - { - result = g_arch_operand_get_text(G_ARCH_INSTRUCTION(instr)->operands[0], format, syntax); - - for (i = 1; i < instr->operands_count; i++) - { - result = stradd(result, ", "); - - opstr = g_arch_operand_get_text(G_ARCH_INSTRUCTION(instr)->operands[i], format, syntax); - result = stradd(result, opstr); - free(opstr); - - } - - result = strprep(result, "\t"); - result = strprep(result, instr->get_text(instr, format, syntax)); - - } - - return result; - -} - - /* ---------------------------------------------------------------------------------- */ /* DEFINITION DES LIAISONS ENTRE INSTRUCTIONS */ |