1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2026-08-15 11:00:07 -04:00

Main: rename package "file" to "io"

This commit is contained in:
Alex Kotov 2022-06-14 15:03:17 +03:00
parent a769944005
commit 7da885e370
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
22 changed files with 56 additions and 55 deletions

View file

@ -17,7 +17,7 @@
* include/kernaux/libc.h: Has been split into separate headers * include/kernaux/libc.h: Has been split into separate headers
* include/kernaux/print.h: Functions "[v]printf" renamed to "[v]fprintf" * include/kernaux/print.h: Functions "[v]printf" renamed to "[v]fprintf"
* include/kernaux/file.h: Added * include/kernaux/io.h: Added
2022-06-06 Alex Kotov <kotovalexarian@gmail.com> 2022-06-06 Alex Kotov <kotovalexarian@gmail.com>

View file

@ -41,12 +41,12 @@ endif
if WITH_ELF if WITH_ELF
libkernaux_la_SOURCES += src/elf.c libkernaux_la_SOURCES += src/elf.c
endif endif
if WITH_FILE
libkernaux_la_SOURCES += src/file.c
endif
if WITH_FRAMEBUFFER if WITH_FRAMEBUFFER
libkernaux_la_SOURCES += src/framebuffer.c libkernaux_la_SOURCES += src/framebuffer.c
endif endif
if WITH_IO
libkernaux_la_SOURCES += src/io.c
endif
if WITH_LIBC if WITH_LIBC
libkernaux_la_LIBADD += libc/libc.la libkernaux_la_LIBADD += libc/libc.la
endif endif

View file

@ -42,7 +42,7 @@ zero). Work-in-progress APIs can change at any time.
* [Assert](/examples/assert.c) * [Assert](/examples/assert.c)
* [Panic](/examples/panic.c) * [Panic](/examples/panic.c)
* Stack trace *(planned)* * Stack trace *(planned)*
* [File simulator](/include/kernaux/file.h) (*work in progress*) * [Input/output](/include/kernaux/io.h) (*work in progress*)
* Architecture-specific code (*work in progress*) * Architecture-specific code (*work in progress*)
* [Declarations](/include/kernaux/arch/) * [Declarations](/include/kernaux/arch/)
* [Functions](/include/kernaux/asm/) * [Functions](/include/kernaux/asm/)

View file

@ -1,6 +1,6 @@
#include "main.h" #include "main.h"
#ifdef KERNAUX_VERSION_WITH_FILE #ifdef KERNAUX_VERSION_WITH_IO
static VALUE rb_KernAux_File_initialize(VALUE self, VALUE out); static VALUE rb_KernAux_File_initialize(VALUE self, VALUE out);
@ -8,7 +8,7 @@ static ID rb_intern_ATout = Qnil;
static VALUE rb_KernAux_File = Qnil; static VALUE rb_KernAux_File = Qnil;
void init_file() { void init_io() {
rb_gc_register_mark_object(ID2SYM(rb_intern_ATout = rb_intern("@out"))); rb_gc_register_mark_object(ID2SYM(rb_intern_ATout = rb_intern("@out")));
rb_gc_register_mark_object(rb_KernAux_File = rb_gc_register_mark_object(rb_KernAux_File =
@ -24,4 +24,4 @@ VALUE rb_KernAux_File_initialize(VALUE self, VALUE out)
return Qnil; return Qnil;
} }
#endif // KERNAUX_VERSION_WITH_FILE #endif // KERNAUX_VERSION_WITH_IO

View file

@ -22,12 +22,13 @@ void Init_default()
init_version(); init_version();
init_assert(); init_assert();
#ifdef KERNAUX_VERSION_WITH_IO
init_io();
#endif // KERNAUX_VERSION_WITH_IO
#ifdef KERNAUX_VERSION_WITH_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
init_cmdline(); init_cmdline();
#endif // KERNAUX_VERSION_WITH_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE
#ifdef KERNAUX_VERSION_WITH_FILE
init_file();
#endif // KERNAUX_VERSION_WITH_FILE
#ifdef KERNAUX_VERSION_WITH_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
init_ntoa(); init_ntoa();
#endif // KERNAUX_VERSION_WITH_NTOA #endif // KERNAUX_VERSION_WITH_NTOA

View file

@ -15,12 +15,13 @@ extern VALUE rb_KernAux_Error;
void init_version(); void init_version();
void init_assert(); void init_assert();
#ifdef KERNAUX_VERSION_WITH_IO
void init_io();
#endif // KERNAUX_VERSION_WITH_IO
#ifdef KERNAUX_VERSION_WITH_CMDLINE #ifdef KERNAUX_VERSION_WITH_CMDLINE
void init_cmdline(); void init_cmdline();
#endif // KERNAUX_VERSION_WITH_CMDLINE #endif // KERNAUX_VERSION_WITH_CMDLINE
#ifdef KERNAUX_VERSION_WITH_FILE
void init_file();
#endif // KERNAUX_VERSION_WITH_FILE
#ifdef KERNAUX_VERSION_WITH_NTOA #ifdef KERNAUX_VERSION_WITH_NTOA
void init_ntoa(); void init_ntoa();
#endif // KERNAUX_VERSION_WITH_NTOA #endif // KERNAUX_VERSION_WITH_NTOA

View file

@ -1,7 +1,7 @@
#include "main.h" #include "main.h"
static VALUE rb_KernAux_Version_with_cmdlineQN(VALUE self); static VALUE rb_KernAux_Version_with_cmdlineQN(VALUE self);
static VALUE rb_KernAux_Version_with_fileQN(VALUE self); static VALUE rb_KernAux_Version_with_ioQN(VALUE self);
static VALUE rb_KernAux_Version_with_ntoaQN(VALUE self); static VALUE rb_KernAux_Version_with_ntoaQN(VALUE self);
static VALUE rb_KernAux_Version_with_printfQN(VALUE self); static VALUE rb_KernAux_Version_with_printfQN(VALUE self);
@ -14,8 +14,8 @@ void init_version()
rb_define_singleton_method(rb_KernAux_Version, "with_cmdline?", rb_define_singleton_method(rb_KernAux_Version, "with_cmdline?",
rb_KernAux_Version_with_cmdlineQN, 0); rb_KernAux_Version_with_cmdlineQN, 0);
rb_define_singleton_method(rb_KernAux_Version, "with_file?", rb_define_singleton_method(rb_KernAux_Version, "with_io?",
rb_KernAux_Version_with_fileQN, 0); rb_KernAux_Version_with_ioQN, 0);
rb_define_singleton_method(rb_KernAux_Version, "with_ntoa?", rb_define_singleton_method(rb_KernAux_Version, "with_ntoa?",
rb_KernAux_Version_with_ntoaQN, 0); rb_KernAux_Version_with_ntoaQN, 0);
rb_define_singleton_method(rb_KernAux_Version, "with_printf?", rb_define_singleton_method(rb_KernAux_Version, "with_printf?",
@ -31,9 +31,9 @@ VALUE rb_KernAux_Version_with_cmdlineQN(VALUE self)
#endif #endif
} }
VALUE rb_KernAux_Version_with_fileQN(VALUE self) VALUE rb_KernAux_Version_with_ioQN(VALUE self)
{ {
#ifdef KERNAUX_VERSION_WITH_FILE #ifdef KERNAUX_VERSION_WITH_IO
return Qtrue; return Qtrue;
#else #else
return Qfalse; return Qfalse;

View file

@ -16,7 +16,6 @@ require_relative 'kernaux/default'
require_relative 'kernaux/assert' require_relative 'kernaux/assert'
require_relative 'kernaux/cmdline' require_relative 'kernaux/cmdline'
require_relative 'kernaux/errors' require_relative 'kernaux/errors'
require_relative 'kernaux/io'
require_relative 'kernaux/ntoa' require_relative 'kernaux/ntoa'
require_relative 'kernaux/printf' require_relative 'kernaux/printf'
require_relative 'kernaux/file'

View file

@ -2,7 +2,7 @@
# rubocop:disable Lint/EmptyClass # rubocop:disable Lint/EmptyClass
if KernAux::Version.with_file? if KernAux::Version.with_io?
module KernAux module KernAux
## ##
# File simulator. # File simulator.

View file

@ -59,8 +59,8 @@ AC_ARG_WITH( [all], AS_HELP_STRING([--without-all], [without a
AC_ARG_WITH( [cmdline], AS_HELP_STRING([--without-cmdline], [without command line parser])) AC_ARG_WITH( [cmdline], AS_HELP_STRING([--without-cmdline], [without command line parser]))
AC_ARG_WITH( [console], AS_HELP_STRING([--without-console], [without serial console])) AC_ARG_WITH( [console], AS_HELP_STRING([--without-console], [without serial console]))
AC_ARG_WITH( [elf], AS_HELP_STRING([--without-elf], [without ELF utils])) AC_ARG_WITH( [elf], AS_HELP_STRING([--without-elf], [without ELF utils]))
AC_ARG_WITH( [file], AS_HELP_STRING([--without-file], [without file simulator]))
AC_ARG_WITH( [framebuffer], AS_HELP_STRING([--without-framebuffer], [without framebuffer])) AC_ARG_WITH( [framebuffer], AS_HELP_STRING([--without-framebuffer], [without framebuffer]))
AC_ARG_WITH( [io], AS_HELP_STRING([--without-io], [without input/output]))
AC_ARG_WITH( [mbr], AS_HELP_STRING([--without-mbr], [without Master Boot Record])) AC_ARG_WITH( [mbr], AS_HELP_STRING([--without-mbr], [without Master Boot Record]))
AC_ARG_WITH( [multiboot2], AS_HELP_STRING([--without-multiboot2], [without Multiboot 2 information parser])) AC_ARG_WITH( [multiboot2], AS_HELP_STRING([--without-multiboot2], [without Multiboot 2 information parser]))
AC_ARG_WITH( [ntoa], AS_HELP_STRING([--without-ntoa], [without itoa/ftoa])) AC_ARG_WITH( [ntoa], AS_HELP_STRING([--without-ntoa], [without itoa/ftoa]))
@ -90,8 +90,8 @@ AC_DEFUN([do_without_all],
if test -z "$with_cmdline"; then with_cmdline=no; fi if test -z "$with_cmdline"; then with_cmdline=no; fi
if test -z "$with_console"; then with_console=no; fi if test -z "$with_console"; then with_console=no; fi
if test -z "$with_elf"; then with_elf=no; fi if test -z "$with_elf"; then with_elf=no; fi
if test -z "$with_file"; then with_file=no; fi
if test -z "$with_framebuffer"; then with_framebuffer=no; fi if test -z "$with_framebuffer"; then with_framebuffer=no; fi
if test -z "$with_io"; then with_io=no; fi
if test -z "$with_mbr"; then with_mbr=no; fi if test -z "$with_mbr"; then with_mbr=no; fi
if test -z "$with_multiboot2"; then with_multiboot2=no; fi if test -z "$with_multiboot2"; then with_multiboot2=no; fi
if test -z "$with_ntoa"; then with_ntoa=no; fi if test -z "$with_ntoa"; then with_ntoa=no; fi
@ -125,8 +125,8 @@ AS_IF([test "$with_all" = no ], [with_all=no], [with_all=
AS_IF([test "$with_cmdline" = no ], [with_cmdline=no], [with_cmdline=yes]) AS_IF([test "$with_cmdline" = no ], [with_cmdline=no], [with_cmdline=yes])
AS_IF([test "$with_console" = no ], [with_console=no], [with_console=yes]) AS_IF([test "$with_console" = no ], [with_console=no], [with_console=yes])
AS_IF([test "$with_elf" = no ], [with_elf=no], [with_elf=yes]) AS_IF([test "$with_elf" = no ], [with_elf=no], [with_elf=yes])
AS_IF([test "$with_file" = no ], [with_file=no], [with_file=yes])
AS_IF([test "$with_framebuffer" = no ], [with_framebuffer=no], [with_framebuffer=yes]) AS_IF([test "$with_framebuffer" = no ], [with_framebuffer=no], [with_framebuffer=yes])
AS_IF([test "$with_io" = no ], [with_io=no], [with_io=yes])
AS_IF([test "$with_mbr" = no ], [with_mbr=no], [with_mbr=yes]) AS_IF([test "$with_mbr" = no ], [with_mbr=no], [with_mbr=yes])
AS_IF([test "$with_multiboot2" = no ], [with_multiboot2=no], [with_multiboot2=yes]) AS_IF([test "$with_multiboot2" = no ], [with_multiboot2=no], [with_multiboot2=yes])
AS_IF([test "$with_ntoa" = no ], [with_ntoa=no], [with_ntoa=yes]) AS_IF([test "$with_ntoa" = no ], [with_ntoa=no], [with_ntoa=yes])
@ -181,8 +181,8 @@ dnl Packages (enabled by default)
AM_CONDITIONAL([WITH_CMDLINE], [test "$with_cmdline" = yes]) AM_CONDITIONAL([WITH_CMDLINE], [test "$with_cmdline" = yes])
AM_CONDITIONAL([WITH_CONSOLE], [test "$with_console" = yes]) AM_CONDITIONAL([WITH_CONSOLE], [test "$with_console" = yes])
AM_CONDITIONAL([WITH_ELF], [test "$with_elf" = yes]) AM_CONDITIONAL([WITH_ELF], [test "$with_elf" = yes])
AM_CONDITIONAL([WITH_FILE], [test "$with_file" = yes])
AM_CONDITIONAL([WITH_FRAMEBUFFER], [test "$with_framebuffer" = yes]) AM_CONDITIONAL([WITH_FRAMEBUFFER], [test "$with_framebuffer" = yes])
AM_CONDITIONAL([WITH_IO], [test "$with_io" = yes])
AM_CONDITIONAL([WITH_MBR], [test "$with_mbr" = yes]) AM_CONDITIONAL([WITH_MBR], [test "$with_mbr" = yes])
AM_CONDITIONAL([WITH_MULTIBOOT2], [test "$with_multiboot2" = yes]) AM_CONDITIONAL([WITH_MULTIBOOT2], [test "$with_multiboot2" = yes])
AM_CONDITIONAL([WITH_NTOA], [test "$with_ntoa" = yes]) AM_CONDITIONAL([WITH_NTOA], [test "$with_ntoa" = yes])
@ -220,8 +220,8 @@ dnl Packages (enabled by default)
AS_IF([test "$with_cmdline" = yes], [AC_DEFINE([WITH_CMDLINE], [1], [with command line parser])]) AS_IF([test "$with_cmdline" = yes], [AC_DEFINE([WITH_CMDLINE], [1], [with command line parser])])
AS_IF([test "$with_console" = yes], [AC_DEFINE([WITH_CONSOLE], [1], [with serial console])]) AS_IF([test "$with_console" = yes], [AC_DEFINE([WITH_CONSOLE], [1], [with serial console])])
AS_IF([test "$with_elf" = yes], [AC_DEFINE([WITH_ELF], [1], [with ELF utils])]) AS_IF([test "$with_elf" = yes], [AC_DEFINE([WITH_ELF], [1], [with ELF utils])])
AS_IF([test "$with_file" = yes], [AC_DEFINE([WITH_FILE], [1], [with file simulator])])
AS_IF([test "$with_framebuffer" = yes], [AC_DEFINE([WITH_FRAMEBUFFER], [1], [with framebuffer])]) AS_IF([test "$with_framebuffer" = yes], [AC_DEFINE([WITH_FRAMEBUFFER], [1], [with framebuffer])])
AS_IF([test "$with_io" = yes], [AC_DEFINE([WITH_IO], [1], [with input/output])])
AS_IF([test "$with_mbr" = yes], [AC_DEFINE([WITH_MBR], [1], [with Master Boot Record])]) AS_IF([test "$with_mbr" = yes], [AC_DEFINE([WITH_MBR], [1], [with Master Boot Record])])
AS_IF([test "$with_multiboot2" = yes], [AC_DEFINE([WITH_MULTIBOOT2], [1], [with Multiboot 2 information parser])]) AS_IF([test "$with_multiboot2" = yes], [AC_DEFINE([WITH_MULTIBOOT2], [1], [with Multiboot 2 information parser])])
AS_IF([test "$with_ntoa" = yes], [AC_DEFINE([WITH_NTOA], [1], [with ntoa])]) AS_IF([test "$with_ntoa" = yes], [AC_DEFINE([WITH_NTOA], [1], [with ntoa])])
@ -246,8 +246,8 @@ dnl Packages (enabled by default)
AS_IF([test "$with_cmdline" = no], [AC_SUBST([comment_line_cmdline], [//])]) AS_IF([test "$with_cmdline" = no], [AC_SUBST([comment_line_cmdline], [//])])
AS_IF([test "$with_console" = no], [AC_SUBST([comment_line_console], [//])]) AS_IF([test "$with_console" = no], [AC_SUBST([comment_line_console], [//])])
AS_IF([test "$with_elf" = no], [AC_SUBST([comment_line_elf], [//])]) AS_IF([test "$with_elf" = no], [AC_SUBST([comment_line_elf], [//])])
AS_IF([test "$with_file" = no], [AC_SUBST([comment_line_file], [//])])
AS_IF([test "$with_framebuffer" = no], [AC_SUBST([comment_line_framebuffer], [//])]) AS_IF([test "$with_framebuffer" = no], [AC_SUBST([comment_line_framebuffer], [//])])
AS_IF([test "$with_io" = no], [AC_SUBST([comment_line_io], [//])])
AS_IF([test "$with_mbr" = no], [AC_SUBST([comment_line_mbr], [//])]) AS_IF([test "$with_mbr" = no], [AC_SUBST([comment_line_mbr], [//])])
AS_IF([test "$with_multiboot2" = no], [AC_SUBST([comment_line_multiboot2], [//])]) AS_IF([test "$with_multiboot2" = no], [AC_SUBST([comment_line_multiboot2], [//])])
AS_IF([test "$with_ntoa" = no], [AC_SUBST([comment_line_ntoa], [//])]) AS_IF([test "$with_ntoa" = no], [AC_SUBST([comment_line_ntoa], [//])])

View file

@ -26,7 +26,7 @@ endif
########### ###########
if WITH_PRINTF if WITH_PRINTF
if WITH_FILE if WITH_IO
TESTS += fprintf TESTS += fprintf
fprintf_LDADD = $(top_builddir)/libkernaux.la fprintf_LDADD = $(top_builddir)/libkernaux.la
fprintf_SOURCES = fprintf.c fprintf_SOURCES = fprintf.c
@ -38,7 +38,7 @@ endif
############## ##############
if WITH_PRINTF if WITH_PRINTF
if WITH_FILE if WITH_IO
TESTS += fprintf_va TESTS += fprintf_va
fprintf_va_LDADD = $(top_builddir)/libkernaux.la fprintf_va_LDADD = $(top_builddir)/libkernaux.la
fprintf_va_SOURCES = fprintf_va.c fprintf_va_SOURCES = fprintf_va.c

View file

@ -1,4 +1,4 @@
#include <kernaux/file.h> #include <kernaux/io.h>
#include <kernaux/printf.h> #include <kernaux/printf.h>
#include <assert.h> #include <assert.h>

View file

@ -1,4 +1,4 @@
#include <kernaux/file.h> #include <kernaux/io.h>
#include <kernaux/printf.h> #include <kernaux/printf.h>
#include <assert.h> #include <assert.h>

View file

@ -25,12 +25,12 @@ endif
if WITH_ELF if WITH_ELF
nobase_include_HEADERS += kernaux/elf.h nobase_include_HEADERS += kernaux/elf.h
endif endif
if WITH_FILE
nobase_include_HEADERS += kernaux/file.h
endif
if WITH_FRAMEBUFFER if WITH_FRAMEBUFFER
nobase_include_HEADERS += kernaux/framebuffer.h nobase_include_HEADERS += kernaux/framebuffer.h
endif endif
if WITH_IO
nobase_include_HEADERS += kernaux/io.h
endif
if WITH_MBR if WITH_MBR
nobase_include_HEADERS += kernaux/mbr.h nobase_include_HEADERS += kernaux/mbr.h
endif endif

View file

@ -10,8 +10,8 @@
@comment_line_cmdline@#include <kernaux/cmdline.h> @comment_line_cmdline@#include <kernaux/cmdline.h>
@comment_line_console@#include <kernaux/console.h> @comment_line_console@#include <kernaux/console.h>
@comment_line_elf@#include <kernaux/elf.h> @comment_line_elf@#include <kernaux/elf.h>
@comment_line_file@#include <kernaux/file.h>
@comment_line_framebuffer@#include <kernaux/framebuffer.h> @comment_line_framebuffer@#include <kernaux/framebuffer.h>
@comment_line_io@#include <kernaux/io.h>
@comment_line_mbr@#include <kernaux/mbr.h> @comment_line_mbr@#include <kernaux/mbr.h>
@comment_line_multiboot2@#include <kernaux/multiboot2.h> @comment_line_multiboot2@#include <kernaux/multiboot2.h>
@comment_line_ntoa@#include <kernaux/ntoa.h> @comment_line_ntoa@#include <kernaux/ntoa.h>

View file

@ -1,5 +1,5 @@
#ifndef KERNAUX_INCLUDED_FILE #ifndef KERNAUX_INCLUDED_IO
#define KERNAUX_INCLUDED_FILE #define KERNAUX_INCLUDED_IO
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -8,7 +8,7 @@ extern "C" {
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
@comment_line_file@#include <kernaux/file.h> @comment_line_io@#include <kernaux/io.h>
/** /**
* Tiny [v]fprintf implementation * Tiny [v]fprintf implementation
@ -18,8 +18,8 @@ extern "C" {
* \param va A value identifying a variable arguments list * \param va A value identifying a variable arguments list
* \return The number of characters that are sent to the output function, not counting the terminating null character * \return The number of characters that are sent to the output function, not counting the terminating null character
*/ */
@comment_line_file@int kernaux_fprintf(KernAux_File file, void* arg, const char* format, ...); @comment_line_io@int kernaux_fprintf(KernAux_File file, void* arg, const char* format, ...);
@comment_line_file@int kernaux_vfprintf(KernAux_File file, void* arg, const char* format, va_list va); @comment_line_io@int kernaux_vfprintf(KernAux_File file, void* arg, const char* format, va_list va);
/** /**
* Tiny [v]snprintf implementation * Tiny [v]snprintf implementation

View file

@ -4,8 +4,8 @@
@comment_line_cmdline@#define KERNAUX_VERSION_WITH_CMDLINE @comment_line_cmdline@#define KERNAUX_VERSION_WITH_CMDLINE
@comment_line_console@#define KERNAUX_VERSION_WITH_CONSOLE @comment_line_console@#define KERNAUX_VERSION_WITH_CONSOLE
@comment_line_elf@#define KERNAUX_VERSION_WITH_ELF @comment_line_elf@#define KERNAUX_VERSION_WITH_ELF
@comment_line_file@#define KERNAUX_VERSION_WITH_FILE
@comment_line_framebuffer@#define KERNAUX_VERSION_WITH_FRAMEBUFFER @comment_line_framebuffer@#define KERNAUX_VERSION_WITH_FRAMEBUFFER
@comment_line_io@#define KERNAUX_VERSION_WITH_IO
@comment_line_mbr@#define KERNAUX_VERSION_WITH_MBR @comment_line_mbr@#define KERNAUX_VERSION_WITH_MBR
@comment_line_multiboot2@#define KERNAUX_VERSION_WITH_MULTIBOOT2 @comment_line_multiboot2@#define KERNAUX_VERSION_WITH_MULTIBOOT2
@comment_line_ntoa@#define KERNAUX_VERSION_WITH_NTOA @comment_line_ntoa@#define KERNAUX_VERSION_WITH_NTOA

View file

@ -14,8 +14,8 @@
#include <kernaux/asm/x86_64.h> #include <kernaux/asm/x86_64.h>
#endif #endif
#ifdef WITH_FILE #ifdef WITH_IO
#include <kernaux/file.h> #include <kernaux/io.h>
#endif #endif
#ifdef WITH_PRINTF #ifdef WITH_PRINTF
#include <kernaux/printf.h> #include <kernaux/printf.h>
@ -23,7 +23,7 @@
#include <stddef.h> #include <stddef.h>
#if defined(WITH_FILE) && defined(WITH_PRINTF) #if defined(WITH_IO) && defined(WITH_PRINTF)
static void kernaux_console_printf_putc( static void kernaux_console_printf_putc(
const char c, const char c,
void *const arg __attribute__((unused)) void *const arg __attribute__((unused))
@ -51,7 +51,7 @@ void kernaux_console_print(const char *const s)
} }
} }
#if defined(WITH_FILE) && defined(WITH_PRINTF) #if defined(WITH_IO) && defined(WITH_PRINTF)
void kernaux_console_printf(const char *format, ...) void kernaux_console_printf(const char *format, ...)
{ {
KERNAUX_ASSERT(format); KERNAUX_ASSERT(format);

View file

@ -3,7 +3,7 @@
#endif #endif
#include <kernaux/assert.h> #include <kernaux/assert.h>
#include <kernaux/file.h> #include <kernaux/io.h>
#include <stddef.h> #include <stddef.h>

View file

@ -66,7 +66,7 @@ static size_t _etoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, d
* Implementations: main API * * Implementations: main API *
*****************************/ *****************************/
#ifdef WITH_FILE #ifdef WITH_IO
int kernaux_fprintf(const KernAux_File file, void* arg, const char* format, ...) int kernaux_fprintf(const KernAux_File file, void* arg, const char* format, ...)
{ {
@ -90,7 +90,7 @@ int kernaux_vfprintf(const KernAux_File file, void* arg, const char* format, va_
return _vsnprintf(_out_fct, (char*)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va); return _vsnprintf(_out_fct, (char*)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va);
} }
#endif // WITH_FILE #endif // WITH_IO
int kernaux_snprintf(char* buffer, size_t count, const char* format, ...) int kernaux_snprintf(char* buffer, size_t count, const char* format, ...)
{ {

View file

@ -4,8 +4,8 @@
#include <kernaux/printf.h> #include <kernaux/printf.h>
#ifdef WITH_FILE #ifdef WITH_IO
#include <kernaux/file.h> #include <kernaux/io.h>
#endif #endif
#include <assert.h> #include <assert.h>
@ -18,7 +18,7 @@
static char buffer[BUFFER_SIZE]; static char buffer[BUFFER_SIZE];
static size_t buffer_index; static size_t buffer_index;
#ifdef WITH_FILE #ifdef WITH_IO
static const char *const data = "foobar"; static const char *const data = "foobar";
@ -34,14 +34,14 @@ static void test_putchar(const char chr, void *const arg)
buffer[buffer_index++] = chr; buffer[buffer_index++] = chr;
} }
#endif // WITH_FILE #endif // WITH_IO
static void test(const char *const expected, const char *const format, ...) static void test(const char *const expected, const char *const format, ...)
{ {
va_list va; va_list va;
int result; int result;
#ifdef WITH_FILE #ifdef WITH_IO
memset(buffer, '\0', sizeof(buffer)); memset(buffer, '\0', sizeof(buffer));
buffer_index = 0; buffer_index = 0;
va_start(va, format); va_start(va, format);
@ -63,7 +63,7 @@ static void test(const char *const expected, const char *const format, ...)
int main() int main()
{ {
#ifdef WITH_FILE #ifdef WITH_IO
memset(buffer, '\0', sizeof(buffer)); memset(buffer, '\0', sizeof(buffer));
buffer_index = 0; buffer_index = 0;
struct KernAux_File file = KernAux_File_create(test_putchar); struct KernAux_File file = KernAux_File_create(test_putchar);