2000-06-14 21:01:37 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* input.c */
|
|
|
|
/* */
|
|
|
|
/* Input file handling */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* (C) 2000 Ullrich von Bassewitz */
|
|
|
|
/* Wacholderweg 14 */
|
|
|
|
/* D-70597 Stuttgart */
|
|
|
|
/* EMail: uz@musoftware.de */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
2001-05-22 20:03:26 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2000-06-14 21:01:37 +00:00
|
|
|
|
2000-08-01 15:04:35 +00:00
|
|
|
/* common */
|
|
|
|
#include "check.h"
|
2000-09-01 19:20:32 +00:00
|
|
|
#include "coll.h"
|
2000-08-01 15:04:35 +00:00
|
|
|
#include "xmalloc.h"
|
2000-06-14 21:01:37 +00:00
|
|
|
|
2000-08-01 15:04:35 +00:00
|
|
|
/* cc65 */
|
2001-05-23 21:44:14 +00:00
|
|
|
#include "asmcode.h"
|
2001-05-22 20:03:26 +00:00
|
|
|
#include "codegen.h"
|
2000-06-14 21:01:37 +00:00
|
|
|
#include "error.h"
|
|
|
|
#include "incpath.h"
|
2001-05-22 09:32:24 +00:00
|
|
|
#include "lineinfo.h"
|
2000-06-14 21:01:37 +00:00
|
|
|
#include "input.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2000-06-21 21:02:44 +00:00
|
|
|
/* Data */
|
2000-06-14 21:01:37 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-06-15 19:03:01 +00:00
|
|
|
/* Input line stuff */
|
|
|
|
static char LineBuf [LINESIZE];
|
|
|
|
char* line = LineBuf;
|
2000-06-21 21:02:44 +00:00
|
|
|
const char* lptr = LineBuf;
|
|
|
|
|
|
|
|
/* Current and next input character */
|
|
|
|
char CurC = '\0';
|
|
|
|
char NextC = '\0';
|
2000-06-15 19:03:01 +00:00
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
/* Maximum count of nested includes */
|
2000-06-21 21:02:44 +00:00
|
|
|
#define MAX_INC_NESTING 16
|
2000-06-14 21:01:37 +00:00
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Struct that describes an active input file */
|
|
|
|
typedef struct AFile AFile;
|
|
|
|
struct AFile {
|
|
|
|
unsigned Line; /* Line number for this file */
|
|
|
|
FILE* F; /* Input file stream */
|
2001-05-22 09:32:24 +00:00
|
|
|
IFile* Input; /* Points to corresponding IFile */
|
2000-09-01 19:20:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* List of all input files */
|
|
|
|
static Collection IFiles = STATIC_COLLECTION_INITIALIZER;
|
2000-06-21 21:02:44 +00:00
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* List of all active files */
|
|
|
|
static Collection AFiles = STATIC_COLLECTION_INITIALIZER;
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-05-23 21:44:14 +00:00
|
|
|
/* struct IFile */
|
2000-06-14 21:01:37 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
static IFile* NewIFile (const char* Name)
|
2000-06-14 21:01:37 +00:00
|
|
|
/* Create and return a new IFile */
|
|
|
|
{
|
|
|
|
/* Get the length of the name */
|
|
|
|
unsigned Len = strlen (Name);
|
|
|
|
|
|
|
|
/* Allocate a IFile structure */
|
2001-03-23 19:17:04 +00:00
|
|
|
IFile* IF = (IFile*) xmalloc (sizeof (IFile) + Len);
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Initialize the fields */
|
2000-09-01 19:20:32 +00:00
|
|
|
IF->Index = CollCount (&IFiles) + 1;
|
|
|
|
IF->Usage = 0;
|
2001-05-22 20:03:26 +00:00
|
|
|
IF->Size = 0;
|
|
|
|
IF->MTime = 0;
|
2000-06-14 21:01:37 +00:00
|
|
|
memcpy (IF->Name, Name, Len+1);
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Insert the new structure into the IFile collection */
|
|
|
|
CollAppend (&IFiles, IF);
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Return the new struct */
|
|
|
|
return IF;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* struct AFile */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static AFile* NewAFile (IFile* IF, FILE* F)
|
|
|
|
/* Create and return a new AFile */
|
|
|
|
{
|
|
|
|
/* Allocate a AFile structure */
|
2001-03-23 19:17:04 +00:00
|
|
|
AFile* AF = (AFile*) xmalloc (sizeof (AFile));
|
2000-09-01 19:20:32 +00:00
|
|
|
|
|
|
|
/* Initialize the fields */
|
|
|
|
AF->Line = 0;
|
|
|
|
AF->F = F;
|
2001-05-22 09:32:24 +00:00
|
|
|
AF->Input = IF;
|
2000-09-01 19:20:32 +00:00
|
|
|
|
2001-05-22 20:03:26 +00:00
|
|
|
/* Increment the usage counter of the corresponding IFile. If this
|
|
|
|
* is the first use, set the file data and output debug info if
|
|
|
|
* requested.
|
|
|
|
*/
|
|
|
|
if (IF->Usage++ == 0) {
|
|
|
|
|
2001-05-23 21:44:14 +00:00
|
|
|
/* Get file size and modification time */
|
|
|
|
struct stat Buf;
|
|
|
|
if (fstat (fileno (F), &Buf) != 0) {
|
|
|
|
/* Error */
|
2001-05-22 20:03:26 +00:00
|
|
|
Fatal ("Cannot stat `%s': %s", IF->Name, strerror (errno));
|
|
|
|
}
|
2001-05-23 21:44:14 +00:00
|
|
|
IF->Size = (unsigned long) Buf.st_size;
|
|
|
|
IF->MTime = (unsigned long) Buf.st_mtime;
|
2001-05-22 20:03:26 +00:00
|
|
|
|
|
|
|
/* Set the debug data */
|
|
|
|
g_fileinfo (IF->Name, IF->Size, IF->MTime);
|
|
|
|
}
|
2000-09-01 19:20:32 +00:00
|
|
|
|
|
|
|
/* Insert the new structure into the AFile collection */
|
|
|
|
CollAppend (&AFiles, AF);
|
|
|
|
|
|
|
|
/* Return the new struct */
|
|
|
|
return AF;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void FreeAFile (AFile* AF)
|
|
|
|
/* Free an AFile structure */
|
|
|
|
{
|
|
|
|
xfree (AF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Code */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
static IFile* FindFile (const char* Name)
|
|
|
|
/* Find the file with the given name in the list of all files. Since the list
|
|
|
|
* is not large (usually less than 10), I don't care about using hashes or
|
|
|
|
* similar things and do a linear search.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
unsigned I;
|
|
|
|
for (I = 0; I < CollCount (&IFiles); ++I) {
|
|
|
|
/* Get the file struct */
|
2001-03-23 19:17:04 +00:00
|
|
|
IFile* IF = (IFile*) CollAt (&IFiles, I);
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Check the name */
|
|
|
|
if (strcmp (Name, IF->Name) == 0) {
|
|
|
|
/* Found, return the struct */
|
|
|
|
return IF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Not found */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
void OpenMainFile (const char* Name)
|
|
|
|
/* Open the main file. Will call Fatal() in case of failures. */
|
|
|
|
{
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Setup a new IFile structure for the main file */
|
|
|
|
IFile* IF = NewIFile (Name);
|
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
/* Open the file for reading */
|
|
|
|
FILE* F = fopen (Name, "r");
|
|
|
|
if (F == 0) {
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Cannot open */
|
2000-10-15 19:52:01 +00:00
|
|
|
Fatal ("Cannot open input file `%s': %s", Name, strerror (errno));
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Allocate a new AFile structure for the file */
|
|
|
|
(void) NewAFile (IF, F);
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OpenIncludeFile (const char* Name, unsigned DirSpec)
|
|
|
|
/* Open an include file and insert it into the tables. */
|
|
|
|
{
|
2000-09-01 19:20:32 +00:00
|
|
|
char* N;
|
|
|
|
FILE* F;
|
|
|
|
IFile* IF;
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Check for the maximum include nesting */
|
2000-09-01 19:20:32 +00:00
|
|
|
if (CollCount (&AFiles) > MAX_INC_NESTING) {
|
2000-10-15 19:52:01 +00:00
|
|
|
PPError ("Include nesting too deep");
|
2000-06-15 19:03:01 +00:00
|
|
|
return;
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Search for the file */
|
|
|
|
N = FindInclude (Name, DirSpec);
|
|
|
|
if (N == 0) {
|
2000-10-15 19:52:01 +00:00
|
|
|
PPError ("Include file `%s' not found", Name);
|
2000-06-14 21:01:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Search the list of all input files for this file. If we don't find
|
|
|
|
* it, create a new IFile object.
|
|
|
|
*/
|
|
|
|
IF = FindFile (N);
|
|
|
|
if (IF == 0) {
|
|
|
|
IF = NewIFile (N);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We don't need N any longer, since we may now use IF->Name */
|
|
|
|
xfree (N);
|
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
/* Open the file */
|
2000-09-01 19:20:32 +00:00
|
|
|
F = fopen (IF->Name, "r");
|
2000-06-14 21:01:37 +00:00
|
|
|
if (F == 0) {
|
|
|
|
/* Error opening the file */
|
2000-10-15 19:52:01 +00:00
|
|
|
PPError ("Cannot open include file `%s': %s", IF->Name, strerror (errno));
|
2000-06-14 21:01:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Allocate a new AFile structure */
|
|
|
|
(void) NewAFile (IF, F);
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void CloseIncludeFile (void)
|
|
|
|
/* Close an include file and switch to the higher level file. Set Input to
|
|
|
|
* NULL if this was the main file.
|
|
|
|
*/
|
|
|
|
{
|
2000-09-01 19:20:32 +00:00
|
|
|
AFile* Input;
|
|
|
|
|
|
|
|
/* Get the number of active input files */
|
|
|
|
unsigned AFileCount = CollCount (&AFiles);
|
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
/* Must have an input file when called */
|
2000-09-01 19:20:32 +00:00
|
|
|
PRECONDITION (AFileCount > 0);
|
|
|
|
|
|
|
|
/* Get the current active input file */
|
2001-03-23 19:17:04 +00:00
|
|
|
Input = (AFile*) CollLast (&AFiles);
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Close the current input file (we're just reading so no error check) */
|
|
|
|
fclose (Input->F);
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Delete the last active file from the active file collection */
|
|
|
|
CollDelete (&AFiles, AFileCount-1);
|
2000-06-21 21:02:44 +00:00
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* Delete the active file structure */
|
|
|
|
FreeAFile (Input);
|
2000-06-21 21:02:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ClearLine (void)
|
|
|
|
/* Clear the current input line */
|
|
|
|
{
|
|
|
|
line[0] = '\0';
|
|
|
|
lptr = line;
|
|
|
|
CurC = '\0';
|
|
|
|
NextC = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InitLine (const char* Buf)
|
|
|
|
/* Initialize lptr from Buf and read CurC and NextC from the new input line */
|
|
|
|
{
|
|
|
|
lptr = Buf;
|
|
|
|
CurC = lptr[0];
|
|
|
|
if (CurC != '\0') {
|
|
|
|
NextC = lptr[1];
|
|
|
|
} else {
|
|
|
|
NextC = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void NextChar (void)
|
|
|
|
/* Read the next character from the input stream and make CurC and NextC
|
|
|
|
* valid. If end of line is reached, both are set to NUL, no more lines
|
|
|
|
* are read by this function.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
if (lptr[0] != '\0') {
|
|
|
|
++lptr;
|
|
|
|
CurC = lptr[0];
|
|
|
|
if (CurC != '\0') {
|
|
|
|
NextC = lptr[1];
|
|
|
|
} else {
|
|
|
|
NextC = '\0';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
CurC = NextC = '\0';
|
|
|
|
}
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int NextLine (void)
|
|
|
|
/* Get a line from the current input. Returns 0 on end of file. */
|
|
|
|
{
|
2000-09-01 19:20:32 +00:00
|
|
|
AFile* Input;
|
2000-06-14 21:01:37 +00:00
|
|
|
unsigned Len;
|
|
|
|
unsigned Part;
|
|
|
|
unsigned Start;
|
|
|
|
int Done;
|
|
|
|
|
|
|
|
/* Setup the line */
|
2000-06-15 19:03:01 +00:00
|
|
|
ClearLine ();
|
2000-06-14 21:01:37 +00:00
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* If there is no file open, bail out, otherwise get the current input file */
|
|
|
|
if (CollCount (&AFiles) == 0) {
|
2000-06-14 21:01:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-03-23 19:17:04 +00:00
|
|
|
Input = (AFile*) CollLast (&AFiles);
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Read lines until we get one with real contents */
|
|
|
|
Len = 0;
|
|
|
|
Done = 0;
|
|
|
|
while (!Done && Len < LINESIZE) {
|
|
|
|
|
|
|
|
while (fgets (line + Len, LINESIZE - Len, Input->F) == 0) {
|
|
|
|
|
2000-06-15 19:03:01 +00:00
|
|
|
/* Assume EOF */
|
|
|
|
ClearLine ();
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Leave the current file */
|
|
|
|
CloseIncludeFile ();
|
|
|
|
|
2000-09-01 19:20:32 +00:00
|
|
|
/* If there is no file open, bail out, otherwise get the
|
|
|
|
* current input file
|
|
|
|
*/
|
|
|
|
if (CollCount (&AFiles) == 0) {
|
|
|
|
return 0;
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
2001-03-23 19:17:04 +00:00
|
|
|
Input = (AFile*) CollLast (&AFiles);
|
2000-09-01 19:20:32 +00:00
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We got a new line */
|
|
|
|
++Input->Line;
|
|
|
|
|
2002-09-30 19:32:33 +00:00
|
|
|
/* Remove the trailing cr/lf if we have one. We will ignore both, cr
|
|
|
|
* and lf on all systems since this enables us to compile DOS/Windows
|
|
|
|
* stuff also on unix systems (where fgets does not remove the cr).
|
|
|
|
*/
|
2000-06-14 21:01:37 +00:00
|
|
|
Part = strlen (line + Len);
|
|
|
|
Start = Len;
|
|
|
|
Len += Part;
|
2002-09-30 19:32:33 +00:00
|
|
|
while (Len > 0 && (line[Len-1] == '\n' || line[Len-1] == '\r')) {
|
2000-06-14 21:01:37 +00:00
|
|
|
--Len;
|
|
|
|
}
|
2000-06-15 19:03:01 +00:00
|
|
|
line [Len] = '\0';
|
2000-06-14 21:01:37 +00:00
|
|
|
|
|
|
|
/* Check if we have a line continuation character at the end. If not,
|
|
|
|
* we're done.
|
|
|
|
*/
|
|
|
|
if (Len > 0 && line[Len-1] == '\\') {
|
|
|
|
line[Len-1] = '\n'; /* Replace by newline */
|
2000-06-15 19:03:01 +00:00
|
|
|
} else {
|
|
|
|
Done = 1;
|
|
|
|
}
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
2000-06-21 21:02:44 +00:00
|
|
|
/* Got a line. Initialize the current and next characters. */
|
|
|
|
InitLine (line);
|
2000-06-14 21:01:37 +00:00
|
|
|
|
2001-05-22 09:32:24 +00:00
|
|
|
/* Create line information for this line */
|
|
|
|
UpdateLineInfo (Input->Input, Input->Line, line);
|
|
|
|
|
2000-06-21 21:02:44 +00:00
|
|
|
/* Done */
|
|
|
|
return 1;
|
2000-06-15 19:03:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-06-14 21:01:37 +00:00
|
|
|
const char* GetCurrentFile (void)
|
|
|
|
/* Return the name of the current input file */
|
|
|
|
{
|
2000-09-01 19:20:32 +00:00
|
|
|
unsigned AFileCount = CollCount (&AFiles);
|
|
|
|
if (AFileCount > 0) {
|
2001-03-23 19:17:04 +00:00
|
|
|
const AFile* AF = (const AFile*) CollAt (&AFiles, AFileCount-1);
|
2001-05-22 09:32:24 +00:00
|
|
|
return AF->Input->Name;
|
2000-09-01 19:20:32 +00:00
|
|
|
} else {
|
|
|
|
/* No open file. Use the main file if we have one. */
|
|
|
|
unsigned IFileCount = CollCount (&IFiles);
|
|
|
|
if (IFileCount > 0) {
|
2001-03-23 19:17:04 +00:00
|
|
|
const IFile* IF = (const IFile*) CollAt (&IFiles, 0);
|
2000-09-01 19:20:32 +00:00
|
|
|
return IF->Name;
|
2000-06-21 21:02:44 +00:00
|
|
|
} else {
|
|
|
|
return "(outside file scope)";
|
|
|
|
}
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned GetCurrentLine (void)
|
|
|
|
/* Return the line number in the current input file */
|
|
|
|
{
|
2000-09-01 19:20:32 +00:00
|
|
|
unsigned AFileCount = CollCount (&AFiles);
|
|
|
|
if (AFileCount > 0) {
|
2001-03-23 19:17:04 +00:00
|
|
|
const AFile* AF = (const AFile*) CollAt (&AFiles, AFileCount-1);
|
2000-09-01 19:20:32 +00:00
|
|
|
return AF->Line;
|
|
|
|
} else {
|
|
|
|
/* No open file */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void WriteDependencies (FILE* F, const char* OutputFile)
|
|
|
|
/* Write a makefile dependency list to the given file */
|
|
|
|
{
|
|
|
|
unsigned I;
|
|
|
|
|
|
|
|
/* Get the number of input files */
|
|
|
|
unsigned IFileCount = CollCount (&IFiles);
|
|
|
|
|
|
|
|
/* Print the output file followed by a tab char */
|
|
|
|
fprintf (F, "%s:\t", OutputFile);
|
|
|
|
|
|
|
|
/* Loop over all files */
|
|
|
|
for (I = 0; I < IFileCount; ++I) {
|
|
|
|
/* Get the next input file */
|
2001-03-23 19:17:04 +00:00
|
|
|
const IFile* IF = (const IFile*) CollAt (&IFiles, I);
|
2000-09-01 19:20:32 +00:00
|
|
|
/* If this is not the first file, add a space */
|
|
|
|
const char* Format = (I == 0)? "%s" : " %s";
|
|
|
|
/* Print the dependency */
|
|
|
|
fprintf (F, Format, IF->Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* End the line */
|
|
|
|
fprintf (F, "\n\n");
|
2000-06-14 21:01:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|