@@ -27,3 +27,61 @@ macro_rules! syscall1 {
27
27
$crate:: syscall1( $crate:: nr:: $nr, $a1 as usize )
28
28
} ;
29
29
}
30
+
31
+ /// Macro for printing to the HOST standard output
32
+ ///
33
+ /// This macro returns a `Result<(), ()>` value
34
+ #[ macro_export]
35
+ macro_rules! hprint {
36
+ ( $s: expr) => {
37
+ $crate:: export:: hstdout_str( $s)
38
+ } ;
39
+ ( $( $tt: tt) * ) => {
40
+ $crate:: export:: hstdout_fmt( format_args!( $( $tt) * ) )
41
+ } ;
42
+ }
43
+
44
+ /// Macro for printing to the HOST standard output, with a newline.
45
+ ///
46
+ /// This macro returns a `Result<(), ()>` value
47
+ #[ macro_export]
48
+ macro_rules! hprintln {
49
+ ( ) => {
50
+ $crate:: export:: hstdout_str( "\n " )
51
+ } ;
52
+ ( $s: expr) => {
53
+ $crate:: export:: hstdout_str( concat!( $s, "\n " ) )
54
+ } ;
55
+ ( $s: expr, $( $tt: tt) * ) => {
56
+ $crate:: export:: hstdout_fmt( format_args!( concat!( $s, "\n " ) , $( $tt) * ) )
57
+ } ;
58
+ }
59
+
60
+ /// Macro for printing to the HOST standard error
61
+ ///
62
+ /// This macro returns a `Result<(), ()>` value
63
+ #[ macro_export]
64
+ macro_rules! heprint {
65
+ ( $s: expr) => {
66
+ $crate:: export:: hstderr_str( $s)
67
+ } ;
68
+ ( $( $tt: tt) * ) => {
69
+ $crate:: export:: hstderr_fmt( format_args!( $( $tt) * ) )
70
+ } ;
71
+ }
72
+
73
+ /// Macro for printing to the HOST standard error, with a newline.
74
+ ///
75
+ /// This macro returns a `Result<(), ()>` value
76
+ #[ macro_export]
77
+ macro_rules! heprintln {
78
+ ( ) => {
79
+ $crate:: export:: hstderr_str( "\n " )
80
+ } ;
81
+ ( $s: expr) => {
82
+ $crate:: export:: hstderr_str( concat!( $s, "\n " ) )
83
+ } ;
84
+ ( $s: expr, $( $tt: tt) * ) => {
85
+ $crate:: export:: hstderr_fmt( format_args!( concat!( $s, "\n " ) , $( $tt) * ) )
86
+ } ;
87
+ }
0 commit comments