Defines | Typedefs | Functions

eg_io.h File Reference

#include "eg_config.h"
#include "eg_macros.h"
Include dependency graph for eg_io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define EGnullDisplay   ((EGdisplay_f)0)
#define EGsfopen(__file, __mode)
 safe open function, it test that we can open the given file with the given mode, if an error occurs, display it on screen and exit, otherwise, return the open file stream.

Typedefs

typedef void(* EGdisplay_f )(void *, FILE *)
 type of functions for display, receives a void* to the structure to print, and a *FILE where to output
typedef void(* EGdisplayOS_f )(void *, FILE *, size_t *)
 type of functions for display, receives a void* to the structure to print, a *FILE where to output, and a set of offsets for datas, the length of that array must be know by the user.

Functions

void EGioNParse (char *input, int max_argc, const char *delim, const char *comment, int *argc, char **argv)
 Given a string 'input' this function uses EGioParse to separate up to N words in it, we assume that argc is an array of pointers to strings of size N, and note that the input array will be changed.
void EGioParse (char **next, char **current, const char *delim, const char *coment)
 given two *pointers 'next' and 'current' and a constant set of strings (parse delimiters), it store in 'next the next meaningfull string, and in current the rest of the secuence, the idea is to iterate over 'next' while it is not true; you have to store the original pointer to the string stream elsewere; also, we assume that the original stream is terminated with ''; also, it will discaard any sub-string that start with #, that is inteded for discard comments
int EGioReadIntParam (const int argc, char **argv, int *const param, int *const rval)
 read an integer parameter, this function checks that we have one parameter, if an error occurs, report it in the given rval
int EGioReadLine (char *const str, size_t const max_len, FILE *file)
 read a line from an input stream.
int EGioReadNamedDblPlusParam (const int argc, char **argv, const char *const name, double *const param, int *const has_param, int *const rval)
 read a named positive double parameter, this function checks that we have two parameters, and check if we had previously readed the parameter, if an error occurs, report it in the given rval
int EGioReadNamedIntNNParam (const int argc, char **argv, const char *const name, int *const param, int *const has_param, int *const rval)
 read a named, non-negative, integer parameter, this function checks that we have two parameters, and check if we had previously readed the parameter, if an error occurs, report it in the given rval
int EGioReadNamedIntPlusParam (const int argc, char **argv, const char *const name, int *const param, int *const has_param, int *const rval)
 read a named, strictly positive, integer parameter, this function checks that we have two parameters, and check if we had previously readed the parameter, if an error occurs, report it in the given rval
int EGioReadNamedParam (const int argc, char **argv, const char *const name, int *const has_param, int *const rval)
 read a named parameter, this function checks that we have one parameter, and check if we had previously readed the parameter, if an error occurs, report it in the given rval
int EGioReadNamedStringParam (const int argc, char **argv, const char *const name, char **const param, int *const has_param, int *const rval)
 read a named string parameter, this function checks that we have two parameters, and check if we had previously readed the parameter, if an error occurs, report it in the given rval
Deprecated Functions

All functions here are marked as deprecated, and may be discontinued in sub-sequent releases

void EGmvar (char *str, int nind, const char *header,...)
 create names with indices
void EGioDisCom (char **next, char **current, const char *delim, const char *coment, char *store, unsigned int storeSize, FILE *in)
 this discard all lines starting with comments and stores the next leading line in current and the next token in next, we assume that next does not contain data, and that current store the remainings of the current line
void EGdisplayString (void *str, FILE *file)
 display function for strings

Zlib, BZlib compability interface:

This functions pretend to provide a common interface to work with plain or compresed files. Up to now, we implement zlib and plain text handling, as well as basic input/output handling.



typedef struct EGioFile_st EGioFile_t
 Converts, formats, and writes the args to the file under control of the format string, as in fprintf.
int EGioPrintf (EGioFile_t *file, const char *format,...)
 Converts, formats, and writes the args to the file under control of the format string, as in fprintf.
int EGioWrite (EGioFile_t *file, const char *const string)
 Converts, formats, and writes the args to the file under control of the format string, as in fprintf.
EGioFile_tEGioOpen (const char *path, const char *mode)
 open a file for read or write as in fopen. if the file name ends with gz, it will (try to) use gzFile mode, if not, it will use regular FILE modes
EGioFile_tEGioOpenFILE (FILE *file)
 open a C stdandard file FILE as an EGioFile_t, it can be used to open stderr, stdout, stdin, it will use plain access to the file. At closing, it will not close the three standard stdout, stderr, stdin, but other files will be closed.
int EGioClose (EGioFile_t *file)
 close file, flush all pending information, free all internally allocated information.
int EGioFlush (EGioFile_t *file)
 flush all un-writed information into the file.
char * EGioGets (char *buf, int len, EGioFile_t *file)
 reads bytes from file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. The string is then terminated with a null character.
int EGioEof (const EGioFile_t *const file)
 Test if the given file stream pointer point to the end of file.
int EGioError (const EGioFile_t *const file)
 Test if the given file stream has an internal error flag.

Detailed Description

Definition in file eg_io.h.