title: src/crelude/io.h
src/crelude/io.h
Functions
Name | |
---|---|
ierr | fput(string , FILE * )fputs(...) with string . |
ierr | put(string ) Same as fput(..., stdout) . |
ierr | eput(string ) Same as fput(..., stderr) . |
ierr | eputs(const byte * ) puts(...) to STDERR. |
string | novel_vsprintf(const byte * , va_list ) |
string | novel_sprintf(const byte * , ... ) |
ierr | novel_vfprintf(FILE * , const byte * , va_list ) |
ierr | novel_fprintf(FILE * , const byte * , ... ) |
ierr | novel_vfprintf_newline(FILE * , const byte * , va_list ) |
ierr | novel_fprintf_newline(FILE * , const byte * , ... ) |
ierr | novel_printf(const byte * , ... ) |
usize | sizeof_specifier(const byte * ) |
Defines
Detailed Description
New printf style functions and aliases.
Functions Documentation
function fput
ierr fput(
string ,
FILE *
)
fputs(...)
with string
.
function put
ierr put(
string
)
Same as fput(..., stdout)
.
function eput
ierr eput(
string
)
Same as fput(..., stderr)
.
function eputs
ierr eputs(
const byte *
)
puts(...) to STDERR.
function novel_vsprintf
string novel_vsprintf(
const byte * ,
va_list
)
Note: Heap allocates memory, should be freed after printing.
Custom printf
for other data-types.
function novel_sprintf
string novel_sprintf(
const byte * ,
...
)
Note: Returns heap-allocated memory, should be freed.
function novel_vfprintf
ierr novel_vfprintf(
FILE * ,
const byte * ,
va_list
)
function novel_fprintf
ierr novel_fprintf(
FILE * ,
const byte * ,
...
)
function novel_vfprintf_newline
ierr novel_vfprintf_newline(
FILE * ,
const byte * ,
va_list
)
function novel_fprintf_newline
ierr novel_fprintf_newline(
FILE * ,
const byte * ,
...
)
function novel_printf
ierr novel_printf(
const byte * ,
...
)
function sizeof_specifier
usize sizeof_specifier(
const byte *
)
Size of the type of a printf
-style format specifer. e.g. sizeof_specifier("hx") == sizeof(unsigned short int);
.
Macros Documentation
define PANIC
#define PANIC(
lit,
...
)
[panic](/crelude/Files/common_8h.md#function-panic)("\n[**] Panicking!\n[**] CAUSE:\n -- \t%s(): " \
lit "\n[**] Aborting...\n", __func__, ## __VA_ARGS__)
define print
#define print(
...
)
[novel_fprintf](/crelude/Files/io_8h.md#function-novel_fprintf)(stdout, __VA_ARGS__)
define sprint
#define sprint [novel_sprintf](/crelude/Files/io_8h.md#function-novel_sprintf)
define println
#define println(
...
)
[novel_fprintf_newline](/crelude/Files/io_8h.md#function-novel_fprintf_newline)(stdout, __VA_ARGS__)
define eprintf
#define eprintf(
...
)
[novel_fprintf](/crelude/Files/io_8h.md#function-novel_fprintf)(stderr, __VA_ARGS__)
define eprint
#define eprint(
...
)
[eprintf](/crelude/Files/io_8h.md#define-eprintf)(__VA_ARGS__)
define eprintln
#define eprintln(
...
)
[novel_fprintf_newline](/crelude/Files/io_8h.md#function-novel_fprintf_newline)(stderr, __VA_ARGS__)
define fprint
#define fprint [novel_fprintf](/crelude/Files/io_8h.md#function-novel_fprintf)
Source code
#pragma once
#include "common.h"
#define PANIC(lit, ...) \
panic("\n[**] Panicking!\n[**] CAUSE:\n -- \t%s(): " \
lit "\n[**] Aborting...\n", __func__, ## __VA_ARGS__)
#define print(...) novel_fprintf(stdout, __VA_ARGS__)
#define sprint novel_sprintf
#define println(...) novel_fprintf_newline(stdout, __VA_ARGS__)
#define eprintf(...) novel_fprintf(stderr, __VA_ARGS__)
#define eprint(...) eprintf(__VA_ARGS__)
#define eprintln(...) novel_fprintf_newline(stderr, __VA_ARGS__)
#define fprint novel_fprintf
extern ierr fput(string, FILE *);
extern ierr put(string);
extern ierr eput(string);
extern ierr eputs(const byte *);
extern string novel_vsprintf(const byte *, va_list);
extern string novel_sprintf(const byte *, ...);
extern ierr novel_vfprintf(FILE *, const byte *, va_list);
extern ierr novel_fprintf(FILE *, const byte *, ...);
extern ierr novel_vfprintf_newline(FILE *, const byte *, va_list);
extern ierr novel_fprintf_newline(FILE *, const byte *, ...);
extern ierr novel_printf(const byte *, ...);
extern usize sizeof_specifier(const byte *);
Updated on 23 August 2022 at 00:54:19 UTC