]> git.sur5r.net Git - cc65/blobdiff - src/ca65/incpath.c
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / ca65 / incpath.c
index d3fd72ea3e0478920d668f29192081cee3d087d0..ff21b175dea3f6aa27732a13fb68f1e8fcc78b1a 100644 (file)
@@ -1,12 +1,12 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                                incpath.c                                 */
+/*                                 incpath.c                                 */
 /*                                                                           */
-/*           Include path handling for the ca65 macro assembler             */
+/*            Include path handling for the ca65 macro assembler             */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/* (C) 2000-2013, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
 
 
 
-/* common */
-#include "searchpath.h"
-
 /* ca65 */
 #include "incpath.h"
 
 
 
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
 
-#define INC_STD         0x0001U
+SearchPaths*    IncSearchPath;          /* Standard include path */
+SearchPaths*    BinSearchPath;          /* Binary include path */
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 
-void AddIncludePath (const char* NewPath)
-/* Add a new include path to the existing one */
-{
-    AddSearchPath (NewPath, INC_STD);
-}
-
-
-
-char* FindInclude (const char* Name)
-/* Find an include file. Return a pointer to a malloced area that contains
- * the complete path, if found, return 0 otherwise.
- */
+void InitIncludePaths (void)
+/* Initialize the include path search list */
 {
-    /* Search in the include directories */
-    return SearchFile (Name, INC_STD);
+    /* Create the search path lists */
+    IncSearchPath = NewSearchPath ();
+    BinSearchPath = NewSearchPath ();
 }
 
 
 
-void ForgetAllIncludePaths (void)
-/* Remove all include search paths. */
+void FinishIncludePaths (void)
+/* Finish creating the include path search list. */
 {
-    ForgetAllSearchPaths (INC_STD);
-}
-
-
+    /* Add specific paths from the environment */
+    AddSearchPathFromEnv (IncSearchPath, "CA65_INC");
 
-void InitIncludePaths (void)
-/* Initialize the include path search list */
-{
-    /* Add some standard paths to the include search path */
-    AddSearchPath ("", INC_STD);               /* Current directory */
+    /* Add paths relative to a main directory defined in an env. var. */
+    AddSubSearchPathFromEnv (IncSearchPath, "CC65_HOME", "asminc");
 
-    /* Add some compiled in search paths if defined at compile time */
-#ifdef CA65_INC
-    AddSearchPath (CA65_INC, INC_STD);
+    /* Add some compiled-in search paths if defined at compile time. */
+#if defined(CA65_INC) && !defined(_WIN32)
+    AddSearchPath (IncSearchPath, STRINGIZE (CA65_INC));
 #endif
 
-    /* Add specific paths from the environment */
-    AddSearchPathFromEnv ("CA65_INC", INC_STD);
-
-    /* Add paths relative to a main directory defined in an env var */
-    AddSubSearchPathFromEnv ("CC65_HOME", "asminc", INC_STD);
+    /* Add paths relative to the parent directory of the Windows binary. */
+    AddSubSearchPathFromWinBin (IncSearchPath, "asminc");
 }
-
-
-