w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

utiliof.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "utilmem.h"
#include "utillog.h"
#include "utiliof.h"
Include dependency graph for utiliof.c:

Go to the source code of this file.

Classes

struct  iof_heap_ghost
 
struct  iof_heap
 
struct  file_state
 
struct  stream_state
 
union  fs_state_pointer
 

Macros

#define IOF_FILE_DEFAULTS   0
 
#define iof_file_data_resize(iofile)   iof_file_data_resizeto(iofile, iof_space(iofile) << 1)
 
#define iof_file_unsync(iofile, poffset)   ((void)poffset, (iofile)->offset = NULL)
 
#define iof_reader_reset(I)   ((I)->pos = (I)->end = (I)->buf)
 
#define iof_reader_reseek_file(I, offset, whence)   (fseek((I)->file, offset, whence) == 0 ? (iof_reader_reset(I), 0) : -1)
 
#define iof_reader_reseek_iofile(I, offset, whence)   (iof_file_seek((I)->iofile, offset, whence) == 0 ? (iof_reader_reset(I), 0) : -1)
 
#define iof_writer_reset(O)   ((O)->pos = (O)->buf)
 
#define iof_writer_reseek_file(O, offset, whence)   (iof_flush(O), (fseek((O)->file, offset, whence) == 0 ? (iof_writer_reset(O), 0) : -1))
 
#define iof_writer_reseek_iofile(O, offset, whence)   (iof_flush(O), (iof_file_seek((O)->iofile, offset, whence) == 0 ? (iof_writer_reset(O), 0) : -1))
 
#define IOF_FMT_SIZE   1024
 
#define roman1000(c)   (c == 'M' || c == 'm')
 
#define roman500(c)   (c == 'D' || c == 'd')
 
#define roman100(c)   (c == 'C' || c == 'c')
 
#define roman50(c)   (c == 'L' || c == 'l')
 
#define roman10(c)   (c == 'X' || c == 'x')
 
#define roman5(c)   (c == 'V' || c == 'v')
 
#define roman1(c)   (c == 'I' || c == 'i')
 
#define roman100s(I, c)    (roman100(c) ? (100 + ((c = iof_next(I), roman100(c)) ? (100 + ((c = iof_next(I), roman100(c)) ? (c = iof_next(I), 100) : 0)) : 0)) : 0)
 
#define roman10s(I, c)    (roman10(c) ? (10 + ((c = iof_next(I), roman10(c)) ? (10 + ((c = iof_next(I), roman10(c)) ? (c = iof_next(I), 10) : 0)) : 0)) : 0)
 
#define roman1s(I, c)    (roman1(c) ? (1 + ((c = iof_next(I), roman1(c)) ? (1 + ((c = iof_next(I), roman1(c)) ? (c = iof_next(I), 1) : 0)) : 0)) : 0)
 
#define IOF_HEAP_FILTERS_COUNT   4
 
#define IOF_BUFFER_SIZE   262144
 
#define IOF_FILTER_SIZE   1024
 
#define IOF_BUFFER_HEAP_SIZE   (IOF_HEAP_FILTERS_COUNT * (IOF_BUFFER_SIZE + sizeof(iof_heap_ghost)))
 
#define IOF_FILTER_HEAP_SIZE   (IOF_HEAP_FILTERS_COUNT * (IOF_FILTER_SIZE + sizeof(iof_heap_ghost)))
 
#define iof_heap_free(iofheap)   util_free(iofheap)
 
#define iof_heap_get(hp, ghost, data, siz)    (ghost = (hp)->gpos, ghost->heap = (hp), data = (uint8_t *)(ghost + 1), (hp)->pos += siz, (hp)->size -= siz, ++(hp)->refcount)
 
#define iof_filter_free(F)   iof_heap_back(F)
 
#define iof_filter_buffer_free(data)   iof_heap_back(data)
 
#define iof_close_next(F)   ((void)(iof_decref((F)->next), (F)->next = NULL, 0))
 
#define iof_clear_next(F)   ((void)(iof_unref((F)->next), (F)->next = NULL, 0))
 
#define iof_close_buffer(F)
 
#define file_state_init(state, off, len)   ((state)->offset = off, (state)->length = len)
 
#define stream_state_init(state, off, len)   ((state)->offset = off, (state)->length = len)
 

Typedefs

typedef struct iof_heap iof_heap
 

Functions

voidiof_copy_data (const void *data, size_t size)
 
uint8_tiof_copy_file_data (const char *filename, size_t *psize)
 
uint8_tiof_copy_file_handle_data (FILE *file, size_t *psize)
 
FILEiof_get_file (iof *F)
 
const char * iof_status_kind (iof_status status)
 
iof_fileiof_file_new (FILE *file)
 
iof_fileiof_file_init (iof_file *iofile, FILE *file)
 
iof_fileiof_file_rdata (const void *data, size_t size)
 
iof_fileiof_file_rdata_init (iof_file *iofile, const void *data, size_t size)
 
iof_fileiof_file_wdata (void *data, size_t size)
 
iof_fileiof_file_wdata_init (iof_file *iofile, void *data, size_t size)
 
iof_fileiof_file_reader_from_file_handle (iof_file *iofile, const char *filename, FILE *file, int preload, int closefile)
 
iof_fileiof_file_reader_from_file (iof_file *iofile, const char *filename, int preload)
 
iof_fileiof_file_reader_from_data (iof_file *iofile, const void *data, size_t size, int preload, int freedata)
 
int iof_file_reclose_input (iof_file *iofile)
 
int iof_file_reopen_input (iof_file *iofile)
 
void iof_file_free (iof_file *iofile)
 
void iof_file_close_input (iof_file *iofile)
 
void iof_file_set_name (iof_file *iofile, const char *name)
 
int iof_file_seek (iof_file *iofile, long offset, int whence)
 
long iof_file_tell (iof_file *iofile)
 
size_t iof_file_size (iof_file *iofile)
 
int iof_file_eof (iof_file *iofile)
 
int iof_file_flush (iof_file *iofile)
 
size_t iof_file_read (void *ptr, size_t size, size_t items, iof_file *iofile)
 
static size_t iof_file_data_resizeto (iof_file *iofile, size_t space)
 
size_t iof_file_write (const void *ptr, size_t size, size_t items, iof_file *iofile)
 
size_t iof_file_ensure (iof_file *iofile, size_t bytes)
 
int iof_file_getc (iof_file *iofile)
 
int iof_file_putc (iof_file *iofile, int c)
 
static int iof_file_sync (iof_file *iofile, size_t *offset)
 
static int iof_reader_seek_data (iof *I, long offset, int whence)
 
static int iof_reader_seek_iofile (iof *I, long offset, int whence)
 
static int iof_reader_seek_file (iof *I, long offset, int whence)
 
int iof_reader_seek (iof *I, long offset, int whence)
 
int iof_reader_reseek (iof *I, long offset, int whence)
 
static int iof_writer_seek_data (iof *O, long offset, int whence)
 
static int iof_writer_seek_iofile (iof *O, long offset, int whence)
 
static int iof_writer_seek_file (iof *O, long offset, int whence)
 
int iof_writer_seek (iof *I, long offset, int whence)
 
int iof_writer_reseek (iof *I, long offset, int whence)
 
int iof_seek (iof *F, long offset, int whence)
 
int iof_reseek (iof *F, long offset, int whence)
 
long iof_reader_tell (iof *I)
 
long iof_writer_tell (iof *O)
 
long iof_tell (iof *I)
 
size_t iof_fsize (iof *I)
 
size_t iof_save_tail (iof *I)
 
size_t iof_input_save_tail (iof *I, size_t back)
 
static size_t file_read (iof *I)
 
static size_t file_load (iof *I)
 
static size_t file_reader (iof *I, iof_mode mode)
 
iofiof_setup_file_handle_reader (iof *I, void *buffer, size_t space, FILE *f)
 
iofiof_setup_file_reader (iof *I, void *buffer, size_t space, const char *filename)
 
static size_t file_write (iof *O, int flush)
 
static size_t file_writer (iof *O, iof_mode mode)
 
iofiof_setup_file_handle_writer (iof *O, void *buffer, size_t space, FILE *f)
 
iofiof_setup_file_writer (iof *O, void *buffer, size_t space, const char *filename)
 
static size_t stdout_writer (iof *O, iof_mode mode)
 
static size_t stderr_writer (iof *O, iof_mode mode)
 
iofiof_reader (iof *I, void *link, iof_handler reader, const void *m, size_t bytes)
 
iofiof_string_reader (iof *I, const void *s, size_t bytes)
 
iofiof_writer (iof *O, void *link, iof_handler writer, void *m, size_t bytes)
 
static size_t iof_mem_handler (iof *O, iof_mode mode)
 
iofiof_setup_buffer (iof *O, void *buffer, size_t space)
 
iofiof_setup_buffermin (iof *O, void *buffer, size_t space, size_t min)
 
iofiof_buffer_create (size_t space)
 
int iof_getc (iof *I)
 
int iof_putc (iof *O, int u)
 
size_t iof_skip (iof *I, size_t bytes)
 
iof_status iof_pass (iof *I, iof *O)
 
size_t iof_read (iof *I, void *to, size_t size)
 
size_t iof_write_file_handle (iof *O, FILE *file)
 
size_t iof_write_file (iof *O, const char *filename)
 
size_t iof_write_iofile (iof *O, iof_file *iofile, int savepos)
 
size_t iof_write (iof *O, const void *data, size_t size)
 
iof_status iof_puts (iof *O, const void *data)
 
size_t iof_put_string (iof *O, const void *data)
 
size_t iof_repc (iof *O, char c, size_t bytes)
 
size_t iof_putfs (iof *O, const char *format,...)
 
int iof_get_int32 (iof *I, int32_t *number)
 
int iof_get_slong (iof *I, long *number)
 
int iof_get_int64 (iof *I, int64_t *number)
 
int iof_get_uint32 (iof *I, uint32_t *number)
 
int iof_get_ulong (iof *I, unsigned long *number)
 
int iof_get_usize (iof *I, size_t *number)
 
int iof_get_uint64 (iof *I, uint64_t *number)
 
int iof_get_int32_radix (iof *I, int32_t *number, int radix)
 
int iof_get_slong_radix (iof *I, long *number, int radix)
 
int iof_get_int64_radix (iof *I, int64_t *number, int radix)
 
int iof_get_uint32_radix (iof *I, uint32_t *number, int radix)
 
int iof_get_ulong_radix (iof *I, unsigned long *number, int radix)
 
int iof_get_usize_radix (iof *I, size_t *number, int radix)
 
int iof_get_uint64_radix (iof *I, uint64_t *number, int radix)
 
int iof_get_roman (iof *I, uint16_t *number)
 
int iof_get_double (iof *I, double *number)
 
int iof_get_float (iof *I, float *number)
 
int iof_conv_double (iof *I, double *number)
 
int iof_conv_float (iof *I, float *number)
 
size_t iof_put_int32 (iof *O, int32_t number)
 
size_t iof_put_slong (iof *O, long number)
 
size_t iof_put_int64 (iof *O, int64_t number)
 
size_t iof_put_uint32 (iof *O, uint32_t number)
 
size_t iof_put_ulong (iof *O, unsigned long number)
 
size_t iof_put_usize (iof *O, size_t number)
 
size_t iof_put_uint64 (iof *O, uint64_t number)
 
size_t iof_put_int32_radix (iof *O, int32_t number, int radix, int uc)
 
size_t iof_put_slong_radix (iof *O, long number, int radix, int uc)
 
size_t iof_put_int64_radix (iof *O, int64_t number, int radix, int uc)
 
size_t iof_put_uint32_radix (iof *O, uint32_t number, int radix, int uc)
 
size_t iof_put_ulong_radix (iof *O, unsigned long number, int radix, int uc)
 
size_t iof_put_usize_radix (iof *O, size_t number, int radix, int uc)
 
size_t iof_put_uint64_radix (iof *O, uint64_t number, int radix, int uc)
 
size_t iof_put_roman (iof *O, uint16_t number, int uc)
 
size_t iof_put_double (iof *O, double number, int digits)
 
size_t iof_put_float (iof *O, float number, int digits)
 
int iof_get_be_uint2 (iof *I, uint32_t *pnumber)
 
int iof_get_be_uint3 (iof *I, uint32_t *pnumber)
 
int iof_get_be_uint4 (iof *I, uint32_t *pnumber)
 
int iof_get_le_uint2 (iof *I, uint32_t *pnumber)
 
int iof_get_le_uint3 (iof *I, uint32_t *pnumber)
 
int iof_get_le_uint4 (iof *I, uint32_t *pnumber)
 
uint8_tiof_file_input_data (iof_file *iofile, size_t *psize, int *isnew)
 
uint8_tiof_reader_data (iof *I, size_t *psize)
 
uint8_tiof_writer_data (iof *O, size_t *psize)
 
size_t iof_reader_to_file_handle (iof *I, FILE *file)
 
size_t iof_reader_to_file (iof *I, const char *filename)
 
size_t iof_data_to_file (const void *data, size_t size, const char *filename)
 
size_t iof_result_to_file_handle (iof *F, FILE *file)
 
size_t iof_result_to_file (iof *F, const char *filename)
 
void iof_debug (iof *I, const char *filename)
 
static iof_heapiof_heap_new (size_t space)
 
void iof_filters_init (void)
 
void iof_filters_free (void)
 
static voidiof_heap_take (iof_heap **pheap, size_t size)
 
static void iof_heap_back (void *data)
 
iofiof_filter_reader_new (iof_handler handler, size_t statesize, void **pstate)
 
iofiof_filter_reader_with_buffer_new (iof_handler handler, size_t statesize, void **pstate, void *buffer, size_t buffersize)
 
iofiof_filter_writer_new (iof_handler handler, size_t statesize, void **pstate)
 
iofiof_filter_writer_with_buffer_new (iof_handler handler, size_t statesize, void **pstate, void *buffer, size_t buffersize)
 
static void iof_close_file (iof *F)
 
static void iof_close_iofile (iof *F)
 
void iof_free (iof *F)
 
void iof_discard (iof *F)
 
size_t iof_resize_buffer_to (iof *O, size_t space)
 
size_t iof_decoder_retval (iof *I, const char *type, iof_status status)
 
size_t iof_encoder_retval (iof *O, const char *type, iof_status status)
 
static size_t iofile_read (iof *I, size_t *poffset)
 
static size_t iofile_load (iof *I, size_t *poffset)
 
static size_t filter_file_reader (iof *I, iof_mode mode)
 
static size_t filter_iofile_reader (iof *I, iof_mode mode)
 
static size_t iofile_write (iof *O, size_t *poffset, int flush)
 
static size_t filter_file_writer (iof *O, iof_mode mode)
 
static size_t filter_iofile_writer (iof *O, iof_mode mode)
 
iofiof_filter_file_handle_reader (FILE *file)
 
iofiof_filter_file_handle_writer (FILE *file)
 
iofiof_filter_iofile_reader (iof_file *iofile, size_t offset)
 
iofiof_filter_iofile_writer (iof_file *iofile, size_t offset)
 
iofiof_filter_file_reader (const char *filename)
 
iofiof_filter_file_writer (const char *filename)
 
static size_t dummy_handler (iof *I, iof_mode mode)
 
iofiof_filter_string_reader (const void *s, size_t length)
 
iofiof_filter_string_writer (const void *s, size_t length)
 
iofiof_filter_buffer_writer (size_t size)
 
static size_t file_stream_read (iof *I, size_t *plength)
 
static size_t iofile_stream_read (iof *I, size_t *plength, size_t *poffset)
 
static size_t file_stream_load (iof *I, size_t *plength)
 
static size_t iofile_stream_load (iof *I, size_t *plength, size_t *poffset)
 
static size_t filter_file_stream_reader (iof *I, iof_mode mode)
 
static size_t filter_iofile_stream_reader (iof *I, iof_mode mode)
 
iofiof_filter_stream_reader (FILE *file, size_t offset, size_t length)
 
iofiof_filter_stream_coreader (iof_file *iofile, size_t offset, size_t length)
 
static size_t file_stream_write (iof *O, size_t *plength, int flush)
 
static size_t iofile_stream_write (iof *O, size_t *plength, size_t *poffset, int flush)
 
static size_t filter_file_stream_writer (iof *O, iof_mode mode)
 
static size_t filter_iofile_stream_writer (iof *O, iof_mode mode)
 
iofiof_filter_stream_writer (FILE *file)
 
iofiof_filter_stream_cowriter (iof_file *iofile, size_t offset)
 
FILEiof_filter_file_reader_source (iof *I, size_t *poffset, size_t *plength)
 
iof_fileiof_filter_file_coreader_source (iof *I, size_t *poffset, size_t *plength)
 
iofiof_filter_reader_replacement (iof *P, iof_handler handler, size_t statesize, void **pstate)
 

Variables

static uint8_t iof_stdout_buffer [BUFSIZ]
 
iof iof_stdout = { {{ (uint8_t *)( iof_stdout_buffer ), (uint8_t *)( iof_stdout_buffer ), (uint8_t *)( iof_stdout_buffer ) + BUFSIZ }}, BUFSIZ , stdout_writer , { NULL }, ( 0 )| (1<<8) , 0 }
 
static uint8_t iof_stderr_buffer [BUFSIZ]
 
iof iof_stderr = { {{ (uint8_t *)( iof_stderr_buffer ), (uint8_t *)( iof_stderr_buffer ), (uint8_t *)( iof_stderr_buffer ) + BUFSIZ }}, BUFSIZ , stderr_writer , { NULL }, ( 0 )| (1<<8) , 0 }
 
static iof_heapiof_buffers_heap = NULL
 
static iof_heapiof_filters_heap = NULL
 

Macro Definition Documentation

◆ file_state_init

#define file_state_init (   state,
  off,
  len 
)    ((state)->offset = off, (state)->length = len)

Definition at line 2369 of file utiliof.c.

◆ IOF_BUFFER_HEAP_SIZE

#define IOF_BUFFER_HEAP_SIZE   (IOF_HEAP_FILTERS_COUNT * (IOF_BUFFER_SIZE + sizeof(iof_heap_ghost)))

Definition at line 2012 of file utiliof.c.

◆ IOF_BUFFER_SIZE

#define IOF_BUFFER_SIZE   262144

Definition at line 2009 of file utiliof.c.

◆ iof_clear_next

#define iof_clear_next (   F)    ((void)(iof_unref((F)->next), (F)->next = NULL, 0))

Definition at line 2218 of file utiliof.c.

◆ iof_close_buffer

#define iof_close_buffer (   F)
Value:
((void)\
((F)->buf != NULL ? \
((F->flags & IOF_BUFFER_ALLOC) ? (util_free((F)->buf), (F)->buf = NULL, 0) : \
((F->flags & IOF_BUFFER_HEAP) ? (iof_filter_buffer_free((F)->buf), (F)->buf = NULL, 0) : ((F)->buf = NULL, 0))) : 0))
static void
Definition: fpif.c:118
#define NULL
Definition: ftobjs.h:61
#define F(x, y, z)
Definition: md5.c:51
#define buf
#define iof_filter_buffer_free(data)
Definition: utiliof.c:2212
#define IOF_BUFFER_ALLOC
Definition: utiliof.h:93
#define IOF_BUFFER_HEAP
Definition: utiliof.h:94
#define util_free
Definition: utilmem.h:14

Definition at line 2220 of file utiliof.c.

◆ iof_close_next

#define iof_close_next (   F)    ((void)(iof_decref((F)->next), (F)->next = NULL, 0))

Definition at line 2216 of file utiliof.c.

◆ iof_file_data_resize

#define iof_file_data_resize (   iofile)    iof_file_data_resizeto(iofile, iof_space(iofile) << 1)

Definition at line 460 of file utiliof.c.

◆ IOF_FILE_DEFAULTS

#define IOF_FILE_DEFAULTS   0

Definition at line 90 of file utiliof.c.

◆ iof_file_unsync

#define iof_file_unsync (   iofile,
  poffset 
)    ((void)poffset, (iofile)->offset = NULL)

Definition at line 536 of file utiliof.c.

◆ iof_filter_buffer_free

#define iof_filter_buffer_free (   data)    iof_heap_back(data)

Definition at line 2212 of file utiliof.c.

◆ iof_filter_free

#define iof_filter_free (   F)    iof_heap_back(F)

Definition at line 2211 of file utiliof.c.

◆ IOF_FILTER_HEAP_SIZE

#define IOF_FILTER_HEAP_SIZE   (IOF_HEAP_FILTERS_COUNT * (IOF_FILTER_SIZE + sizeof(iof_heap_ghost)))

Definition at line 2013 of file utiliof.c.

◆ IOF_FILTER_SIZE

#define IOF_FILTER_SIZE   1024

Definition at line 2010 of file utiliof.c.

◆ IOF_FMT_SIZE

#define IOF_FMT_SIZE   1024

Definition at line 1286 of file utiliof.c.

◆ IOF_HEAP_FILTERS_COUNT

#define IOF_HEAP_FILTERS_COUNT   4

Definition at line 2008 of file utiliof.c.

◆ iof_heap_free

#define iof_heap_free (   iofheap)    util_free(iofheap)

Definition at line 2027 of file utiliof.c.

◆ iof_heap_get

#define iof_heap_get (   hp,
  ghost,
  data,
  siz 
)     (ghost = (hp)->gpos, ghost->heap = (hp), data = (uint8_t *)(ghost + 1), (hp)->pos += siz, (hp)->size -= siz, ++(hp)->refcount)

Definition at line 2062 of file utiliof.c.

◆ iof_reader_reseek_file

#define iof_reader_reseek_file (   I,
  offset,
  whence 
)    (fseek((I)->file, offset, whence) == 0 ? (iof_reader_reset(I), 0) : -1)

Definition at line 541 of file utiliof.c.

◆ iof_reader_reseek_iofile

#define iof_reader_reseek_iofile (   I,
  offset,
  whence 
)    (iof_file_seek((I)->iofile, offset, whence) == 0 ? (iof_reader_reset(I), 0) : -1)

Definition at line 542 of file utiliof.c.

◆ iof_reader_reset

#define iof_reader_reset (   I)    ((I)->pos = (I)->end = (I)->buf)

Definition at line 540 of file utiliof.c.

◆ iof_writer_reseek_file

#define iof_writer_reseek_file (   O,
  offset,
  whence 
)    (iof_flush(O), (fseek((O)->file, offset, whence) == 0 ? (iof_writer_reset(O), 0) : -1))

Definition at line 545 of file utiliof.c.

◆ iof_writer_reseek_iofile

#define iof_writer_reseek_iofile (   O,
  offset,
  whence 
)    (iof_flush(O), (iof_file_seek((O)->iofile, offset, whence) == 0 ? (iof_writer_reset(O), 0) : -1))

Definition at line 546 of file utiliof.c.

◆ iof_writer_reset

#define iof_writer_reset (   O)    ((O)->pos = (O)->buf)

Definition at line 544 of file utiliof.c.

◆ roman1

#define roman1 (   c)    (c == 'I' || c == 'i')

Definition at line 1442 of file utiliof.c.

◆ roman10

#define roman10 (   c)    (c == 'X' || c == 'x')

Definition at line 1440 of file utiliof.c.

◆ roman100

#define roman100 (   c)    (c == 'C' || c == 'c')

Definition at line 1438 of file utiliof.c.

◆ roman1000

#define roman1000 (   c)    (c == 'M' || c == 'm')

Definition at line 1436 of file utiliof.c.

◆ roman100s

#define roman100s (   I,
  c 
)     (roman100(c) ? (100 + ((c = iof_next(I), roman100(c)) ? (100 + ((c = iof_next(I), roman100(c)) ? (c = iof_next(I), 100) : 0)) : 0)) : 0)

Definition at line 1444 of file utiliof.c.

◆ roman10s

#define roman10s (   I,
  c 
)     (roman10(c) ? (10 + ((c = iof_next(I), roman10(c)) ? (10 + ((c = iof_next(I), roman10(c)) ? (c = iof_next(I), 10) : 0)) : 0)) : 0)

Definition at line 1446 of file utiliof.c.

◆ roman1s

#define roman1s (   I,
  c 
)     (roman1(c) ? (1 + ((c = iof_next(I), roman1(c)) ? (1 + ((c = iof_next(I), roman1(c)) ? (c = iof_next(I), 1) : 0)) : 0)) : 0)

Definition at line 1448 of file utiliof.c.

◆ roman5

#define roman5 (   c)    (c == 'V' || c == 'v')

Definition at line 1441 of file utiliof.c.

◆ roman50

#define roman50 (   c)    (c == 'L' || c == 'l')

Definition at line 1439 of file utiliof.c.

◆ roman500

#define roman500 (   c)    (c == 'D' || c == 'd')

Definition at line 1437 of file utiliof.c.

◆ stream_state_init

#define stream_state_init (   state,
  off,
  len 
)    ((state)->offset = off, (state)->length = len)

Definition at line 2376 of file utiliof.c.

Typedef Documentation

◆ iof_heap

typedef struct iof_heap iof_heap

Definition at line 1947 of file utiliof.c.

Function Documentation

◆ dummy_handler()

static size_t dummy_handler ( iof I,
iof_mode  mode 
)
static

Definition at line 2634 of file utiliof.c.

References I, iof_free(), IOFCLOSE, and mode.

Referenced by iof_filter_string_reader(), and iof_filter_string_writer().

◆ file_load()

static size_t file_load ( iof I)
static

Definition at line 2414 of file utiliof.c.

References bytes, fread, I, iof_loaded, iof_resize_buffer, IOF_STOPPED, iof_tail, and tail.

Referenced by file_reader(), and filter_file_reader().

◆ file_read()

static size_t file_read ( iof I)
static

Definition at line 2384 of file utiliof.c.

References bytes, fread, I, IOF_STOPPED, iof_tail, and tail.

Referenced by file_reader(), filter_file_reader(), and open_vf_file().

◆ file_reader()

static size_t file_reader ( iof I,
iof_mode  mode 
)
static

Definition at line 826 of file utiliof.c.

References file_load(), file_read(), I, iof_free(), IOFCLOSE, IOFLOAD, IOFREAD, and mode.

Referenced by iof_setup_file_handle_reader(), and iof_setup_file_reader().

◆ file_stream_load()

static size_t file_stream_load ( iof I,
size_t plength 
)
static

Definition at line 2731 of file utiliof.c.

References bytes, fread, I, iof_resize_buffer_to(), IOF_STOPPED, iof_tail, and tail.

Referenced by filter_file_stream_reader().

◆ file_stream_read()

static size_t file_stream_read ( iof I,
size_t plength 
)
static

Definition at line 2685 of file utiliof.c.

References bytes, fread, I, IOF_STOPPED, iof_tail, and tail.

Referenced by filter_file_stream_reader().

◆ file_stream_write()

static size_t file_stream_write ( iof O,
size_t plength,
int  flush 
)
static

Definition at line 2826 of file utiliof.c.

References bytes, fflush, flush(), fwrite(), iof_size, and O.

Referenced by filter_file_stream_writer().

◆ file_write()

static size_t file_write ( iof O,
int  flush 
)
static

Definition at line 2484 of file utiliof.c.

References bytes, fflush, flush(), fwrite(), iof_size, and O.

Referenced by file_writer(), and filter_file_writer().

◆ file_writer()

static size_t file_writer ( iof O,
iof_mode  mode 
)
static

Definition at line 866 of file utiliof.c.

References file_write(), iof_free(), IOFCLOSE, IOFFLUSH, IOFWRITE, mode, and O.

Referenced by iof_setup_file_handle_writer(), and iof_setup_file_writer().

◆ filter_file_reader()

static size_t filter_file_reader ( iof I,
iof_mode  mode 
)
static

◆ filter_file_stream_reader()

static size_t filter_file_stream_reader ( iof I,
iof_mode  mode 
)
static

◆ filter_file_stream_writer()

static size_t filter_file_stream_writer ( iof O,
iof_mode  mode 
)
static

Definition at line 2866 of file utiliof.c.

References file_stream_write(), iof_filter_state, iof_free(), IOFCLOSE, IOFFLUSH, IOFWRITE, mode, O, and state.

Referenced by iof_filter_stream_writer().

◆ filter_file_writer()

static size_t filter_file_writer ( iof O,
iof_mode  mode 
)
static

Definition at line 2516 of file utiliof.c.

References file_write(), iof_free(), IOFCLOSE, IOFFLUSH, IOFWRITE, mode, and O.

Referenced by iof_filter_file_handle_writer(), and iof_filter_file_writer().

◆ filter_iofile_reader()

static size_t filter_iofile_reader ( iof I,
iof_mode  mode 
)
static

◆ filter_iofile_stream_reader()

static size_t filter_iofile_stream_reader ( iof I,
iof_mode  mode 
)
static

◆ filter_iofile_stream_writer()

static size_t filter_iofile_stream_writer ( iof O,
iof_mode  mode 
)
static

◆ filter_iofile_writer()

static size_t filter_iofile_writer ( iof O,
iof_mode  mode 
)
static

Definition at line 2533 of file utiliof.c.

References iof_filter_state, iof_free(), IOFCLOSE, IOFFLUSH, iofile_write(), IOFWRITE, mode, O, and state.

Referenced by iof_filter_iofile_writer().

◆ iof_buffer_create()

iof* iof_buffer_create ( size_t  space)

Definition at line 1045 of file utiliof.c.

References buffer, IOF_ALLOC, iof_setup_buffer(), O, space, and util_malloc().

◆ iof_close_file()

static void iof_close_file ( iof F)
static

Definition at line 2227 of file utiliof.c.

References F, fclose, FILE, file, IOF_CLOSE_FILE, and NULL.

Referenced by iof_discard(), and iof_free().

◆ iof_close_iofile()

static void iof_close_iofile ( iof F)
static

Definition at line 2246 of file utiliof.c.

References F, iof_file_decref, iof_file_reclose, iof_file_unsync, and NULL.

Referenced by iof_discard(), and iof_free().

◆ iof_conv_double()

int iof_conv_double ( iof I,
double *  number 
)

◆ iof_conv_float()

int iof_conv_float ( iof I,
float *  number 
)

◆ iof_copy_data()

void* iof_copy_data ( const void data,
size_t  size 
)

Definition at line 18 of file utiliof.c.

References data, memcpy, size, and util_malloc().

Referenced by iof_file_reader_from_data(), and iof_file_set_name().

◆ iof_copy_file_data()

uint8_t* iof_copy_file_data ( const char *  filename,
size_t psize 
)

Definition at line 23 of file utiliof.c.

References data, fclose, FILE, file, filename, fopen, fread, fseek, ftell, NULL, SEEK_END, SEEK_SET, size, size_t, util_free, and util_malloc().

