1.2.2
CCC
 
io.cpp File Reference
#include "geoslib_enum.h"
#include "geoslib_old_f.h"
#include "geoslib_f_private.h"
#include "Enum/EJustify.hpp"
#include "Basic/Utilities.hpp"
#include "Basic/File.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Basic/OptCst.hpp"
#include <string.h>
#include <stdarg.h>
#include <math.h>

Functions

void redefine_message (void(*write_func)(const char *))
 
void redefine_error (void(*warn_func)(const char *))
 
void redefine_read (void(*read_func)(const char *, char *))
 
void redefine_exit (void(*exit_func)(void))
 
void string_strip_blanks (char *string, int flag_lead)
 
void string_strip_quotes (char *string)
 
void message_extern (const char *string)
 
void exit_extern ()
 
void mem_error (int nbyte)
 
FILE * _file_open (const char *filename, int mode)
 
void _file_delimitors (char del_com, char del_sep, char del_blk)
 
void print_current_line (void)
 
int _file_read (FILE *file, const char *format, va_list ap)
 
int _file_get_ncol (FILE *file)
 
void _erase_current_string (void)
 
int _buffer_read (char **buffer, const char *format, va_list ap)
 
void _file_write (FILE *file, const char *format, va_list ap)
 
void _buffer_write (char *buffer, const char *format, va_list ap)
 
void _lire_string (const char *question, int flag_def, const char *valdef, char *answer)
 
int _lire_int (const char *question, int flag_def, int valdef, int valmin, int valmax)
 
double _lire_double (const char *question, int flag_def, double valdef, double valmin, double valmax)
 
int _lire_logical (const char *question, int flag_def, int valdef)
 
void record_close (void)
 
int _record_read (FILE *file, const char *format,...)
 
void print_range (const char *title, int ntab, const double *tab, const double *sel)
 

Function Documentation

int _buffer_read ( char **  buffer,
const char *  format,
va_list  ap 
)

Read the next token from the buffer

Returns
-1 if the end-of-record has been found
1 for a decoding error
0 otherwise
Parameters
[in]bufferBuffer to be read
[in]formatformat
[out]apva_list containing the read variables

This method is not documented on purpose. It should remain private

void _buffer_write ( char *  buffer,
const char *  format,
va_list  ap 
)

Write the next token into the buffer

Parameters
[in]bufferWriting buffer
[in]formatEncoding format
[in]apva_list to be written

This method is not documented on purpose. It should remain private

void _erase_current_string ( void  )

Erase the current decoding string

This method is not documented on purpose. It should remain private

void _file_delimitors ( char  del_com,
char  del_sep,
char  del_blk 
)

Define the file delimitors

Parameters
[in]del_comDelimitor for comments
[in]del_sepDelimitor for separator
[in]del_blkDelimitor for blank

This method is not documented on purpose. It should remain private

int _file_get_ncol ( FILE *  file)

Get the number of tokens in the line

Returns
Number of tokens
Parameters
[in]fileFILE structure

This method is not documented on purpose. It should remain private

FILE* _file_open ( const char *  filename,
int  mode 
)

Open an ASCII file

Returns
FILE returned pointer
Parameters
[in]filenameLocal file name
[in]modetype of file (OLD or NEW)

This method is not documented on purpose. It should remain private

int _file_read ( FILE *  file,
const char *  format,
va_list  ap 
)

Read the next token from the file

Returns
-1 if the end-of-file has been found
1 for a decoding error
0 otherwise
Parameters
[in]fileFILE structure
[in]formatformat
[in]apValue to be read

This method is not documented on purpose. It should remain private

void _file_write ( FILE *  file,
const char *  format,
va_list  ap 
)

Write the next token from the file

Parameters
[in]fileFILE structure
[in]formatEncoding format
[in]apValue to be written

This method is not documented on purpose. It should remain private

double _lire_double ( const char *  question,
int  flag_def,
double  valdef,
double  valmin,
double  valmax 
)

Read a double value

Returns
Double value
Parameters
[in]questionQuestion to be asked
[in]flag_def1 if the default is authorized; 0 otherwise
[in]valdefDefault value or TEST
[in]valminMinimum authorized value or TEST
[in]valmaxMaximum authorized value or TEST

This method is not documented on purpose. It should remain private

int _lire_int ( const char *  question,
int  flag_def,
int  valdef,
int  valmin,
int  valmax 
)

Read an integer value

Returns
Integer value
Parameters
[in]questionQuestion to be asked
[in]flag_def1 if the default is authorized; 0 otherwise
[in]valdefDefault value or ITEST
[in]valminMinimum authorized value or ITEST
[in]valmaxMaximum authorized value or ITEST

This method is not documented on purpose. It should remain private

int _lire_logical ( const char *  question,
int  flag_def,
int  valdef 
)

Read a boolean answer

Returns
Integer value: 1 for 'yes' and 0 for 'no'
Parameters
[in]questionQuestion to be asked
[in]flag_def1 if the default is authorized; 0 otherwise
[in]valdefDefault value (0 for NO and 1 for YES)

This method is not documented on purpose. It should remain private

void _lire_string ( const char *  question,
int  flag_def,
const char *  valdef,
char *  answer 
)

Read astring

Parameters
[in]questionQuestion to be asked
[in]flag_def1 if the default is authorized; 0 otherwise
[in]valdefDefault string
[out]answerAnswering string

This method is not documented on purpose. It should remain private

int _record_read ( FILE *  file,
const char *  format,
  ... 
)

Read the next record

Returns
Error return code
Parameters
[in]filePointer to the file to be read
[in]formatEncoding format
[in]...Value to be written

This method is not documented on purpose. It should remain private

void exit_extern ( )

External function to provoke an exit of API This call comes from AStringable where initial mes_abort() has been moved

void mem_error ( int  nbyte)

Problem in memory allocation

Parameters
[in]nbytenumber of bytes to be allocated
void message_extern ( const char *  string)

Print a message This call comes from AStringable where initial message() has been moved

Parameters
[in]stringString to be displayed
void print_current_line ( void  )

Print the current line read from an ASCII file

void print_range ( const char *  title,
int  ntab,
const double *  tab,
const double *  sel 
)

Print the range of values in an array

Parameters
[in]titleoptional title (NULL if not defined)
[in]ntabnumber of values
[in]tabarray of values
[in]sel(optional) selection
void record_close ( void  )

Read the next record

This method is not documented on purpose. It should remain private

void redefine_error ( void(*)(const char *)  warn_func)

Redefine the IO routine for printing error message

Parameters
[in]warn_funcWarning function
void redefine_exit ( void(*)(void)  exit_func)

Redefine the exiting routine

Parameters
[in]exit_funcExiting function
void redefine_message ( void(*)(const char *)  write_func)

Redefine the IO routine for printing message

Parameters
[in]write_funcWriting function
void redefine_read ( void(*)(const char *, char *)  read_func)

Redefine the IO routine for Reading

Parameters
[in]read_funcReading function
void string_strip_blanks ( char *  string,
int  flag_lead 
)

Strip the blanks from a string

Parameters
[in,out]stringString to be cleaned
[in]flag_lead1 to strip only the leading blanks
void string_strip_quotes ( char *  string)

Strip the leading and trailing quotes from a string

Parameters
[in,out]stringString to be cleaned
Remarks
The quote is searched in first position. If not found, nothing done
If found, the trailing quote is stripped, if similar to the first
character