mirror of
https://github.com/tailix/libkernaux.git
synced 2025-02-24 15:55:41 -05:00
Add function "kernaux_printf"
This commit is contained in:
parent
1bdda5b53e
commit
ceff5cf197
8 changed files with 53 additions and 3 deletions
|
@ -10,11 +10,13 @@ AM_CFLAGS = \
|
|||
lib_LIBRARIES = libkernaux.a
|
||||
|
||||
TESTS = \
|
||||
tests/test_printf \
|
||||
tests/test_stdlib
|
||||
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
||||
libkernaux_a_SOURCES = \
|
||||
src/printf.c \
|
||||
src/stdlib.c
|
||||
|
||||
if ARCH_X86
|
||||
|
@ -83,6 +85,10 @@ tests_test_pfa_SOURCES = \
|
|||
$(libkernaux_a_SOURCES) \
|
||||
tests/test_pfa.c
|
||||
|
||||
tests_test_printf_SOURCES = \
|
||||
$(libkernaux_a_SOURCES) \
|
||||
tests/test_printf.c
|
||||
|
||||
tests_test_stdlib_SOURCES = \
|
||||
$(libkernaux_a_SOURCES) \
|
||||
tests/test_stdlib.c
|
||||
|
|
|
@ -27,11 +27,12 @@ API
|
|||
* [Page Frame Allocator](/include/kernaux/pfa.h) *(work in progress)*
|
||||
* ELF utils *(planned)*
|
||||
* [Architecture-specific helpers](/include/kernaux/arch/)
|
||||
* [stdlib replacement](/include/kernaux/stdlib.h) (with prefix):
|
||||
* [printf replacement](/include/kernaux/printf.h) *(work in progress)*
|
||||
* [stdlib replacement](/include/kernaux/stdlib.h):
|
||||
* `memset`
|
||||
* `strlen`
|
||||
* `strncpy`
|
||||
* `itoa` *(incomplete)*
|
||||
* `itoa` *(work in progress)*
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,6 @@ AC_PROG_CC_C99
|
|||
AC_PROG_RANLIB
|
||||
AC_C_INLINE
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_CHECK_HEADERS([stddef.h])
|
||||
AC_CHECK_HEADERS([stdarg.h stddef.h])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -4,4 +4,5 @@ nobase_include_HEADERS = \
|
|||
kernaux/console.h \
|
||||
kernaux/multiboot2.h \
|
||||
kernaux/pfa.h \
|
||||
kernaux/printf.h \
|
||||
kernaux/stdlib.h
|
||||
|
|
17
include/kernaux/printf.h
Normal file
17
include/kernaux/printf.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef KERNAUX_INCLUDED_PRINTF
|
||||
#define KERNAUX_INCLUDED_PRINTF 1
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void kernaux_printf(void (*putchar)(char), const char *format, ...);
|
||||
void kernaux_printf_va(void (*putchar)(char), const char *format, va_list va);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
19
src/printf.c
Normal file
19
src/printf.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <kernaux/printf.h>
|
||||
#include <kernaux/stdlib.h>
|
||||
|
||||
void kernaux_printf(void (*putchar)(char), const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
kernaux_printf_va(putchar, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void kernaux_printf_va(
|
||||
void (*const putchar)(char),
|
||||
const char *format,
|
||||
va_list va
|
||||
) {
|
||||
}
|
BIN
tests/test_printf
Executable file
BIN
tests/test_printf
Executable file
Binary file not shown.
6
tests/test_printf.c
Normal file
6
tests/test_printf.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <kernaux/printf.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue