]> git.sur5r.net Git - cc65/blob - src/cc65/input.h
8f3a783c79fa979aa614f2f7d7bd1653a0560e61
[cc65] / src / cc65 / input.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  input.h                                  */
4 /*                                                                           */
5 /*                            Input file handling                            */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2000      Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef INPUT_H
37 #define INPUT_H
38
39
40
41 /*****************************************************************************/
42 /*                                   data                                    */
43 /*****************************************************************************/
44
45
46
47 /* Maximum length of an input line and the corresponding char array */
48 #define LINEMAX         4095
49 #define LINESIZE        LINEMAX+1
50
51 /* Input line stuff */
52 extern char* line;
53 extern const char* lptr;                /* ### Remove this */
54
55 /* Current and next input character */
56 extern char CurC;
57 extern char NextC;
58
59
60
61 /*****************************************************************************/
62 /*                                   Code                                    */
63 /*****************************************************************************/
64
65
66
67 void OpenMainFile (const char* Name);
68 /* Open the main file. Will call Fatal() in case of failures. */
69
70 void OpenIncludeFile (const char* Name, unsigned DirSpec);
71 /* Open an include file and insert it into the tables. */
72
73 void ClearLine (void);
74 /* Clear the current input line */
75
76 void InitLine (const char* Buf);
77 /* Initialize lptr from Buf and read CurC and NextC from the new input line */
78
79 void NextChar (void);
80 /* Read the next character from the input stream and make CurC and NextC
81  * valid. If end of line is reached, both are set to NUL, no more lines
82  * are read by this function.
83  */
84
85 int NextLine (void);
86 /* Get a line from the current input. Returns 0 on end of file. */
87
88 const char* GetCurrentFile (void);
89 /* Return the name of the current input file */
90
91 unsigned GetCurrentLine (void);
92 /* Return the line number in the current input file */
93
94
95
96 /* End of input.h */
97 #endif
98
99
100