Commit 91f5e7fe authored by Konstantin Kharlamov's avatar Konstantin Kharlamov Committed by Sebastien Granjoux

anjuta-tags: remove getInputFilePosition by replacing fpos_t with long

Signed-off-by: Konstantin Kharlamov's avatarKonstantin Kharlamov <Hi-Angel@yandex.ru>
parent 3100d01c
......@@ -30,7 +30,7 @@
* DATA DEFINITIONS
*/
inputFile File; /* globally read through macros */
static fpos_t StartOfLine; /* holds deferred position of start of line */
static long StartOfLine; /* holds deferred position of start of line */
/*
* FUNCTION DEFINITIONS
......@@ -268,8 +268,7 @@ extern boolean fileOpen (const char *const fileName, const langType language)
opened = TRUE;
setInputFileName (fileName);
fgetpos (File.fp, &StartOfLine);
fgetpos (File.fp, &File.filePosition);
File.filePosition = StartOfLine = ftell (File.fp);
File.currentLine = NULL;
File.language = language;
File.lineNumber = 0L;
......@@ -343,7 +342,7 @@ readnext:
goto readnext;
else
{
fsetpos (File.fp, &StartOfLine);
fseek (File.fp, StartOfLine, SEEK_SET);
c = getc (File.fp);
}
}
......@@ -354,7 +353,7 @@ readnext:
else if (c == NEWLINE)
{
File.newLine = TRUE;
fgetpos (File.fp, &StartOfLine);
StartOfLine = ftell (File.fp);
}
else if (c == CRETURN)
{
......@@ -371,7 +370,7 @@ readnext:
{
c = NEWLINE; /* convert CR into newline */
File.newLine = TRUE;
fgetpos (File.fp, &StartOfLine);
StartOfLine = ftell (File.fp);
}
}
DebugStatement ( debugPutc (DEBUG_RAW, c); )
......@@ -540,16 +539,6 @@ extern char *readLine (vString *const vLine, FILE *const fp)
return result;
}
long getInputFilePosition() {
fpos_t originalPosition;
long ret;
fgetpos (File.fp, &originalPosition);
fsetpos (File.fp, &File.filePosition);
ret = ftell(File.fp);
fsetpos (File.fp, &originalPosition);
return ret;
}
/* Places into the line buffer the contents of the line referenced by
* "location".
*/
......
......@@ -33,6 +33,7 @@
*/
#define getInputLineNumber() File.lineNumber
#define getInputFileName() vStringValue (File.source.name)
#define getInputFilePosition() File.filePosition
#define getSourceFileName() vStringValue (File.source.name)
#define getSourceFileTagPath() File.source.tagPath
#define getSourceLanguage() File.source.language
......@@ -72,7 +73,7 @@ typedef struct sInputFile {
const unsigned char* currentLine; /* current line being worked on */
FILE *fp; /* stream used for reading the file */
unsigned long lineNumber; /* line number in the input file */
fpos_t filePosition; /* file position of current line */
long filePosition; /* file position of current line */
int ungetch; /* a single character that was ungotten */
boolean eof; /* have we reached the end of file? */
boolean newLine; /* will the next character begin a new line? */
......@@ -109,7 +110,6 @@ extern void fileUngetc (int c);
extern const unsigned char *fileReadLine (void);
extern char *readLine (vString *const vLine, FILE *const fp);
extern char *readSourceLine (vString *const vLine, long location);
extern long getInputFilePosition(void);
#endif /* _READ_H */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment