The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
stdio.h
Go to the documentation of this file.
1#pragma once
2
3#include "stdint.h"
4#include "stdarg.h"
5
6/**
7 * signature of a low-level character output function used by stdio.
8 * @param c character to output.
9 */
10typedef void (*StdioPutCharFn)(char c);
11
12/**
13 * configure the low-level output backend for stdio.
14 * this must be called by each runtime environment before printf/puts are used.
15 * @param func callback used for character output.
16 */
18
19/**
20 * output a single character through the configured stdio backend.
21 * if no backend is configured this function does nothing.
22 * @param c character to output.
23 */
24void stdio_putchar(char c);
25
26/**
27 * print a null terminated string to the output.
28 * @param str null terminated string to print.
29 */
30void puts(const char *str);
31
32/**
33 * print a formatted string to the output.
34 * conversions: %d %i %u %x %X %o %c %s %p %%, with the length modifiers
35 * hh h l ll z (z: size_t / ssize_t). %p prints 0x and pointer-width hex.
36 * no field width, precision or flags.
37 * @param fmt format string.
38 */
39void printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
40
41/**
42 * print a formatted string through a caller-supplied output backend,
43 * bypassing the global stdio backend. lets subsystems (e.g. klog) reuse
44 * the printf formatter to write somewhere other than the console.
45 * @param out character output callback.
46 * @param fmt format string.
47 */
48void stdio_printf_to(StdioPutCharFn out, const char *fmt, ...)
49 __attribute__((format(printf, 2, 3)));
50
51/**
52 * format engine entry point for variadic wrappers: they va_start their own
53 * arguments and pass the list here.
54 * @param out character output callback.
55 * @param fmt format string.
56 * @param args the caller's argument list.
57 */
58void stdio_format_args(StdioPutCharFn out, const char *fmt, va_list args);
void(*) StdioPutCharFn(char c)
signature of a low-level character output function used by stdio.
Definition stdio.h:10
__builtin_va_list va_list
variadic arguments, from the compiler's builtins.
Definition stdarg.h:8
int printf(const char *fmt,...) __attribute__((format(printf
formatted output.
int puts(const char *s)
Definition stdio.c:286
void stdio_printf_to(StdioPutCharFn out, const char *fmt,...)
Definition stdio.c:273
void stdio_set_putchar(StdioPutCharFn func)
configure the low-level output backend for stdio.
Definition stdio.c:5
void stdio_putchar(char c)
output a single character through the configured stdio backend.
Definition stdio.c:10
void stdio_format_args(StdioPutCharFn out, const char *fmt, va_list args)
format engine entry point for variadic wrappers: they va_start their own arguments and pass the list ...
Definition stdio.c:144
ELF32 file header.
Definition elf.h:51