]> git.sur5r.net Git - cc65/blobdiff - src/ca65/incpath.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / incpath.c
index 2abd99f6203c57e7d3c360cc9053141fedd8b81f..59749d8d234ad59dee2699e78c748f077fb304a2 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2003 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       */
@@ -33,9 +33,6 @@
 
 
 
-/* common */
-#include "searchpath.h"
-
 /* ca65 */
 #include "incpath.h"
 
@@ -47,7 +44,8 @@
 
 
 
-#define INC_STD         0x0001U
+SearchPath*     IncSearchPath;          /* Standard include path */
+SearchPath*     BinSearchPath;          /* Binary include path */
 
 
 
 
 
 
-void AddIncludePath (const char* NewPath)
-/* Add a new include path to the existing one */
+void ForgetAllIncludePaths (void)
+/* Remove all include search paths. */
 {
-    AddSearchPath (NewPath, INC_STD);
+    ForgetSearchPath (IncSearchPath);
+    ForgetSearchPath (BinSearchPath);
 }
 
 
 
-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 ();
+
+    /* Add the current directory to the search paths */
+    AddSearchPath (IncSearchPath, "");
+    AddSearchPath (BinSearchPath, "");
+
+    /* Add some compiled in search paths if defined at compile time */
+#ifdef CA65_INC
+    AddSearchPath (IncSearchPath, CA65_INC);
+#endif
+
+    /* Add specific paths from the environment */
+    AddSearchPathFromEnv (IncSearchPath, "CA65_INC");
+
+    /* Add paths relative to a main directory defined in an env var */
+    AddSubSearchPathFromEnv (IncSearchPath, "CC65_HOME", "asminc");
 }