Referenced by main().

◆ iof_copy_file_handle_data()

uint8_t* iof_copy_file_handle_data ( FILE file,
size_t psize 
)

◆ iof_data_to_file()

size_t iof_data_to_file ( const void data,
size_t  size,
const char *  filename 
)

Definition at line 1920 of file utiliof.c.

References data, fclose, FILE, filename, fopen, fwrite(), NULL, and size.

Referenced by iof_result_to_file().

◆ iof_debug()

void iof_debug ( iof I,
const char *  filename 
)

Definition at line 1947 of file utiliof.c.

References fclose, FILE, filename, fopen, fprintf, fwrite(), I, iof_left, iof_size, iof_space, and NULL.

◆ iof_decoder_retval()

◆ iof_discard()

◆ iof_encoder_retval()

◆ iof_file_close_input()

◆ iof_file_data_resizeto()

static size_t iof_file_data_resizeto ( iof_file iofile,
size_t  space 
)
static

◆ iof_file_ensure()

size_t iof_file_ensure ( iof_file iofile,
size_t  bytes 
)

◆ iof_file_eof()

int iof_file_eof ( iof_file iofile)

Definition at line 410 of file utiliof.c.

References iof_file::end, feof, iof_file::flags, IOF_DATA, iof_file_get_fh, and iof_file::pos.

◆ iof_file_flush()

int iof_file_flush ( iof_file iofile)

Definition at line 417 of file utiliof.c.

References fflush, iof_file::flags, IOF_DATA, and iof_file_get_fh.

Referenced by iofile_stream_write(), and iofile_write().

◆ iof_file_free()

◆ iof_file_getc()

int iof_file_getc ( iof_file iofile)

Definition at line 502 of file utiliof.c.

References iof_file::end, fgetc, iof_file::flags, IOF_DATA, iof_file_get_fh, IOFEOF, and iof_file::pos.

Referenced by ppdoc_tail().

◆ iof_file_init()

◆ iof_file_input_data()

uint8_t* iof_file_input_data ( iof_file iofile,
size_t psize,
int isnew 
)

◆ iof_file_new()

◆ iof_file_putc()

int iof_file_putc ( iof_file iofile,
int  c 
)

◆ iof_file_rdata()

◆ iof_file_rdata_init()

◆ iof_file_read()

size_t iof_file_read ( void ptr,
size_t  size,
size_t  items,
iof_file iofile 
)

◆ iof_file_reader_from_data()

iof_file* iof_file_reader_from_data ( iof_file iofile,
const void data,
size_t  size,
int  preload,
int  freedata 
)

◆ iof_file_reader_from_file()

iof_file* iof_file_reader_from_file ( iof_file iofile,
const char *  filename,
int  preload 
)

Definition at line 187 of file utiliof.c.

References FILE, file, filename, fopen, iof_file_reader_from_file_handle(), NULL, and preload.

◆ iof_file_reader_from_file_handle()

iof_file* iof_file_reader_from_file_handle ( iof_file iofile,
const char *  filename,
FILE file,
int  preload,
int  closefile 
)

◆ iof_file_reclose_input()

int iof_file_reclose_input ( iof_file iofile)

◆ iof_file_reopen_input()

int iof_file_reopen_input ( iof_file iofile)

◆ iof_file_seek()

int iof_file_seek ( iof_file iofile,
long  offset,
int  whence 
)

◆ iof_file_set_name()

void iof_file_set_name ( iof_file iofile,
const char *  name 
)

◆ iof_file_size()

size_t iof_file_size ( iof_file iofile)

Definition at line 396 of file utiliof.c.

References FILE, file, iof_file::flags, fseek, ftell, IOF_DATA, iof_file_get_fh, iof_space, pos, SEEK_END, SEEK_SET, and size.

Referenced by iof_fsize().

◆ iof_file_sync()

static int iof_file_sync ( iof_file iofile,
size_t offset 
)
static

◆ iof_file_tell()

◆ iof_file_wdata()

iof_file* iof_file_wdata ( void data,
size_t  size 
)

Definition at line 140 of file utiliof.c.

References data, iof_file_rdata(), and size.

◆ iof_file_wdata_init()

iof_file* iof_file_wdata_init ( iof_file iofile,
void data,
size_t  size 
)

Definition at line 145 of file utiliof.c.

References data, iof_file_rdata_init(), and size.

◆ iof_file_write()

size_t iof_file_write ( const void ptr,
size_t  size,
size_t  items,
iof_file iofile 
)

◆ iof_filter_buffer_writer()

iof* iof_filter_buffer_writer ( size_t  size)

◆ iof_filter_file_coreader_source()

iof_file* iof_filter_file_coreader_source ( iof I,
size_t poffset,
size_t plength 
)

Definition at line 2946 of file utiliof.c.

References filter_iofile_reader(), filter_iofile_stream_reader(), I, iof_filter_state, NULL, and P.

◆ iof_filter_file_handle_reader()

iof* iof_filter_file_handle_reader ( FILE file)

Definition at line 2554 of file utiliof.c.

References file_state_init, filter_file_reader(), I, iof_filter_reader, iof_setup_file, NULL, and P.

◆ iof_filter_file_handle_writer()

iof* iof_filter_file_handle_writer ( FILE file)

Definition at line 2566 of file utiliof.c.

References file_state_init, filter_file_writer(), iof_filter_writer, iof_setup_file, NULL, O, and P.

◆ iof_filter_file_reader()

iof* iof_filter_file_reader ( const char *  filename)

◆ iof_filter_file_reader_source()

FILE* iof_filter_file_reader_source ( iof I,
size_t poffset,
size_t plength 
)

Definition at line 2926 of file utiliof.c.

References filter_file_reader(), filter_file_stream_reader(), I, iof_filter_state, NULL, and P.

◆ iof_filter_file_writer()

iof* iof_filter_file_writer ( const char *  filename)

◆ iof_filter_iofile_reader()

iof* iof_filter_iofile_reader ( iof_file iofile,
size_t  offset 
)

◆ iof_filter_iofile_writer()

iof* iof_filter_iofile_writer ( iof_file iofile,
size_t  offset 
)

◆ iof_filter_reader_new()

iof* iof_filter_reader_new ( iof_handler  handler,
size_t  statesize,
void **  pstate 
)

◆ iof_filter_reader_replacement()

iof* iof_filter_reader_replacement ( iof P,
iof_handler  handler,
size_t  statesize,
void **  pstate 
)

Definition at line 2966 of file utiliof.c.

References F, IOF_BUFFER_HEAP, iof_filter_free, iof_filter_reader_with_buffer, and P.

◆ iof_filter_reader_with_buffer_new()

iof* iof_filter_reader_with_buffer_new ( iof_handler  handler,
size_t  statesize,
void **  pstate,
void buffer,
size_t  buffersize 
)

◆ iof_filter_stream_coreader()

iof* iof_filter_stream_coreader ( iof_file iofile,
size_t  offset,
size_t  length 
)

◆ iof_filter_stream_cowriter()

iof* iof_filter_stream_cowriter ( iof_file iofile,
size_t  offset 
)

◆ iof_filter_stream_reader()

iof* iof_filter_stream_reader ( FILE file,
size_t  offset,
size_t  length 
)

◆ iof_filter_stream_writer()

iof* iof_filter_stream_writer ( FILE file)

◆ iof_filter_string_reader()

iof* iof_filter_string_reader ( const void s,
size_t  length 
)

Definition at line 2646 of file utiliof.c.

References dummy, dummy_handler(), I, iof_filter_reader_with_buffer, length, NULL, and s.

◆ iof_filter_string_writer()

iof* iof_filter_string_writer ( const void s,
size_t  length 
)

Definition at line 2657 of file utiliof.c.

References dummy, dummy_handler(), iof_filter_reader_with_buffer, length, NULL, O, and s.

◆ iof_filter_writer_new()

iof* iof_filter_writer_new ( iof_handler  handler,
size_t  statesize,
void **  pstate 
)

◆ iof_filter_writer_with_buffer_new()

iof* iof_filter_writer_with_buffer_new ( iof_handler  handler,
size_t  statesize,
void **  pstate,
void buffer,
size_t  buffersize 
)

◆ iof_filters_free()

void iof_filters_free ( void  )

◆ iof_filters_init()

◆ iof_free()

◆ iof_fsize()

size_t iof_fsize ( iof I)

Definition at line 777 of file utiliof.c.

References fseek, ftell, I, IOF_FILE, IOF_FILE_HANDLE, iof_file_size(), iof_space, pos, SEEK_END, SEEK_SET, size, and size_t.

◆ iof_get_be_uint2()

int iof_get_be_uint2 ( iof I,
uint32_t pnumber 
)

Definition at line 1747 of file utiliof.c.

References c1, c2, I, and iof_get.

◆ iof_get_be_uint3()

int iof_get_be_uint3 ( iof I,
uint32_t pnumber 
)

Definition at line 1756 of file utiliof.c.

References c1, c2, I, and iof_get.

◆ iof_get_be_uint4()

int iof_get_be_uint4 ( iof I,
uint32_t pnumber 
)

Definition at line 1765 of file utiliof.c.

References c1, c2, I, and iof_get.

◆ iof_get_double()

int iof_get_double ( iof I,
double *  number 
)

◆ iof_get_file()

FILE* iof_get_file ( iof F)

Definition at line 61 of file utiliof.c.

References F, IOF_FILE, iof_file_get_file, IOF_FILE_HANDLE, and NULL.

◆ iof_get_float()

int iof_get_float ( iof I,
float *  number 
)

◆ iof_get_int32()

int iof_get_int32 ( iof I,
int32_t number 
)

Definition at line 1307 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_integer, iof_scan_sign, number, and sign.

◆ iof_get_int32_radix()

int iof_get_int32_radix ( iof I,
int32_t number,
int  radix 
)

Definition at line 1369 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, iof_scan_sign, number, radix, and sign.

◆ iof_get_int64()

int iof_get_int64 ( iof I,
int64_t number 
)

Definition at line 1327 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_integer, iof_scan_sign, number, and sign.

◆ iof_get_int64_radix()

int iof_get_int64_radix ( iof I,
int64_t number,
int  radix 
)

Definition at line 1390 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, iof_scan_sign, number, radix, and sign.

◆ iof_get_le_uint2()

int iof_get_le_uint2 ( iof I,
uint32_t pnumber 
)

Definition at line 1774 of file utiliof.c.

References c1, c2, I, and iof_get.

◆ iof_get_le_uint3()

int iof_get_le_uint3 ( iof I,
uint32_t pnumber 
)

Definition at line 1783 of file utiliof.c.

References c1, c2, I, and iof_get.

◆ iof_get_le_uint4()

int iof_get_le_uint4 ( iof I,
uint32_t pnumber 
)

Definition at line 1792 of file utiliof.c.

References c1, c2, I, and iof_get.

◆ iof_get_roman()

int iof_get_roman ( iof I,
uint16_t number 
)

Definition at line 1451 of file utiliof.c.

References c, I, iof_char, iof_next, roman1, roman10, roman100, roman1000, roman100s, roman10s, roman1s, roman5, roman50, and roman500.

◆ iof_get_slong()

int iof_get_slong ( iof I,
long *  number 
)

Definition at line 1317 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_integer, iof_scan_sign, number, and sign.

◆ iof_get_slong_radix()

int iof_get_slong_radix ( iof I,
long *  number,
int  radix 
)

Definition at line 1380 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, iof_scan_sign, number, radix, and sign.

◆ iof_get_uint32()

int iof_get_uint32 ( iof I,
uint32_t number 
)

Definition at line 1337 of file utiliof.c.

References base10_digit, c, I, iof_char, and iof_read_integer.

◆ iof_get_uint32_radix()

int iof_get_uint32_radix ( iof I,
uint32_t number,
int  radix 
)

Definition at line 1400 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, and radix.

◆ iof_get_uint64()

int iof_get_uint64 ( iof I,
uint64_t number 
)

Definition at line 1361 of file utiliof.c.

References base10_digit, c, I, iof_char, and iof_read_integer.

◆ iof_get_uint64_radix()

int iof_get_uint64_radix ( iof I,
uint64_t number,
int  radix 
)

Definition at line 1424 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, and radix.

◆ iof_get_ulong()

int iof_get_ulong ( iof I,
unsigned long *  number 
)

Definition at line 1345 of file utiliof.c.

References base10_digit, c, I, iof_char, and iof_read_integer.

◆ iof_get_ulong_radix()

int iof_get_ulong_radix ( iof I,
unsigned long *  number,
int  radix 
)

Definition at line 1408 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, and radix.

◆ iof_get_usize()

int iof_get_usize ( iof I,
size_t number 
)

Definition at line 1353 of file utiliof.c.

References base10_digit, c, I, iof_char, and iof_read_integer.

◆ iof_get_usize_radix()

int iof_get_usize_radix ( iof I,
size_t number,
int  radix 
)

Definition at line 1416 of file utiliof.c.

References base10_digit, c, I, iof_char, iof_read_radix, and radix.

◆ iof_getc()

int iof_getc ( iof I)

Definition at line 1058 of file utiliof.c.

References I, iof_readable, and IOFEOF.

◆ iof_heap_back()

◆ iof_heap_new()

◆ iof_heap_take()

◆ iof_input_save_tail()

size_t iof_input_save_tail ( iof I,
size_t  back 
)

Definition at line 808 of file utiliof.c.

References back, I, iof_input, IOF_TAIL, and size.

◆ iof_mem_handler()

static size_t iof_mem_handler ( iof O,
iof_mode  mode 
)
static

Definition at line 1010 of file utiliof.c.

References iof_free(), iof_resize_buffer, IOFCLOSE, IOFWRITE, mode, and O.

Referenced by iof_filter_buffer_writer(), and iof_setup_buffer().

◆ iof_pass()

iof_status iof_pass ( iof I,
iof O 
)

Definition at line 1090 of file utiliof.c.

References I, iof_input, iof_left, iof_output, IOFEOF, IOFFULL, memcpy, and O.

◆ iof_put_double()

size_t iof_put_double ( iof O,
double  number,
int  digits 
)

Definition at line 1729 of file utiliof.c.

References digits, double_to_string, iof_write(), O, s, and size.

◆ iof_put_float()

size_t iof_put_float ( iof O,
float  number,
int  digits 
)

Definition at line 1737 of file utiliof.c.

References digits, float_to_string, iof_write(), O, s, and size.

◆ iof_put_int32()

size_t iof_put_int32 ( iof O,
int32_t  number 
)

Definition at line 1605 of file utiliof.c.

References int32_to_string, iof_write(), O, s, and size.

◆ iof_put_int32_radix()

size_t iof_put_int32_radix ( iof O,
int32_t  number,
int  radix,
int  uc 
)

Definition at line 1661 of file utiliof.c.

References int32_to_radix, iof_write(), O, radix, s, and size.

◆ iof_put_int64()

size_t iof_put_int64 ( iof O,
int64_t  number 
)

Definition at line 1621 of file utiliof.c.

References int64_to_string, iof_write(), O, s, and size.

◆ iof_put_int64_radix()

size_t iof_put_int64_radix ( iof O,
int64_t  number,
int  radix,
int  uc 
)

Definition at line 1677 of file utiliof.c.

References int64_to_radix, iof_write(), O, radix, s, and size.

◆ iof_put_roman()

size_t iof_put_roman ( iof O,
uint16_t  number,
int  uc 
)

Definition at line 1719 of file utiliof.c.

References iof_write(), O, s, size, and uint16_to_roman.

◆ iof_put_slong()

size_t iof_put_slong ( iof O,
long  number 
)

Definition at line 1613 of file utiliof.c.

References iof_write(), O, s, size, and slong_to_string.

◆ iof_put_slong_radix()

size_t iof_put_slong_radix ( iof O,
long  number,
int  radix,
int  uc 
)

Definition at line 1669 of file utiliof.c.

References iof_write(), O, radix, s, size, and slong_to_radix.

◆ iof_put_string()

size_t iof_put_string ( iof O,
const void data 
)

Definition at line 1238 of file utiliof.c.

References data, iof_set, iof_writable, O, p, and s.

Referenced by iof_putfs().

◆ iof_put_uint32()

size_t iof_put_uint32 ( iof O,
uint32_t  number 
)

Definition at line 1629 of file utiliof.c.

References iof_write(), O, s, size, and uint32_to_string.

◆ iof_put_uint32_radix()

size_t iof_put_uint32_radix ( iof O,
uint32_t  number,
int  radix,
int  uc 
)

Definition at line 1685 of file utiliof.c.

References iof_write(), O, radix, s, size, and uint32_to_radix.

◆ iof_put_uint64()

size_t iof_put_uint64 ( iof O,
uint64_t  number 
)

Definition at line 1653 of file utiliof.c.

References iof_write(), O, s, size, and uint64_to_string.

◆ iof_put_uint64_radix()

size_t iof_put_uint64_radix ( iof O,
uint64_t  number,
int  radix,
int  uc 
)

Definition at line 1709 of file utiliof.c.

References iof_write(), O, radix, s, size, and uint64_to_radix.

◆ iof_put_ulong()

size_t iof_put_ulong ( iof O,
unsigned long  number 
)

Definition at line 1637 of file utiliof.c.

References iof_write(), O, s, size, and ulong_to_string.

◆ iof_put_ulong_radix()

size_t iof_put_ulong_radix ( iof O,
unsigned long  number,
int  radix,
int  uc 
)

Definition at line 1693 of file utiliof.c.

References iof_write(), O, radix, s, size, and ulong_to_radix.

◆ iof_put_usize()

size_t iof_put_usize ( iof O,
size_t  number 
)

Definition at line 1645 of file utiliof.c.

References iof_write(), O, s, size, and usize_to_string.

◆ iof_put_usize_radix()

size_t iof_put_usize_radix ( iof O,
size_t  number,
int  radix,
int  uc 
)

Definition at line 1701 of file utiliof.c.

References iof_write(), O, radix, s, size, and usize_to_radix.

◆ iof_putc()

int iof_putc ( iof O,
int  u 
)

Definition at line 1065 of file utiliof.c.

References iof_set, iof_writable, IOFFULL, O, and u.

◆ iof_putfs()

size_t iof_putfs ( iof O,
const char *  format,
  ... 
)

Definition at line 1288 of file utiliof.c.

References args, format, IOF_FMT_SIZE, iof_put_string(), iof_write(), O, va_end, va_start, and vsnprintf.

◆ iof_puts()

iof_status iof_puts ( iof O,
const void data 
)

Definition at line 1225 of file utiliof.c.

References data, iof_set, iof_writable, IOFEOF, IOFFULL, O, and s.

◆ iof_read()

size_t iof_read ( iof I,
void to,
size_t  size 
)

Definition at line 1122 of file utiliof.c.

References I, iof_input, iof_left, memcpy, s, size, and to.

Referenced by ppxref_load_stream(), and ppxref_load_table().

◆ iof_reader()

iof* iof_reader ( iof I,
void link,
iof_handler  reader,
const void m,
size_t  bytes 
)

Definition at line 961 of file utiliof.c.

References bytes, I, link, m, NULL, and reader().

◆ iof_reader_data()

uint8_t* iof_reader_data ( iof I,
size_t psize 
)

Definition at line 1859 of file utiliof.c.

References data, I, IOF_BUFFER_ALLOC, iof_close, iof_left, memcpy, NULL, size_t, and util_malloc().

◆ iof_reader_reseek()

int iof_reader_reseek ( iof I,
long  offset,
int  whence 
)

◆ iof_reader_seek()

int iof_reader_seek ( iof I,
long  offset,
int  whence 
)

◆ iof_reader_seek_data()

static int iof_reader_seek_data ( iof I,
long  offset,
int  whence 
)
static

Definition at line 548 of file utiliof.c.

References end, I, offset, pos, SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by iof_reader_reseek(), iof_reader_seek(), and iof_writer_seek_data().

◆ iof_reader_seek_file()

static int iof_reader_seek_file ( iof I,
long  offset,
int  whence 
)
static

Definition at line 603 of file utiliof.c.

References end, ftell, I, iof_reader_reseek_file, iof_space, offset, pos, SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by iof_reader_seek().

◆ iof_reader_seek_iofile()

static int iof_reader_seek_iofile ( iof I,
long  offset,
int  whence 
)
static

Definition at line 577 of file utiliof.c.

References end, I, iof_file_tell(), iof_reader_reseek_iofile, iof_space, offset, pos, SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by iof_reader_seek().

◆ iof_reader_tell()

long iof_reader_tell ( iof I)

Definition at line 752 of file utiliof.c.

References ftell, I, IOF_FILE, IOF_FILE_HANDLE, iof_file_tell(), iof_left, and iof_size.

Referenced by iof_tell().

◆ iof_reader_to_file()

size_t iof_reader_to_file ( iof I,
const char *  filename 
)

Definition at line 1906 of file utiliof.c.

References fclose, FILE, file, filename, fopen, fwrite(), I, iof_left, iof_readable, NULL, and size.

◆ iof_reader_to_file_handle()

size_t iof_reader_to_file_handle ( iof I,
FILE file 
)

Definition at line 1898 of file utiliof.c.

References file, fwrite(), I, iof_left, iof_readable, and size.

◆ iof_repc()

size_t iof_repc ( iof O,
char  c,
size_t  bytes 
)

Definition at line 1262 of file utiliof.c.

References bytes, c, iof_left, iof_output, memset(), and O.

◆ iof_reseek()

int iof_reseek ( iof F,
long  offset,
int  whence 
)

Definition at line 745 of file utiliof.c.

References F, iof_reader_reseek(), IOF_WRITER, iof_writer_reseek(), and offset.

◆ iof_resize_buffer_to()

size_t iof_resize_buffer_to ( iof O,
size_t  space 
)

◆ iof_result_to_file()

size_t iof_result_to_file ( iof F,
const char *  filename 
)

Definition at line 1939 of file utiliof.c.

References data, F, filename, iof_data_to_file(), iof_result, and size.

◆ iof_result_to_file_handle()

size_t iof_result_to_file_handle ( iof F,
FILE file 
)

Definition at line 1931 of file utiliof.c.

References data, F, iof_data_to_file_handle, iof_result, and size.

◆ iof_save_tail()

size_t iof_save_tail ( iof I)

Definition at line 796 of file utiliof.c.

References I, iof_left, iof_size, memcpy, memmove, and size.

◆ iof_seek()

int iof_seek ( iof F,
long  offset,
int  whence 
)

Definition at line 740 of file utiliof.c.

References F, iof_reader_seek(), IOF_WRITER, iof_writer_seek(), and offset.

◆ iof_setup_buffer()

iof* iof_setup_buffer ( iof O,
void buffer,
size_t  space 
)

Definition at line 1024 of file utiliof.c.

References IOF_DATA, iof_mem_handler(), iof_setup_writer, NULL, O, and space.

Referenced by iof_buffer_create(), and iof_setup_buffermin().

◆ iof_setup_buffermin()

iof* iof_setup_buffermin ( iof O,
void buffer,
size_t  space,
size_t  min 
)

Definition at line 1033 of file utiliof.c.

References IOF_BUFFER_ALLOC, iof_setup_buffer(), min, O, space, and util_malloc().

◆ iof_setup_file_handle_reader()

iof* iof_setup_file_handle_reader ( iof I,
void buffer,
size_t  space,
FILE f 
)

Definition at line 842 of file utiliof.c.

References f, file_reader(), I, iof_setup_file, iof_setup_reader, and space.

Referenced by ppdoc_reader_init().

◆ iof_setup_file_handle_writer()

iof* iof_setup_file_handle_writer ( iof O,
void buffer,
size_t  space,
FILE f 
)

Definition at line 883 of file utiliof.c.

References f, file_writer(), iof_setup_file, iof_setup_writer, O, and space.

◆ iof_setup_file_reader()

iof* iof_setup_file_reader ( iof I,
void buffer,
size_t  space,
const char *  filename 
)

Definition at line 850 of file utiliof.c.

References f, FILE, file_reader(), filename, fopen, I, IOF_CLOSE_FILE, iof_setup_file, iof_setup_reader, NULL, and space.

◆ iof_setup_file_writer()

iof* iof_setup_file_writer ( iof O,
void buffer,
size_t  space,
const char *  filename 
)

Definition at line 891 of file utiliof.c.

References f, FILE, file_writer(), filename, fopen, IOF_CLOSE_FILE, iof_setup_file, iof_setup_writer, NULL, O, and space.

◆ iof_skip()

size_t iof_skip ( iof I,
size_t  bytes 
)

Definition at line 1075 of file utiliof.c.

References bytes, I, and iof_readable.

◆ iof_status_kind()

const char* iof_status_kind ( iof_status  status)

Definition at line 70 of file utiliof.c.

References IOFEMPTY, IOFEOF, IOFERR, IOFFULL, and status.

Referenced by iof_decoder_retval(), and iof_encoder_retval().

◆ iof_string_reader()

iof* iof_string_reader ( iof I,
const void s,
size_t  bytes 
)

Definition at line 977 of file utiliof.c.

References bytes, I, iof_string, NULL, and s.

Referenced by ppdoc_reader_init(), and ppscan_base85().

◆ iof_tell()

long iof_tell ( iof I)

Definition at line 772 of file utiliof.c.

References I, iof_reader_tell(), IOF_WRITER, and iof_writer_tell().

◆ iof_write()

◆ iof_write_file()

size_t iof_write_file ( iof O,
const char *  filename 
)

Definition at line 1166 of file utiliof.c.

References fclose, FILE, file, filename, fopen, iof_write_file_handle(), NULL, O, and size.

◆ iof_write_file_handle()

size_t iof_write_file_handle ( iof O,
FILE file 
)

Definition at line 1151 of file utiliof.c.

References fread, iof_left, iof_output, O, and size.

Referenced by iof_write_file(), and iof_write_iofile().

◆ iof_write_iofile()

size_t iof_write_iofile ( iof O,
iof_file iofile,
int  savepos 
)

◆ iof_writer()

iof* iof_writer ( iof O,
void link,
iof_handler  writer,
void m,
size_t  bytes 
)

Definition at line 991 of file utiliof.c.

References bytes, link, m, NULL, O, and writer().

◆ iof_writer_data()

uint8_t* iof_writer_data ( iof O,
size_t psize 
)

Definition at line 1879 of file utiliof.c.

References data, IOF_BUFFER_ALLOC, iof_close, iof_size, memcpy, NULL, O, size_t, and util_malloc().

◆ iof_writer_reseek()

int iof_writer_reseek ( iof I,
long  offset,
int  whence 
)

◆ iof_writer_seek()

int iof_writer_seek ( iof I,
long  offset,
int  whence 
)

◆ iof_writer_seek_data()

static int iof_writer_seek_data ( iof O,
long  offset,
int  whence 
)
static

Definition at line 653 of file utiliof.c.

References iof_reader_seek_data(), O, and offset.

Referenced by iof_writer_reseek(), and iof_writer_seek().

◆ iof_writer_seek_file()

static int iof_writer_seek_file ( iof O,
long  offset,
int  whence 
)
static

Definition at line 690 of file utiliof.c.

References end, ftell, iof_space, iof_writer_reseek_file, O, offset, pos, SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by iof_writer_seek().

◆ iof_writer_seek_iofile()

static int iof_writer_seek_iofile ( iof O,
long  offset,
int  whence 
)
static

Definition at line 664 of file utiliof.c.

References end, iof_file_tell(), iof_space, iof_writer_reseek_iofile, O, offset, pos, SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by iof_writer_seek().

◆ iof_writer_tell()

long iof_writer_tell ( iof O)

Definition at line 762 of file utiliof.c.

References ftell, IOF_FILE, IOF_FILE_HANDLE, iof_file_tell(), iof_size, and O.

Referenced by iof_tell().

◆ iofile_load()

static size_t iofile_load ( iof I,
size_t poffset 
)
static

◆ iofile_read()

static size_t iofile_read ( iof I,
size_t poffset 
)
static

Definition at line 2397 of file utiliof.c.

References bytes, I, iof_file_read(), iof_file_sync(), iof_file_unsync, IOF_STOPPED, iof_tail, and tail.

Referenced by filter_iofile_reader().

◆ iofile_stream_load()

static size_t iofile_stream_load ( iof I,
size_t plength,
size_t poffset 
)
static

◆ iofile_stream_read()

static size_t iofile_stream_read ( iof I,
size_t plength,
size_t poffset 
)
static

Definition at line 2707 of file utiliof.c.

References bytes, I, iof_file_read(), iof_file_sync(), iof_file_unsync, IOF_STOPPED, iof_tail, and tail.

Referenced by filter_iofile_stream_reader().

◆ iofile_stream_write()

static size_t iofile_stream_write ( iof O,
size_t plength,
size_t poffset,
int  flush 
)
static

◆ iofile_write()

static size_t iofile_write ( iof O,
size_t poffset,
int  flush 
)
static

◆ stderr_writer()

static size_t stderr_writer ( iof O,
iof_mode  mode 
)
static

Definition at line 929 of file utiliof.c.

References fflush, fwrite(), iof_size, IOFCLOSE, IOFFLUSH, IOFWRITE, mode, and O.

◆ stdout_writer()

static size_t stdout_writer ( iof O,
iof_mode  mode 
)
static

Definition at line 905 of file utiliof.c.

References fflush, fwrite(), iof_size, IOFCLOSE, IOFFLUSH, IOFWRITE, mode, O, and fc-lang::stdout.

Variable Documentation

◆ iof_buffers_heap

iof_heap* iof_buffers_heap = NULL
static

◆ iof_filters_heap

◆ iof_stderr

iof iof_stderr = { {{ (uint8_t *)( iof_stderr_buffer ), (uint8_t *)( iof_stderr_buffer ), (uint8_t *)( iof_stderr_buffer ) + BUFSIZ }}, BUFSIZ , stderr_writer , { NULL }, ( 0 )| (1<<8) , 0 }

Definition at line 957 of file utiliof.c.

◆ iof_stderr_buffer

uint8_t iof_stderr_buffer[BUFSIZ]
static

Definition at line 956 of file utiliof.c.

◆ iof_stdout

iof iof_stdout = { {{ (uint8_t *)( iof_stdout_buffer ), (uint8_t *)( iof_stdout_buffer ), (uint8_t *)( iof_stdout_buffer ) + BUFSIZ }}, BUFSIZ , stdout_writer , { NULL }, ( 0 )| (1<<8) , 0 }

Definition at line 954 of file utiliof.c.

◆ iof_stdout_buffer

uint8_t iof_stdout_buffer[BUFSIZ]
static

Definition at line 953 of file utiliof.c.