/* Chrysalide - Outil d'analyse de fichiers binaires * coder.h - prototypes pour la lecture automatisée des spécifications d'architecture * * Copyright (C) 2014 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 Foobar. If not, see . */ #ifndef _TOOLS_D2C_CODER_H #define _TOOLS_D2C_CODER_H #include #include "pproc.h" #include "spec.h" /* Suivi des constructions */ typedef struct _rented_coder rented_coder; /* -------------------------- CONSTRUCTION SELON COMMANDES -------------------------- */ /* Type d'entrée/sortie attendues */ typedef enum _InputOutputType { IOT_UNDEFINED, /* Type non défini */ IOT_RAW, /* Lecture de contenu brut */ IOT_FORMAT /* Définition d'opérandes */ } InputOutputType; /* Débute la définition d'une fonction de désassemblage. */ rented_coder *create_coder(void); /* Supprime le codeur de la mémoire. */ void delete_coder(rented_coder *); /* Détermine si les propriétés de base d'un codeur sont là. */ bool do_basic_checks_with_coder(const rented_coder *); /* Indique le fichier de définition considéré en entrée. */ const char *get_coder_input_file(const rented_coder *); /* Spécifie le fichier de définition à prendre en entrée. */ void set_coder_input_file(rented_coder *, const char *); /* Spécifie le type de format à prendre en compte (E/S). */ void set_coder_input_type(rented_coder *, InputOutputType); /* Spécifie le répertoire de base pour les sorties de code. */ void set_coder_output_directory(rented_coder *, const char *); /* Détermine l'architecture visée par les traitements. */ void set_coder_arch(rented_coder *, const char *); /* Définit la base des protections des fichiers d'en-tête. */ void set_coder_header_base(rented_coder *, const char *); /* Définit le préfixe pour les opérandes chargées par format. */ void set_coder_const_prefix(rented_coder *, const char *); /* Fournit le pré-processeur du compilateur. */ pre_processor *get_coder_pre_proc(const rented_coder *); /* Enregistre les contours d'une instruction d'assemblage. */ void save_notes_for_coder(rented_coder *, char *, char *, char, const char *); /* --------------------------- REPRESENTATION D'ENCODAGES --------------------------- */ /* Fournit un lien vers les spécifications courantes. */ encoding_spec *get_current_encoding_spec(const rented_coder *); /* Enregistre une définition supplémentaire. */ void push_encoding_spec(rented_coder *, char *, unsigned int); /* --------------------------- GESTION DES CHAMPS DE BITS --------------------------- */ /* Note la présence d'un champ remarquable dans une définition. */ void register_named_field_in_coder(rented_coder *, char *, unsigned int); /* Note la présence d'un bit invariable dans une définition. */ void register_bit_in_coder(rented_coder *, int); /* Indique le nombre de bits traités. */ //unsigned int count_coder_bits(const rented_coder *); /* ---------------------------- SYNTAXE DES INSTRUCTIONS ---------------------------- */ /* Enregistre la présence d'un nouvel opérande. */ void register_syntax_item_in_coder(rented_coder *, char *, bool); /* ---------------------------- CONVERSION DES ARGUMENTS ---------------------------- */ /* Enregistre la function de conversion du brut à l'utile. */ void register_conversion_in_coder(rented_coder *, conv_func *); /* --------------------------- CONDITIONS ET CONSEQUENCES --------------------------- */ /* --------------------------- GENERATIONS DE CODE SOURCE --------------------------- */ /* Débute la définition des fonctions issues des spécifications. */ bool dump_all_routines_using_coder(const rented_coder *); #endif /* _TOOLS_D2C_CODER_H */