fcml  1.2.2
fcml_renderer.h
Go to the documentation of this file.
1 /*
2  * FCML - Free Code Manipulation Library.
3  * Copyright (C) 2010-2020 Slawomir Wojtasiak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
27 #ifndef FCML_REND_H_
28 #define FCML_REND_H_
29 
30 #include "fcml_lib_export.h"
31 
32 #include "fcml_types.h"
33 #include "fcml_errors.h"
34 #include "fcml_dialect.h"
35 #include "fcml_disassembler.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
42 #define FCML_REND_MAX_BUFF_LEN 512
43 
50 #define FCML_REND_FLAG_RENDER_CODE 0x00000001
51 
52 #define FCML_REND_FLAG_HEX_IMM 0x00000002
53 
54 #define FCML_REND_FLAG_RENDER_DEFAULT_SEG 0x00000004
55 
56 #define FCML_REND_FLAG_HEX_DISPLACEMENT 0x00000008
57 
58 #define FCML_REND_FLAG_COND_GROUP_1 0x00000010
59 
60 #define FCML_REND_FLAG_COND_GROUP_2 0x00000020
61 
62 #define FCML_REND_FLAG_COND_SHOW_CARRY 0x00000040
63 
64 #define FCML_REND_FLAG_RENDER_SIB_HINT 0x00000080
65 
66 #define FCML_REND_FLAG_RENDER_ABS_HINT 0x00000100
67 
68 #define FCML_REND_FLAG_RENDER_REL_HINT 0x00000200
69 
70 #define FCML_REND_FLAG_RENDER_INDIRECT_HINT 0x00000400
71 
72 #define FCML_REND_FLAG_REP_PREFIX_GROUP_1 0x00000800
73 
74 #define FCML_REND_FLAG_REP_PREFIX_GROUP_2 0x00001000
75 
76 #define FCML_REND_FLAG_CODE_PADDING 0x00002000
77 
78 #define FCML_REND_FLAG_MNEMONIC_PADDING 0x00004000
79 
81 #define FCML_REND_FLAG_REMOVE_LEADING_ZEROS 0x00008000
82 
84 #define FCML_REND_DEFAULT_FLAGS 0
85 
86 #define FCML_REND_DEFAULT_CODE_PADDING 8
87 
88 #define FCML_REND_DEFAULT_MNEMONIC_PADDING 8
89 
93 typedef struct fcml_st_render_config {
95  fcml_uint32_t render_flags;
99  fcml_uint16_t prefered_code_padding;
101 
115 LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_render(
116  const fcml_st_dialect *dialect, const fcml_st_render_config *config,
117  fcml_char *buffer, fcml_usize buffer_len,
118  const fcml_st_disassembler_result *result);
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif /* FCML_REND_H_ */
struct fcml_st_dialect fcml_st_dialect
Assembler dialect.
Definition: fcml_dialect.h:36
fcml_uint16_t prefered_code_padding
Preferred code padding in HEX bytes (2 characters on one byte.).
Definition: fcml_renderer.h:99
Handles Win32 DLL symbols importing/exporting.
Structures and functions declarations related to FCML disassembler.
Renderer configuration.
Definition: fcml_renderer.h:93
struct fcml_st_render_config fcml_st_render_config
Renderer configuration.
Reusable disassembler result holder.
Definition: fcml_disassembler.h:267
fcml_uint16_t prefered_mnemonic_padding
Preferred mnemonic padding in characters.
Definition: fcml_renderer.h:97
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_render(const fcml_st_dialect *dialect, const fcml_st_render_config *config, fcml_char *buffer, fcml_usize buffer_len, const fcml_st_disassembler_result *result)
Renders the disassembled instruction into its textual representation.
fcml_uint32_t render_flags
Flags which allows to control rendering process.
Definition: fcml_renderer.h:95
Structures and functions related to dialects.
Global error handling related declarations.
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition: fcml_errors.h:156
Types declarations.