1 /*****************************************************************************/
5 /* Input file handling */
9 /* (C) 2000 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
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 /*****************************************************************************/
45 /*****************************************************************************/
47 /*****************************************************************************/
51 /* Maximum length of an input line and the corresponding char array */
53 #define LINESIZE LINEMAX+1
55 /* Input line stuff */
57 extern const char* lptr; /* ### Remove this */
59 /* Current and next input character */
63 /* Struct that describes an input file */
64 typedef struct IFile IFile;
66 unsigned Index; /* File index */
67 unsigned Usage; /* Usage counter */
68 unsigned long Size; /* File size */
69 unsigned long MTime; /* Time of last modification */
70 char Name[1]; /* Name of file (dynamically allocated) */
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, unsigned DirSpec);
85 /* Open an include file and insert it into the tables. */
87 void ClearLine (void);
88 /* Clear the current input line */
90 void InitLine (const char* Buf);
91 /* Initialize lptr from Buf and read CurC and NextC from the new input line */
94 /* Read the next character from the input stream and make CurC and NextC
95 * valid. If end of line is reached, both are set to NUL, no more lines
96 * are read by this function.
100 /* Get a line from the current input. Returns 0 on end of file. */
102 const char* GetCurrentFile (void);
103 /* Return the name of the current input file */
105 unsigned GetCurrentLine (void);
106 /* Return the line number in the current input file */
108 void WriteDependencies (FILE* F, const char* OutputFile);
109 /* Write a makefile dependency list to the given file */