]> git.sur5r.net Git - cc65/commitdiff
Remember the type of the input file. This may be used later to create more
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 22 Apr 2010 19:40:50 +0000 (19:40 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 22 Apr 2010 19:40:50 +0000 (19:40 +0000)
variants of dependency files.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4645 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/input.c
src/cc65/input.h

index 552a4105c5559994ee68dcf93a076ecee0e8ce60..6d57179a0b2cca94a53e20bc9d7bfa7be7a72b7b 100644 (file)
@@ -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 */
index 7fc90d247d9a58b51f60476c4523c95aac5d21af..a4208cc77a4299ed9f0ead10675623a1e38158b3 100644 (file)
@@ -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       */
 
 
 /*****************************************************************************/
-/*                                  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) */
 };