MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / cmd_run

Function cmd_run

src/cli/main.rs:337–364  ·  view source on GitHub ↗
(args: &Args)

Source from the content-addressed store, hash-verified

335 let asm_text = pipeline.compile_ir_to_assembly(&result.ir_program);
336 write_or_print(args.output.as_deref(), &asm_text)?;
337 }
338
339 Ok(ExitCode::SUCCESS)
340}
341
342// --- run ---
343
344fn cmd_run(args: &Args) -> Result<ExitCode, CliError> {
345 let input = require_single_input(args)?;
346
347 let assembled = if has_extension(input, "s") {
348 eprintln!(
349 "fsc: note: loading `.s` as assembly text; \
350 instructions not in the built-in parser may be silently skipped"
351 );
352 assemble_from_s_file(input, args.mode)?
353 } else {
354 return run_cli_config(input, args.mode, args.max_steps);
355 };
356
357 let mut vm = VirtualMachine::new(&assembled);
358 let result = vm.run(args.max_steps);
359
360 print!("{}", result.uart_output);
361
362 match result.outcome {
363 StepOutcome::Halted(code) => {
364 eprintln!("fsc: program exited with code {code}");
365 Ok(ExitCode::from((code & 0xFF) as u8))
366 }
367 StepOutcome::Continue => Err(CliError::Timeout(args.max_steps)),

Callers 1

run_cliFunction · 0.85

Calls 6

require_single_inputFunction · 0.85
has_extensionFunction · 0.85
assemble_from_s_fileFunction · 0.85
assemble_from_hll_fileFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected