#include <stdio.h>
#include "xfile.h"
Go to the source code of this file.
Functions | |
FILE * | cleancommblock (FILE *in) |
void | delcomment (char *s) |
long | getdouble (FILE *in, double &num) |
void | geteoln (FILE *in) |
long | getgkwid (XFILE *in, long id, long &numl) |
long | getgkwid (FILE *in, long id) |
long | getint (FILE *in, int &num) |
long | getlong (FILE *in, long &num) |
void | getnextln (FILE *in) |
void | getnexttxt (FILE *in) |
long | getnprop (XFILE *in, long &numl) |
long | getnprop (FILE *in) |
long | getpkw (FILE *in) |
long | getstring (FILE *in, char *str, long maxlen) |
long | getstring2 (FILE *in, char *str, long maxlen) |
long | inputln (FILE *in, char *anystr, long maxlen) |
long | iscomment (char *s, char *&ptr) |
long | isgkw (char *s, char *&ptr) |
long | ispkw (char *s, char *&ptr) |
FILE* cleancommblock | ( | FILE * | in | ) |
Function deletes comment blocks from file one block denoted by general keywords 'begin' and 'end'. This block is rewritten without comments to the temporary file.
in | - pointer to opened file with block which will be cleaned out of comments |
pointer | to opened temporary file where is the result of cleaning process. |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 128 of file intools.cpp.
References Genkw, getgkwid(), and getnextln().
Referenced by main().
void delcomment | ( | char * | s | ) |
Function deletes part of string s behind comment character # and puts chracter instead it. If only blank chracters precede #, then is placed to the first (0-th) position of string
s | - pointer to searched string. |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 98 of file intools.cpp.
long getdouble | ( | FILE * | in, | |
double & | num | |||
) |
Function reads real number type double from file given by parameter in. Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched number.
in | - pointer to opened file where the number is searched | |
num | - output parameter for result |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 612 of file intools.cpp.
References geteoln(), and iscomment().
Referenced by loadn::read_prop(), tablefunct::read_prop(), itablefunct::read_prop(), and gfunct::read_prop().
void geteoln | ( | FILE * | in | ) |
Function searches file given by parameter in for
character and sets file position indicator on it.
in | - pointer to opened file where is searched |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 177 of file intools.cpp.
Referenced by getdouble(), getgkwid(), getint(), getlong(), getnprop(), getpkw(), getstring(), and getstring2().
long getgkwid | ( | XFILE * | in, | |
long | id, | |||
long & | numl | |||
) |
Function searches file given by parameter in for id-th general keyword. Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched keyword.
in | - pointer to opened file where general keyword is searched | |
id | - index of desired general keyword | |
numl | - number of processed lines |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 296 of file intools.cpp.
References clearcomments(), XFILE::col, XFILE::file, XFILE::give_maxlnsize(), inputln(), isgkw(), XFILE::lnfpos, memset(), and Propkw.
long getgkwid | ( | FILE * | in, | |
long | id | |||
) |
Function searches file given by parameter in for id-th general keyword. Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched keyword.
in | - pointer to opened file where general keyword is searched | |
id | - index of desired general keyword |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 238 of file intools.cpp.
References Genkw, geteoln(), iscomment(), isgkw(), and memset().
Referenced by cleancommblock().
long getint | ( | FILE * | in, | |
int & | num | |||
) |
Function reads integer number type int from file given by parameter in. Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched number.
in | - pointer to opened file where the number is searched | |
num | - output parameter for result |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 561 of file intools.cpp.
References geteoln(), and iscomment().
Referenced by tablefunct::read_prop(), and gfunct::read_prop().
long getlong | ( | FILE * | in, | |
long & | num | |||
) |
Function reads integer number type long from file given by parameter in. Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched number.
in | - pointer to opened file where the number is searched | |
num | - output parameter for result |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 506 of file intools.cpp.
References geteoln(), and iscomment().
Referenced by main(), loadn::read_prop(), tablefunct::read_prop(), itablefunct::read_prop(), and gfunct::read_prop().
void getnextln | ( | FILE * | in | ) |
Function searches file given by parameter in for
character and sets file position indicator after it.
in | - pointer to opened file where is searched |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 194 of file intools.cpp.
Referenced by cleancommblock(), getstring(), and getstring2().
void getnexttxt | ( | FILE * | in | ) |
Function searches file given by parameter in from current position for WHITESPACE characters and sets file position indicator to the first nonwhitespace character i.e. it searches next text.
in | - pointer to opened file where is searched |
created 9.2003, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 9.2003, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 209 of file intools.cpp.
long getnprop | ( | XFILE * | in, | |
long & | numl | |||
) |
Function searches file given by parameter in for property keywords and counts its number. File is proccessing until any general keyword found. Comment blocks are accepted and skipped. After searching the file position indicator is set to the original position before searching.
in | - pointer to opened file where property keywords are searched | |
numl | - number of lines found during the searching |
1 | - if fails reading of input file | |
0 | - on succes |
created 2.2007, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 400 of file intools.cpp.
References clearcomments(), XFILE::file, XFILE::give_maxlnsize(), inputln(), isgkw(), ispkw(), and memset().
long getnprop | ( | FILE * | in | ) |
Function searches file given by parameter in for property keywords and counts its number. File is proccessing until any general keyword found. Comment blocks are accepted and skipped. After searching the file position indicator is set to the original position before searching.
in | - pointer to opened file where property keywords are searched | |
id | - index of desired property keyword |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 446 of file intools.cpp.
References geteoln(), iscomment(), isgkw(), and ispkw().
long getpkw | ( | FILE * | in | ) |
Function searches file given by parameter in for id-th property keyword. Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched keyword.
in | - pointer to opened file where property keyword is searched | |
id | - index of desired property keyword |
1 | - if fails reading of input file | |
0 | - on succes |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 343 of file intools.cpp.
References geteoln(), iscomment(), ispkw(), and Propkw.
long getstring | ( | FILE * | in, | |
char * | str, | |||
long | maxlen | |||
) |
Function reads string from file given by parameter in. Initial whitespaces are skipped. String str has maximu length maxlen chracters including terminating . Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched string.
in | - pointer to opened file where the string is searched | |
num | - output parameter for result |
0 | always |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 666 of file intools.cpp.
References geteoln(), and getnextln().
Referenced by main(), and gfunct::read_prop().
long getstring2 | ( | FILE * | in, | |
char * | str, | |||
long | maxlen | |||
) |
Function reads string from file given by parameter in. String str has maximu length maxlen chracters including terminating . Comment blocks are accepted and skipped. On success, the file position indicator is set after last character searched string.
in | - pointer to opened file where the string is searched | |
num | - output parameter for result |
0 | always |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 734 of file intools.cpp.
References geteoln(), and getnextln().
long inputln | ( | FILE * | in, | |
char * | anystr, | |||
long | maxlen | |||
) |
Function reads maxlen characters to string anystr from th file in. Function reads file till the line treminating character
and stores chracters to string given by parameter anystr until maxlen chractres are read.
in | - pointer to opened file | |
anystr | - output parameter, pointer to allocated string where read chracters are stored | |
maxlen | - maximu number of read chracters |
number | of successfully read bytes |
Definition at line 786 of file intools.cpp.
Referenced by getgkwid(), and getnprop().
long iscomment | ( | char * | s, | |
char *& | ptr | |||
) |
Function searches string s for comment character # and returns result
s | - pointer to searched string. | |
ptr | - output parameter which contains pointer to string s where was found character # or NULL when no # chracter found |
1 | - There was found # character in the string. | |
0 | - No # chracterwas was found. |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 81 of file intools.cpp.
References strstr().
Referenced by getdouble(), getgkwid(), getint(), getlong(), getnprop(), and getpkw().
long isgkw | ( | char * | s, | |
char *& | ptr | |||
) |
Function comparess string s with Genkw array and returns result
s | - pointer to compared string. | |
ptr | - output parameter which contains pointer to array Genkw where is same keyword as in the s string or NULL when no general keyword matches. |
-1 | - no general keyword matches string s. | |
i | - i-th general keyword matches string s. Indexing starts from 0 |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 33 of file intools.cpp.
References Genkw, Ngkw, and strstr().
Referenced by getgkwid(), and getnprop().
long ispkw | ( | char * | s, | |
char *& | ptr | |||
) |
Function comparess string s with Propkw array and returns result
s | - pointer to compared string. | |
ptr | - output parameter which contains pointer to array Propkw where is same keyword as in the s string or NULL when no property keyword matches. |
-1 | - no property keyword matches string s. | |
i | - i-th property keyword matches string s. Indexing starts from 0 |
created 12.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 23.1.2002, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 58 of file intools.cpp.
References Npkw, Propkw, and strstr().
Referenced by getnprop(), and getpkw().