Skip to content

fix: instruction fault

fermata requested to merge dev into main

Convert user_lib print functions to proper macros:

  • Add Stdout struct implementing core::fmt::Write
  • Implement print! and println! macros with format_args! support
  • Update all user programs to use macro syntax (println! instead of println)
  • Add macro_test.rs to demonstrate formatting capabilities

Features:

  • Full format string support: println!("x={}, y={}", x, y)
  • Hex formatting: println!("0x{:x}", value)
  • Expression evaluation: println!("result: {}", 5 * 6)
  • Compatible with standard Rust formatting

All user programs updated:

  • 00poweroff.rs, 01hello.rs: Basic string output
  • power_3/5/7.rs, test_simple.rs: Number formatting with {}
  • macro_test.rs: Comprehensive formatting examples

Merge request reports