From: uz Date: Thu, 22 Apr 2010 19:40:50 +0000 (+0000) Subject: Remember the type of the input file. This may be used later to create more X-Git-Tag: V2.13.3~778 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2e6d218801c3de0bc3affe7907b8afb3140f9a90;p=cc65 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 --- diff --git a/src/cc65/input.c b/src/cc65/input.c index 552a4105c..6d57179a0 100644 --- a/src/cc65/input.c +++ b/src/cc65/input.c @@ -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 */ diff --git a/src/cc65/input.h b/src/cc65/input.h index 7fc90d247..a4208cc77 100644 --- a/src/cc65/input.h +++ b/src/cc65/input.h @@ -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) */ };