read: move sInputFileInfo, sInputFile and File to read.c

This commit is contained in:
Jiří Techet 2016-10-11 00:13:25 +02:00
parent 63fbe2f6a2
commit c1acde7eff
2 changed files with 38 additions and 39 deletions

View File

@ -34,12 +34,47 @@
#endif #endif
#include <regex.h> #include <regex.h>
/*
* DATA DECLARATIONS
*/
/* Maintains the state of the current input file.
*/
typedef struct sInputFileInfo {
vString *name; /* name to report for input file */
vString *tagPath; /* path of input file relative to tag file */
unsigned long lineNumber;/* line number in the input file */
unsigned long lineNumberOrigin; /* The value set to `lineNumber'
when `resetInputFile' is called
on the input stream.
This is needed for nested stream. */
bool isHeader; /* is input file a header file? */
langType language; /* language of input file */
} inputFileInfo;
typedef struct sInputFile {
vString *path; /* path of input file (if any) */
vString *line; /* last line read from file */
const unsigned char* currentLine; /* current line being worked on */
MIO *mio; /* MIO stream used for reading the file */
MIOPos filePosition; /* file position of current line */
unsigned int ungetchIdx;
int ungetchBuf[3]; /* characters that were ungotten */
/* Contains data pertaining to the original `source' file in which the tag
* was defined. This may be different from the `input' file when #line
* directives are processed (i.e. the input file is preprocessor output).
*/
inputFileInfo input; /* name, lineNumber */
inputFileInfo source;
} inputFile;
/* /*
* DATA DEFINITIONS * DATA DEFINITIONS
*/ */
inputFile File; /* globally read through macros */ static inputFile File; /* static read through functions */
static MIOPos StartOfLine; /* holds deferred position of start of line */ static MIOPos StartOfLine; /* holds deferred position of start of line */
/* /*
* FUNCTION DEFINITIONS * FUNCTION DEFINITIONS

View File

@ -48,42 +48,6 @@ enum eCharacters {
CHAR_SYMBOL = ('C' + 0xff) CHAR_SYMBOL = ('C' + 0xff)
}; };
/* Maintains the state of the current input file.
*/
typedef struct sInputFileInfo {
vString *name; /* name to report for input file */
vString *tagPath; /* path of input file relative to tag file */
unsigned long lineNumber;/* line number in the input file */
unsigned long lineNumberOrigin; /* The value set to `lineNumber'
when `resetInputFile' is called
on the input stream.
This is needed for nested stream. */
bool isHeader; /* is input file a header file? */
langType language; /* language of input file */
} inputFileInfo;
typedef struct sInputFile {
vString *path; /* path of input file (if any) */
vString *line; /* last line read from file */
const unsigned char* currentLine; /* current line being worked on */
MIO *mio; /* MIO stream used for reading the file */
MIOPos filePosition; /* file position of current line */
unsigned int ungetchIdx;
int ungetchBuf[3]; /* characters that were ungotten */
/* Contains data pertaining to the original source file in which the tag
* was defined. This may be different from the input file when #line
* directives are processed (i.e. the input file is preprocessor output).
*/
inputFileInfo input; /* name, lineNumber */
inputFileInfo source;
} inputFile;
/*
* GLOBAL VARIABLES
*/
/* should not be modified externally */
extern inputFile File;
/* /*
* FUNCTION PROTOTYPES * FUNCTION PROTOTYPES