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
extern crate lazy_static;
extern crate bitflags;
extern crate byteorder;
use std::collections::HashMap;
mod common;
pub mod arch;
mod directive;
pub use common::{Const, Expr, Ident, Number, NumericRepr, JumpOffset, Size, Stmt, Value};
pub use directive::{Directive, MalformedDirectiveError};
struct Dynasm {
target: Box<dyn arch::Arch>,
stmts: Vec<common::Stmt>
}
struct DynasmOpmap {
pub arch: String
}
pub struct State<'a> {
pub stmts: &'a mut Vec<common::Stmt>,
pub target: &'a str,
pub file_data: &'a mut DynasmData,
}
pub struct DynasmData {
pub current_arch: Box<dyn arch::Arch>,
pub aliases: HashMap<String, String>,
}
impl DynasmData {
pub fn new() -> DynasmData {
DynasmData {
current_arch:
arch::from_str(arch::CURRENT_ARCH).expect("Default architecture is invalid"),
aliases: HashMap::new(),
}
}
}