#include "geoslib_io.h"
#include "Basic/Utilities.hpp"
#include "Basic/File.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Core/io.hpp"
#include <string.h>
#include <stdarg.h>
#include <math.h>
Functions | |
static void | st_print (const char *string) |
static void | st_read (const char *prompt, char *buffer) |
static void | st_exit (void) |
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, const char *del_sep, char del_blk) |
void | print_current_line (void) |
static int | st_only_blanks (char *string) |
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,...) |
Variables | |
static char | BUFFER [STRING_LENGTH] |
static char | DEL_COM = '#' |
static char | DEL_BLK = ' ' |
const char * | DEL_SEP = " " |
static void(* | WRITE_FUNC )(const char *) = (void (*)(const char*)) st_print |
static void(* | WARN_FUNC )(const char *) = (void (*)(const char*)) st_print |
static void(* | READ_FUNC )(const char *, char *) = st_read |
static void(* | EXIT_FUNC )(void) = st_exit |
static char | LINE [LONG_SIZE] |
static char | LINE_MEM [LONG_SIZE] |
static char * | LCUR |
static char * | LINEB |
static char * | cur = NULL |
int _buffer_read | ( | char ** | buffer, |
const char * | format, | ||
va_list | ap | ||
) |
Read the next token from the buffer
[in] | buffer | Buffer to be read |
[in] | format | format |
[out] | ap | va_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
[in] | buffer | Writing buffer |
[in] | format | Encoding format |
[in] | ap | va_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, |
const char * | del_sep, | ||
char | del_blk | ||
) |
Define the file delimitors
[in] | del_com | Delimitor for comments |
[in] | del_sep | Delimitor for separator |
[in] | del_blk | Delimitor 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
[in] | file | FILE structure |
This method is not documented on purpose. It should remain private
FILE* _file_open | ( | const char * | filename, |
int | mode | ||
) |
Open an ASCII file
[in] | filename | Local file name |
[in] | mode | type 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
[in] | file | FILE structure |
[in] | format | format |
[in] | ap | Value 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
[in] | file | FILE structure |
[in] | format | Encoding format |
[in] | ap | Value 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
[in] | question | Question to be asked |
[in] | flag_def | 1 if the default is authorized; 0 otherwise |
[in] | valdef | Default value or TEST |
[in] | valmin | Minimum authorized value or TEST |
[in] | valmax | Maximum 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
[in] | question | Question to be asked |
[in] | flag_def | 1 if the default is authorized; 0 otherwise |
[in] | valdef | Default value or ITEST |
[in] | valmin | Minimum authorized value or ITEST |
[in] | valmax | Maximum 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
[in] | question | Question to be asked |
[in] | flag_def | 1 if the default is authorized; 0 otherwise |
[in] | valdef | Default 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
[in] | question | Question to be asked |
[in] | flag_def | 1 if the default is authorized; 0 otherwise |
[in] | valdef | Default string |
[out] | answer | Answering string |
This method is not documented on purpose. It should remain private
int _record_read | ( | FILE * | file, |
const char * | format, | ||
... | |||
) |
Read the next record
[in] | file | Pointer to the file to be read |
[in] | format | Encoding 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
[in] | nbyte | number 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
[in] | string | String to be displayed |
void print_current_line | ( | void | ) |
Print the current line read from an ASCII file
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
[in] | warn_func | Warning function |
void redefine_exit | ( | void(*)(void) | exit_func | ) |
Redefine the exiting routine
[in] | exit_func | Exiting function |
void redefine_message | ( | void(*)(const char *) | write_func | ) |
Redefine the IO routine for printing message
[in] | write_func | Writing function |
void redefine_read | ( | void(*)(const char *, char *) | read_func | ) |
Redefine the IO routine for Reading
[in] | read_func | Reading function |
|
static |
Exit from the gstlearn library (not killing the encapsulation if any)
|
static |
Check if a string is composed of blanks only
[in] | string | String to be checked |
|
static |
Internal print from the library
[in] | string | Message to be printed |
|
static |
Read a string from the Standard Input
[in] | prompt | String to be prompted to ask the question |
[in] | buffer | Array where the Input string is stored |
void string_strip_blanks | ( | char * | string, |
int | flag_lead | ||
) |
Strip the blanks from a string
[in,out] | string | String to be cleaned |
[in] | flag_lead | 1 to strip only the leading blanks |
void string_strip_quotes | ( | char * | string | ) |
Strip the leading and trailing quotes from a string
[in,out] | string | String to be cleaned |
|
static |
|
static |
|
static |
|
static |
const char* DEL_SEP = " " |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |