TaPAS
0.2
|
Useful functions used to serialize GENEPI sets. More...
#include <stdio.h>
#include <genepi/genepi-common.h>
Go to the source code of this file.
Functions | |
int | genepi_io_write_uint8 (FILE *out, uint8_t i, int *perr) |
Write an 8-bit unsigned integer on the out stream. More... | |
int | genepi_io_write_int8 (FILE *out, int8_t i, int *perr) |
Write an 8-bit signed integer on the out stream. More... | |
int | genepi_io_write_uint16 (FILE *out, uint16_t i, int *perr) |
Write a 16-bit unsigned integer on the out stream. More... | |
int | genepi_io_write_int16 (FILE *out, int16_t i, int *perr) |
Write a 16-bit signed integer on the out stream. More... | |
int | genepi_io_write_uint32 (FILE *out, uint32_t i, int *perr) |
Write a 32-bit unsigned integer on the out stream. More... | |
int | genepi_io_write_int32 (FILE *out, int32_t i, int *perr) |
Write a 32-bit signed integer on the out stream. More... | |
int | genepi_io_write_string (FILE *out, const char *s, int *perr) |
Write a string on the out stream. The string s can be null in which case the NULL value will be reloaded by the read_string function. More... | |
int | genepi_io_write_buffer (FILE *out, const void *buf, size_t size, int *perr) |
Write the content of the buffer buf on the out stream. Oppositely to strings the given buffer must not be NULL. More... | |
int | genepi_io_read_uint8 (FILE *in, uint8_t *pi, int *perr) |
Read an 8-bit unsigned integer on the in stream. The signedness of the integer is not checked. More... | |
int | genepi_io_read_int8 (FILE *in, int8_t *pi, int *perr) |
Read an 8-bit signed integer on the in stream. The signedness of the integer is not checked. More... | |
int | genepi_io_read_uint16 (FILE *in, uint16_t *pi, int *perr) |
Read a 16-bit unsigned integer on the in stream. The signedness of the integer is not checked. More... | |
int | genepi_io_read_int16 (FILE *in, int16_t *pi, int *perr) |
Read a 16-bit signed integer on the in stream. The signedness of the integer is not checked. More... | |
int | genepi_io_read_uint32 (FILE *in, uint32_t *pi, int *perr) |
Read a 32-bit unsigned integer on the in stream. The signedness of the integer is not checked. More... | |
int | genepi_io_read_int32 (FILE *in, int32_t *pi, int *perr) |
Read a 32-bit signed integer on the in stream. The signedness of the integer is not checked. More... | |
int | genepi_io_read_string (FILE *in, char **ps, int *perr) |
Read a string on the in stream. The readed string might be NULL. More... | |
int | genepi_io_read_buffer (FILE *in, void *buf, size_t size, int *perr) |
Read size bytes the in stream. More... | |
Useful functions used to serialize GENEPI sets.
This module gathers functions that write some primitive C type into a FILE stream. In particular these functions take care of endianness of integers.
Each function returns the number of bytes actually written on or readed from the stream. If an error occurs then a genepi_io_error value is stored into *perr. If a function is called with a *perr that is negative then the function simply returns 0.
Definition in file genepi-io.h.
int genepi_io_read_buffer | ( | FILE * | in, |
void * | buf, | ||
size_t | size, | ||
int * | perr | ||
) |
Read size bytes the in stream.
in | the input stream |
buf | a pointer to buffer receiving the readed bytes |
size | the number of bytes to read. |
perr | a pointer to the error flag |
int genepi_io_read_int16 | ( | FILE * | in, |
int16_t * | pi, | ||
int * | perr | ||
) |
Read a 16-bit signed integer on the in stream. The signedness of the integer is not checked.
in | the input stream |
pi | a pointer to the variable which receive the readed value |
perr | a pointer to the error flag |
int genepi_io_read_int32 | ( | FILE * | in, |
int32_t * | pi, | ||
int * | perr | ||
) |
Read a 32-bit signed integer on the in stream. The signedness of the integer is not checked.
in | the input stream |
pi | a pointer to the variable which receive the readed value |
perr | a pointer to the error flag |
int genepi_io_read_int8 | ( | FILE * | in, |
int8_t * | pi, | ||
int * | perr | ||
) |
Read an 8-bit signed integer on the in stream. The signedness of the integer is not checked.
in | the input stream |
pi | a pointer to the variable which receive the readed value |
perr | a pointer to the error flag |
int genepi_io_read_string | ( | FILE * | in, |
char ** | ps, | ||
int * | perr | ||
) |
Read a string on the in stream. The readed string might be NULL.
in | the input stream |
ps | a pointer to the variable which receive the readed string |
perr | a pointer to the error flag |
int genepi_io_read_uint16 | ( | FILE * | in, |
uint16_t * | pi, | ||
int * | perr | ||
) |
Read a 16-bit unsigned integer on the in stream. The signedness of the integer is not checked.
in | the input stream |
pi | a pointer to the variable which receive the readed value |
perr | a pointer to the error flag |
int genepi_io_read_uint32 | ( | FILE * | in, |
uint32_t * | pi, | ||
int * | perr | ||
) |
Read a 32-bit unsigned integer on the in stream. The signedness of the integer is not checked.
in | the input stream |
pi | a pointer to the variable which receive the readed value |
perr | a pointer to the error flag |
int genepi_io_read_uint8 | ( | FILE * | in, |
uint8_t * | pi, | ||
int * | perr | ||
) |
Read an 8-bit unsigned integer on the in stream. The signedness of the integer is not checked.
in | the input stream |
pi | a pointer to the variable which receive the readed value |
perr | a pointer to the error flag |
int genepi_io_write_buffer | ( | FILE * | out, |
const void * | buf, | ||
size_t | size, | ||
int * | perr | ||
) |
Write the content of the buffer buf on the out stream. Oppositely to strings the given buffer must not be NULL.
out | the ouput stream |
buf | the written buffer |
size | the size of buffer, in bytes |
perr | a pointer to the error flag |
int genepi_io_write_int16 | ( | FILE * | out, |
int16_t | i, | ||
int * | perr | ||
) |
Write a 16-bit signed integer on the out stream.
out | the ouput stream |
i | the written integer |
perr | a pointer to the error flag |
int genepi_io_write_int32 | ( | FILE * | out, |
int32_t | i, | ||
int * | perr | ||
) |
Write a 32-bit signed integer on the out stream.
out | the ouput stream |
i | the written integer |
perr | a pointer to the error flag |
int genepi_io_write_int8 | ( | FILE * | out, |
int8_t | i, | ||
int * | perr | ||
) |
Write an 8-bit signed integer on the out stream.
out | the ouput stream |
i | the written integer |
perr | a pointer to the error flag |
int genepi_io_write_string | ( | FILE * | out, |
const char * | s, | ||
int * | perr | ||
) |
Write a string on the out stream. The string s can be null in which case the NULL value will be reloaded by the read_string function.
out | the ouput stream |
s | the string |
perr | a pointer to the error flag |
int genepi_io_write_uint16 | ( | FILE * | out, |
uint16_t | i, | ||
int * | perr | ||
) |
Write a 16-bit unsigned integer on the out stream.
out | the ouput stream |
i | the written integer |
perr | a pointer to the error flag |
int genepi_io_write_uint32 | ( | FILE * | out, |
uint32_t | i, | ||
int * | perr | ||
) |
Write a 32-bit unsigned integer on the out stream.
out | the ouput stream |
i | the written integer |
perr | a pointer to the error flag |
int genepi_io_write_uint8 | ( | FILE * | out, |
uint8_t | i, | ||
int * | perr | ||
) |
Write an 8-bit unsigned integer on the out stream.
out | the ouput stream |
i | the written integer |
perr | a pointer to the error flag |