| 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 |
|
| 20 |
#ifndef FCML_REND_UTILS_H_ |
| 21 |
#define FCML_REND_UTILS_H_ |
| 22 |
|
| 23 |
#include <fcml_common.h> |
| 24 |
#include <fcml_types.h> |
| 25 |
|
| 26 |
#include "fcml_ceh.h" |
| 27 |
#include "fcml_dialect_int.h" |
| 28 |
#include "fcml_stream.h" |
| 29 |
|
| 30 |
void fcml_fn_rend_utils_format_printf(struct fcml_st_memory_stream *stream, |
| 31 |
const fcml_string format, ...); |
| 32 |
|
| 33 |
void fcml_fn_rend_utils_format_append_hex_byte(fcml_st_memory_stream *stream, |
| 34 |
fcml_uint8_t hex_byte); |
| 35 |
|
| 36 |
void fcml_fn_rend_utils_format_append_code(const fcml_st_render_config *config, |
| 37 |
fcml_st_memory_stream *stream, const fcml_uint8_t *instrunction_code, |
| 38 |
fcml_usize instruction_code_size); |
| 39 |
|
| 40 |
fcml_int fcml_fn_rend_utils_format_append_str_if(fcml_st_memory_stream *stream, |
| 41 |
const fcml_string string, fcml_bool condition); |
| 42 |
|
| 43 |
void fcml_fn_rend_utils_format_finish_str(fcml_st_memory_stream *stream); |
| 44 |
|
| 45 |
fcml_int fcml_fn_rend_utils_format_repeat_char(fcml_st_memory_stream *stream, |
| 46 |
fcml_char character, fcml_int repeats); |
| 47 |
|
| 48 |
fcml_int fcml_fn_rend_utils_format_append_str(fcml_st_memory_stream *stream, |
| 49 |
const fcml_string source); |
| 50 |
|
| 51 |
fcml_int fcml_fn_rend_utils_format_append_str_padding( |
| 52 |
fcml_st_memory_stream *stream, const fcml_string source, |
| 53 |
fcml_int16_t padding); |
| 54 |
|
| 55 |
void fcml_fn_rend_utils_format_append_stream( |
| 56 |
fcml_st_memory_stream *destination_stream, |
| 57 |
const fcml_st_memory_stream *source_stream); |
| 58 |
|
| 59 |
fcml_ceh_error fcml_fn_rend_utils_format_append_integer( |
| 60 |
fcml_string patterns[6][4], fcml_st_memory_stream *stream, |
| 61 |
const fcml_st_integer *integer, fcml_bool is_hex, |
| 62 |
fcml_bool remove_leading_zeros); |
| 63 |
|
| 64 |
void fcml_fn_rend_utils_format_append_reg( |
| 65 |
const fcml_st_dialect_context_int *dialect_context, |
| 66 |
fcml_st_memory_stream *stream, const fcml_st_register *reg, |
| 67 |
fcml_bool is_rex); |
| 68 |
|
| 69 |
fcml_int fcml_fn_rend_utils_padding(fcml_st_memory_stream *output_stream, |
| 70 |
fcml_int len, fcml_int padding, fcml_int default_padding); |
| 71 |
|
| 72 |
fcml_int fcml_ifn_rend_utils_print_prefixes( |
| 73 |
fcml_st_memory_stream *output_stream, |
| 74 |
const fcml_st_prefixes_details *prefixes, fcml_uint32_t flags); |
| 75 |
|
| 76 |
fcml_bool fcml_fn_rend_utils_render_operand_separator( |
| 77 |
const fcml_st_render_config *config, |
| 78 |
fcml_st_memory_stream *output_stream, fcml_int padding_length, |
| 79 |
fcml_bool first_operand); |
| 80 |
|
| 81 |
void fcml_fn_rend_utils_format_append_printf(fcml_st_memory_stream *stream, |
| 82 |
fcml_string format, ...); |
| 83 |
|
| 84 |
void fcml_fn_rend_utils_format_append_operand_decorators( |
| 85 |
const fcml_st_dialect_context_int *dialect_context, |
| 86 |
fcml_st_memory_stream *output_stream, |
| 87 |
const fcml_st_operand_decorators *decorators); |
| 88 |
|
| 89 |
#endif /* FCML_REND_UTILS_H_ */ |