summaryrefslogtreecommitdiff
path: root/src/decomp/output.h
blob: bd614ff019b93edf65a89e42705e8ab14219ebcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

/* Chrysalide - Outil d'analyse de fichiers binaires
 * output.h - prototypes pour les sorties en langage de programmation
 *
 * Copyright (C) 2010-2013 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  OpenIDA 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.
 *
 *  OpenIDA 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 <http://www.gnu.org/licenses/>.
 */


#ifndef _DECOMP_OUTPUT_H
#define _DECOMP_OUTPUT_H


#include "../glibext/gcodebuffer.h"



#define G_TYPE_LANG_OUTPUT               g_lang_output_get_type()
#define G_LANG_OUTPUT(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_lang_output_get_type(), GLangOutput))
#define G_IS_LANG_OUTPUT(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_lang_output_get_type()))
#define G_LANG_OUTPUT_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_LANG_OUTPUT, GLangOutputClass))
#define G_IS_LANG_OUTPUT_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_LANG_OUTPUT))
#define G_LANG_OUTPUT_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_LANG_OUTPUT, GLangOutputClass))


/* Sortie selon un langage de programmation (instance) */
typedef struct _GLangOutput GLangOutput;

/* Sortie selon un langage de programmation (classe) */
typedef struct _GLangOutputClass GLangOutputClass;


/* Indique le type défini pour une sortie de langage de programmation. */
GType g_lang_output_get_type(void);

/* Marque le début d'une série de commentaires. */
GBufferLine *g_lang_output_start_comments(GLangOutput *, GCodeBuffer *);

/* Poursuit l'ajout d'une ligne de commentaires. */
GBufferLine *g_lang_output_continue_comments(GLangOutput *, GCodeBuffer *, const char *, size_t);

/* Marque la fin d'une série de commentaires. */
GBufferLine *g_lang_output_end_comments(GLangOutput *, GCodeBuffer *);

/* Ajoute un commentaire à un tampon donné. */
GBufferLine *g_lang_output_write_comments(GLangOutput *, GCodeBuffer *, const char *, size_t);


/* Liste des signes binaires de comparaison */
typedef enum _CompSignType
{
    CST_EQ,                                 /* ==                          */
    CST_NE,                                 /* !=                          */
    CST_LT,                                 /* <                           */
    CST_GE,                                 /* >=                          */
    CST_GT,                                 /* >                           */
    CST_LE,                                 /* <=                          */

    CST_COUNT

} CompSignType;

/* Liste des signes binaires de comparaison */
typedef enum _CondOperatorType
{
    COT_NONE,                               /* pas de condition            */
    COT_AND,                                /* &&                          */
    COT_OR,                                 /* ||                          */

    COT_COUNT

} CondOperatorType;


/* Imprime dans un tampon donné une méthode de comparaison. */
void g_lang_output_write_comp_sign(GLangOutput *, GBufferLine *, CompSignType);

/* Imprime dans un tampon donné un opérateur logique. */
void g_lang_output_write_cond_operator(GLangOutput *, GBufferLine *, CondOperatorType);


/* Débute la définition d'une classe. */
GBufferLine *g_lang_output_start_class(GLangOutput *, GCodeBuffer *, const void *);

/* Termine la définition d'une classe. */
void g_lang_output_end_class(GLangOutput *, GCodeBuffer *);

/* Débute la documentation d'une routine. */
GBufferLine *g_lang_output_start_routine_info(const GLangOutput *, GCodeBuffer *);

/* Définit le prototype d'une routine. */
GBufferLine *g_lang_output_start_routine_prototype(GLangOutput *, GCodeBuffer *, const void *);

/* Marque la fin du prototype d'une routine. */
void g_lang_output_end_routine_prototype(GLangOutput *, GCodeBuffer *, GBufferLine *);

/* Commence la définition du corps d'une routine. */
void g_lang_output_start_routine_body(GLangOutput *, GCodeBuffer *, GBufferLine *);

/* Termine la définition du corps d'une routine. */
void g_lang_output_end_routine_body(GLangOutput *, GCodeBuffer *);

/* Commence la définition d'un bloc de code. */
GBufferLine *g_lang_output_start_code_block(GLangOutput *, GCodeBuffer *, GBufferLine *, size_t);

/* Termine la définition d'un bloc de code. */
GBufferLine *g_lang_output_end_code_block(GLangOutput *, GCodeBuffer *, GBufferLine *, size_t);

/* Emballe une expression conditionelle. */
GBufferLine *g_lang_output_encapsulate_condition(GLangOutput *, GCodeBuffer *, GBufferLine *, bool);



typedef unsigned int lang_t;

#include "lang/java.h"



#endif  /* _DECOMP_OUTPUT_H */