1 /*****************************************************************************/
5 /* Input file handling */
9 /* (C) 2000-2010, Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
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. */
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: */
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 */
32 /*****************************************************************************/
48 /*****************************************************************************/
50 /*****************************************************************************/
54 /* An enum that describes different types of input files. The members are
55 * choosen so that it is possible to combine them to bitsets
58 IT_MAIN = 0x01, /* Main input file */
59 IT_SYSINC = 0x02, /* System include file (using <>) */
60 IT_USRINC = 0x04, /* User include file (using "") */
63 /* Forward for an IFile structure */
66 /* The current input line */
69 /* Current and next input character */
75 /*****************************************************************************/
77 /*****************************************************************************/
81 void OpenMainFile (const char* Name);
82 /* Open the main file. Will call Fatal() in case of failures. */
84 void OpenIncludeFile (const char* Name, InputType IT);
85 /* Open an include file and insert it into the tables. */
88 /* Read the next character from the input stream and make CurC and NextC
89 * valid. If end of line is reached, both are set to NUL, no more lines
90 * are read by this function.
93 void ClearLine (void);
94 /* Clear the current input line */
96 StrBuf* InitLine (StrBuf* Buf);
97 /* Initialize Line from Buf and read CurC and NextC from the new input line.
98 * The function returns the old input line.
102 /* Get a line from the current input. Returns 0 on end of file. */
104 const char* GetInputFile (const struct IFile* IF);
105 /* Return a filename from an IFile struct */
107 const char* GetCurrentFile (void);
108 /* Return the name of the current input file */
110 unsigned GetCurrentLine (void);
111 /* Return the line number in the current input file */
113 void CreateDependencies (void);
114 /* Create dependency files requested by the user */