@@ -16,31 +16,77 @@ mod native {
1616}
1717
1818/// Prints an unsigned 32-bit int.
19- pub fn print32 ( value : u32 ) {
19+ fn print32 ( value : u32 ) {
2020 unsafe { native:: debug_print32 ( value) }
2121}
2222
2323/// Prints an unsigned 64-bit int.
24- pub fn print64 ( value : u64 ) {
24+ fn print64 ( value : u64 ) {
2525 unsafe { native:: debug_print64 ( value) }
2626}
2727
2828/// Prints the contents of a slice.
29- pub fn print_mem ( slice : & [ u8 ] ) {
29+ fn print_mem ( slice : & [ u8 ] ) {
3030 unsafe { native:: debug_printMem ( slice. as_ptr ( ) as * const u32 , slice. len ( ) as u32 ) }
3131}
3232
3333/// Prints the contents of a slice in hexadecimal format.
34- pub fn print_mem_hex ( slice : & [ u8 ] ) {
34+ fn print_mem_hex ( slice : & [ u8 ] ) {
3535 unsafe { native:: debug_printMemHex ( slice. as_ptr ( ) as * const u32 , slice. len ( ) as u32 ) }
3636}
3737
3838/// Prints the value of a storage key.
39- pub fn print_storage ( key : & StorageKey ) {
39+ fn print_storage ( key : & StorageKey ) {
4040 unsafe { native:: debug_printStorage ( key. bytes . as_ptr ( ) as * const u32 ) }
4141}
4242
4343/// Prints the value of a storage key in hexadecimal format.
44- pub fn print_storage_hex ( key : & StorageKey ) {
44+ fn print_storage_hex ( key : & StorageKey ) {
4545 unsafe { native:: debug_printStorageHex ( key. bytes . as_ptr ( ) as * const u32 ) }
4646}
47+
48+ #[ macro_export]
49+ macro_rules! print32 {
50+ ( $e: expr) => {
51+ #[ cfg( debug_assertions) ]
52+ :: print32( $e)
53+ } ;
54+ }
55+
56+ #[ macro_export]
57+ macro_rules! print64 {
58+ ( $e: expr) => {
59+ #[ cfg( debug_assertions) ]
60+ :: print64( $e)
61+ } ;
62+ }
63+
64+ #[ macro_export]
65+ macro_rules! print_mem {
66+ ( $e: expr) => {
67+ #[ cfg( debug_assertions) ]
68+ :: print_mem( $e)
69+ } ;
70+ }
71+
72+ #[ macro_export]
73+ macro_rules! print_mem_hex {
74+ ( $e: expr) => {
75+ #[ cfg( debug_assertions) ]
76+ :: print_mem_hex( $e)
77+ } ;
78+ }
79+ #[ macro_export]
80+ macro_rules! print_storage {
81+ ( $e: expr) => {
82+ #[ cfg( debug_assertions) ]
83+ :: print_storage( $e)
84+ } ;
85+ }
86+ #[ macro_export]
87+ macro_rules! print_storage_hex {
88+ ( $e: expr) => {
89+ #[ cfg( debug_assertions) ]
90+ :: print_storage_hex( $e)
91+ } ;
92+ }
0 commit comments