Fix warnings
[geany-mirror.git] / tagmanager / read.h
blob05427120f23b7cfbf5236e3e88e3ad9f1d2d2d3d
1 /*
3 * Copyright (c) 1998-2001, Darren Hiebert
5 * This source code is released for free distribution under the terms of the
6 * GNU General Public License.
8 * External interface to read.c
9 */
10 #ifndef _READ_H
11 #define _READ_H
13 #if defined(FILE_WRITE) || defined(VAXC)
14 # define CONST_FILE
15 #else
16 # define CONST_FILE const
17 #endif
20 * INCLUDE FILES
22 #include "general.h" /* must always come first */
24 #include <stdio.h>
25 #include <ctype.h>
26 #include <mio/mio.h>
28 #include "parse.h"
29 #include "vstring.h"
32 * MACROS
34 #define getInputLineNumber() File.lineNumber
35 #define getInputFileName() vStringValue (File.source.name)
36 #define getInputFilePosition() File.filePosition
37 #define getSourceFileName() vStringValue (File.source.name)
38 #define getSourceFileTagPath() File.source.tagPath
39 #define getSourceLanguage() File.source.language
40 #define getSourceLanguageName() getLanguageName (File.source.language)
41 #define getSourceLineNumber() File.source.lineNumber
42 #define isLanguage(lang) (boolean)((lang) == File.source.language)
43 #define isHeaderFile() File.source.isHeader
46 * DATA DECLARATIONS
49 enum eCharacters {
50 /* White space characters.
52 SPACE = ' ',
53 NEWLINE = '\n',
54 CRETURN = '\r',
55 FORMFEED = '\f',
56 TAB = '\t',
57 VTAB = '\v',
59 /* Some hard to read characters.
61 DOUBLE_QUOTE = '"',
62 SINGLE_QUOTE = '\'',
63 BACKSLASH = '\\',
65 STRING_SYMBOL = ('S' + 0x80),
66 CHAR_SYMBOL = ('C' + 0x80)
69 /* Maintains the state of the current source file.
71 typedef struct sInputFile {
72 vString *name; /* name of input file */
73 vString *path; /* path of input file (if any) */
74 vString *line; /* last line read from file */
75 const unsigned char* currentLine; /* current line being worked on */
76 MIO *mio; /* stream used for reading the file */
77 unsigned long lineNumber; /* line number in the input file */
78 MIOPos filePosition; /* file position of current line */
79 int ungetch; /* a single character that was ungotten */
80 boolean eof; /* have we reached the end of file? */
81 boolean newLine; /* will the next character begin a new line? */
82 langType language; /* language of input file */
84 /* Contains data pertaining to the original source file in which the tag
85 * was defined. This may be different from the input file when #line
86 * directives are processed (i.e. the input file is preprocessor output).
88 struct sSource {
89 vString *name; /* name to report for source file */
90 char *tagPath; /* path of source file relative to tag file */
91 unsigned long lineNumber;/* line number in the source file */
92 boolean isHeader; /* is source file a header file? */
93 langType language; /* language of source file */
94 } source;
95 } inputFile;
98 * GLOBAL VARIABLES
100 extern CONST_FILE inputFile File;
103 * FUNCTION PROTOTYPES
105 extern void freeSourceFileResources (void);
106 extern boolean fileOpen (const char *const fileName, const langType language);
107 extern boolean fileEOF (void);
108 extern void fileClose (void);
109 extern int fileGetc (void);
110 extern void fileUngetc (int c);
111 extern const unsigned char *fileReadLine (void);
112 extern char *readLine (vString *const vLine, MIO *const mio);
113 extern char *readSourceLine (vString *const vLine, MIOPos location, long *const pSeekValue);
114 extern boolean bufferOpen (unsigned char *buffer, int buffer_size,
115 const char *const fileName, const langType language );
116 #define bufferClose fileClose
118 #endif /* _READ_H */
120 /* vi:set tabstop=8 shiftwidth=4: */