Debian Codegraph @

tests/inputs/fmt.ha

raw
1 // License: MPL-2.0
2 // (c) 2022 Alexey Yerin <[email protected]>
3 // (c) 2021 Andri Yngvason <[email protected]>
4 // (c) 2021-2022 Bor Grošelj Simić <[email protected]>
5 // (c) 2021 Byron Torres <[email protected]>
6 // (c) 2021 Drew DeVault <[email protected]>
7 // (c) 2021 Ember Sawady <[email protected]>
8 use ascii;
9 use bufio;
10 use encoding::utf8;
11 use io;
12 // https://git.sr.ht/~sircmpwn/hare/tree/master/item/fmt/fmt.ha
13 use math;
14 use os;
15 use strconv;
16 use strings;
17 use types;
18
19 // Tagged union of the [[formattable]] types and [[modifiers]]. Used for
20 // functions which accept format strings.
21 export type field = (...formattable | *modifiers);
22
23 // Tagged union of all types which are formattable.
24 export type formattable = (...types::numeric | uintptr | str | rune | bool |
25 nullable *void | void);
26
27 // Formats text for printing and writes it to [[os::stdout]].
28 export fn printf(fmt: str, args: field...) (io::error | size) =
29 fprintf(os::stdout, fmt, args...);
30
31 // Formats text for printing and writes it to [[os::stdout]], followed by a line
32 // feed.
33 export fn printfln(fmt: str, args: field...) (io::error | size) =
34 fprintfln(os::stdout, fmt, args...);