@@ -12,6 +12,7 @@ use cambridge_asm::{
12
12
} ;
13
13
use clap:: { ArgEnum , Parser , Subcommand } ;
14
14
use std:: ffi:: OsString ;
15
+ use cambridge_asm:: exec:: Io ;
15
16
16
17
#[ cfg( feature = "cambridge" ) ]
17
18
const INST_SET : InstSet = parse:: get_fn;
@@ -99,6 +100,8 @@ fn main() -> std::io::Result<()> {
99
100
#[ cfg( not( debug_assertions) ) ]
100
101
std:: panic:: set_hook ( Box :: new ( handle_panic) ) ;
101
102
103
+ let io = Io :: default ( ) ;
104
+
102
105
match cli. commands {
103
106
Commands :: Run {
104
107
path,
@@ -109,27 +112,27 @@ fn main() -> std::io::Result<()> {
109
112
use InFormats :: * ;
110
113
111
114
let parser: Box < dyn FnOnce ( Vec < u8 > , InstSet ) -> Executor > = match format {
112
- Pasm => Box :: new ( |v, set| parse:: parse ( String :: from_utf8_lossy ( & v) , set) ) ,
115
+ Pasm => Box :: new ( |v, set| parse:: parse ( String :: from_utf8_lossy ( & v) , set, io ) ) ,
113
116
Json => Box :: new ( |v, set| {
114
117
serde_json:: from_str :: < CompiledProg > ( & String :: from_utf8_lossy ( & v) )
115
118
. unwrap ( )
116
- . to_executor ( set)
119
+ . to_executor ( set, io )
117
120
} ) ,
118
121
Ron => Box :: new ( |v, set| {
119
122
ron:: from_str :: < CompiledProg > ( & String :: from_utf8_lossy ( & v) )
120
123
. unwrap ( )
121
- . to_executor ( set)
124
+ . to_executor ( set, io )
122
125
} ) ,
123
126
Yaml => Box :: new ( |v, set| {
124
127
serde_yaml:: from_str :: < CompiledProg > ( & String :: from_utf8_lossy ( & v) )
125
128
. unwrap ( )
126
- . to_executor ( set)
129
+ . to_executor ( set, io )
127
130
} ) ,
128
131
Bin => Box :: new ( |v, set| {
129
132
bincode:: decode_from_slice :: < CompiledProg , _ > ( & v, bincode:: config:: standard ( ) )
130
133
. unwrap ( )
131
134
. 0
132
- . to_executor ( set)
135
+ . to_executor ( set, io )
133
136
} ) ,
134
137
} ;
135
138
0 commit comments