Debian Codegraph @

src/fcml_mnemonic_parser.h

raw
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_MNEMONIC_PARSER_H_
21 #define FCML_MNEMONIC_PARSER_H_
22
23 #include "fcml_env_int.h"
24 #include "fcml_ceh.h"
25 #include "fcml_coll.h"
26
27 typedef struct fcml_st_mp_mnemonic {
28 fcml_string mnemonic;
29 fcml_bool is_shortcut;
30 fcml_bool is_classic;
31 fcml_bool is_mode_mem_only;
32 fcml_bool is_mode_reg_only;
33 fcml_usize is_byte_ds;
34 fcml_usize is_full_ds;
35 fcml_usize supported_osa;
36 fcml_usize supported_asa;
37 fcml_nuint8_t suffix;
38 fcml_nuint8_t pseudo_op;
39 fcml_nuint8_t memory_data;
40 fcml_bool is_default;
41 fcml_nuint8_t l;
42 fcml_uint32_t flags;
43 } fcml_st_mp_mnemonic;
44
45 typedef struct fcml_st_mp_mnemonic_set {
46 fcml_st_coll_list *mnemonics;
47 } fcml_st_mp_mnemonic_set;
48
49 typedef struct fcml_st_mp_config {
50 fcml_bool use_shortcut;
51 fcml_nuint8_t pseudo_opcode;
52 fcml_nuint8_t suffix;
53 fcml_usize effective_osa;
54 fcml_usize effective_asa;
55 fcml_bool is_memory;
56 fcml_usize memory_data_size;
57 fcml_nuint8_t l;
58 } fcml_st_mp_config;
59
60 fcml_ceh_error fcml_fn_mp_parse_mnemonics(fcml_string mnemonics_pattern,
61 fcml_st_mp_mnemonic_set **mnemonics);
62
63 void fcml_fn_mp_free_mnemonics(fcml_st_mp_mnemonic_set *mnemonics);
64
65 fcml_st_mp_mnemonic *fcml_fn_mp_choose_mnemonic(
66 fcml_st_mp_mnemonic_set *mnemonics, fcml_st_mp_config *config);
67
68 fcml_usize fcml_fn_mp_l_to_vector_length(fcml_uint8_t l);
69
70 #endif /* FCML_MNEMONIC_PARSER_H_ */