The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
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
*/
10
typedef
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
*/
17
void
stdio_set_putchar
(
StdioPutCharFn
func);
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
*/
24
void
stdio_putchar
(
char
c);
25
26
/**
27
* print a null terminated string to the output.
28
* @param str null terminated string to print.
29
*/
30
void
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
*/
39
void
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
*/
48
void
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
*/
58
void
stdio_format_args
(
StdioPutCharFn
out, const
char
*fmt,
va_list
args);
stdarg.h
stdint.h
StdioPutCharFn
void(*) StdioPutCharFn(char c)
signature of a low-level character output function used by stdio.
Definition
stdio.h:10
va_list
__builtin_va_list va_list
variadic arguments, from the compiler's builtins.
Definition
stdarg.h:8
printf
int printf(const char *fmt,...) __attribute__((format(printf
formatted output.
puts
int puts(const char *s)
Definition
stdio.c:286
stdio_printf_to
void stdio_printf_to(StdioPutCharFn out, const char *fmt,...)
Definition
stdio.c:273
stdio_set_putchar
void stdio_set_putchar(StdioPutCharFn func)
configure the low-level output backend for stdio.
Definition
stdio.c:5
stdio_putchar
void stdio_putchar(char c)
output a single character through the configured stdio backend.
Definition
stdio.c:10
stdio_format_args
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
__attribute__
ELF32 file header.
Definition
elf.h:51
src
common
stdio.h
Generated by
1.18.0