Rust · 1514 bytes Raw Blame History
1 //! Legacy I/O functions — thin wrappers around the unit-based I/O system.
2 //!
3 //! These functions are called by generated code via RuntimeFunc::Print*.
4 //! They delegate to the unit-based afs_write_* functions on unit 6 (stdout).
5
6 use crate::io_system;
7
8 /// Print a character string (list-directed, stdout).
9 #[no_mangle]
10 pub extern "C" fn afs_print_string(ptr: *const u8, len: i64) {
11 io_system::afs_write_string(6, ptr, len);
12 }
13
14 /// Print a 32-bit integer (list-directed, stdout).
15 #[no_mangle]
16 pub extern "C" fn afs_print_int(val: i32) {
17 io_system::afs_write_int(6, val);
18 }
19
20 /// Print a 64-bit integer (list-directed, stdout).
21 #[no_mangle]
22 pub extern "C" fn afs_print_int64(val: i64) {
23 io_system::afs_write_int64(6, val);
24 }
25
26 /// Print a 128-bit integer (list-directed, stdout).
27 #[no_mangle]
28 pub extern "C" fn afs_print_int128(val: i128) {
29 io_system::afs_write_int128(6, val);
30 }
31
32 /// Print a single-precision real (list-directed, stdout).
33 #[no_mangle]
34 pub extern "C" fn afs_print_real(val: f32) {
35 io_system::afs_write_real(6, val);
36 }
37
38 /// Print a double-precision real (list-directed, stdout).
39 #[no_mangle]
40 pub extern "C" fn afs_print_real64(val: f64) {
41 io_system::afs_write_real64(6, val);
42 }
43
44 /// Print a logical value (list-directed, stdout).
45 #[no_mangle]
46 pub extern "C" fn afs_print_logical(val: i32) {
47 io_system::afs_write_logical(6, val);
48 }
49
50 /// End a PRINT statement (newline, stdout).
51 #[no_mangle]
52 pub extern "C" fn afs_print_newline() {
53 io_system::afs_write_newline(6);
54 }
55