mirror of
https://github.com/cc65/cc65.git
synced 2024-12-26 08:32:00 +00:00
Remember the type of the input file. This may be used later to create more
variants of dependency files. git-svn-id: svn://svn.cc65.org/cc65/trunk@4645 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
bfd8f4e108
commit
2e6d218801
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2009, Ullrich von Bassewitz */
|
||||
/* (C) 2000-2010, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
@ -95,7 +95,7 @@ static Collection InputStack = STATIC_COLLECTION_INITIALIZER;
|
||||
|
||||
|
||||
|
||||
static IFile* NewIFile (const char* Name)
|
||||
static IFile* NewIFile (const char* Name, InputType Type)
|
||||
/* Create and return a new IFile */
|
||||
{
|
||||
/* Get the length of the name */
|
||||
@ -109,6 +109,7 @@ static IFile* NewIFile (const char* Name)
|
||||
IF->Usage = 0;
|
||||
IF->Size = 0;
|
||||
IF->MTime = 0;
|
||||
IF->Type = Type;
|
||||
memcpy (IF->Name, Name, Len+1);
|
||||
|
||||
/* Insert the new structure into the IFile collection */
|
||||
@ -200,7 +201,7 @@ static IFile* FindFile (const char* Name)
|
||||
if (strcmp (Name, IF->Name) == 0) {
|
||||
/* Found, return the struct */
|
||||
return IF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Not found */
|
||||
@ -216,7 +217,7 @@ void OpenMainFile (const char* Name)
|
||||
|
||||
|
||||
/* Setup a new IFile structure for the main file */
|
||||
IFile* IF = NewIFile (Name);
|
||||
IFile* IF = NewIFile (Name, IT_MAIN);
|
||||
|
||||
/* Open the file for reading */
|
||||
FILE* F = fopen (Name, "r");
|
||||
@ -264,7 +265,7 @@ void OpenIncludeFile (const char* Name, unsigned DirSpec)
|
||||
*/
|
||||
IF = FindFile (N);
|
||||
if (IF == 0) {
|
||||
IF = NewIFile (N);
|
||||
IF = NewIFile (N, (DirSpec == INC_SYS)? IT_SYSINC : IT_USERINC);
|
||||
}
|
||||
|
||||
/* We don't need N any longer, since we may now use IF->Name */
|
||||
|
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2000-2004 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2000-2010, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -46,11 +46,18 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* data */
|
||||
/* data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* An enum that describes different types of input files */
|
||||
typedef enum {
|
||||
IT_MAIN, /* Main input file */
|
||||
IT_SYSINC, /* System include file (using <>) */
|
||||
IT_USERINC, /* User include file (using "") */
|
||||
} InputType;
|
||||
|
||||
/* The current input line */
|
||||
extern StrBuf* Line;
|
||||
|
||||
@ -65,6 +72,7 @@ struct IFile {
|
||||
unsigned Usage; /* Usage counter */
|
||||
unsigned long Size; /* File size */
|
||||
unsigned long MTime; /* Time of last modification */
|
||||
InputType Type; /* Type of input file */
|
||||
char Name[1]; /* Name of file (dynamically allocated) */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user