xref: /Universal-ctags/main/read.h (revision 64a05963c108af4b7832a2215006ff5cafcaaebb)
1 /*
2 *   Copyright (c) 1998-2002, Darren Hiebert
3 *
4 *   This source code is released for free distribution under the terms of the
5 *   GNU General Public License version 2 or (at your option) any later version.
6 *
7 *   External interface to read.c
8 */
9 #ifndef CTAGS_MAIN_READ_H
10 #define CTAGS_MAIN_READ_H
11 
12 /*
13 *   INCLUDE FILES
14 */
15 #include "general.h"  /* must always come first */
16 
17 #include <stdio.h>
18 #include <ctype.h>
19 
20 #include "types.h"
21 #include "vstring.h"
22 #include "mio.h"
23 
24 /*
25 *   MACROS
26 */
27 
28 /*
29 *   DATA DECLARATIONS
30 */
31 
32 enum eCharacters {
33 	/* white space characters */
34 	SPACE         = ' ',
35 	NEWLINE       = '\n',
36 	CRETURN       = '\r',
37 	FORMFEED      = '\f',
38 	TAB           = '\t',
39 	VTAB          = '\v',
40 
41 	/* some hard to read characters */
42 	DOUBLE_QUOTE  = '"',
43 	SINGLE_QUOTE  = '\'',
44 	BACKSLASH     = '\\',
45 
46 	/* symbolic representations, above 0xFF not to conflict with any byte */
47 	STRING_SYMBOL = ('S' + 0xff),
48 	CHAR_SYMBOL   = ('C' + 0xff)
49 };
50 
51 
52 /*
53 *   FUNCTION PROTOTYPES
54 */
55 
56 /* InputFile: reading from fp in inputFile with updating fields in input fields */
57 extern unsigned long getInputLineNumber (void);
58 extern unsigned long getInputLineNumberForFileOffset(long offset);
59 extern int getInputLineOffset (void);
60 extern const char *getInputFileName (void);
61 extern MIOPos getInputFilePosition (void);
62 extern MIOPos getInputFilePositionForLine (unsigned int line);
63 extern langType getInputLanguage (void);
64 extern bool isInputLanguage (langType lang);
65 extern bool isInputHeaderFile (void);
66 extern bool isInputLanguageKindEnabled (int kindIndex);
67 extern bool isInputLanguageRoleEnabled (int kindIndex, int roleIndex);
68 
69 extern const unsigned char *getInputFileData (size_t *size);
70 
71 extern int getcFromInputFile (void);
72 extern int getNthPrevCFromInputFile (unsigned int nth, int def);
73 extern int skipToCharacterInInputFile (int c);
74 extern int skipToCharacterInInputFile2 (int c0, int c1);
75 extern void ungetcToInputFile (int c);
76 extern const unsigned char *readLineFromInputFile (void);
77 
78 extern unsigned long getSourceLineNumber (void);
79 
80 /* Raw: reading from given a parameter, mio */
81 extern char *readLineRaw (vString *const vLine, MIO *const mio);
82 
83 extern void     pushLanguage(const langType language);
84 extern langType popLanguage (void);
85 
86 #endif  /* CTAGS_MAIN_READ_H */
87