/*****************************************************************************/
/* */
-/* incpath.c */
+/* incpath.c */
/* */
-/* Include path handling for the ca65 macro assembler */
+/* Include path handling for the ca65 macro assembler */
/* */
/* */
/* */
-/* (C) 2000-2010, 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"
/*****************************************************************************/
-/* Code */
+/* Data */
/*****************************************************************************/
-void AddIncludePath (const char* NewPath, unsigned Where)
-/* Add a new include path to the existing one */
-{
- AddSearchPath (NewPath, Where);
-}
+SearchPaths* IncSearchPath; /* Standard include path */
+SearchPaths* BinSearchPath; /* Binary include path */
-char* FindInclude (const char* Name, unsigned Where)
-/* Find an include file. Return a pointer to a malloced area that contains
- * the complete path, if found, return 0 otherwise.
- */
-{
- /* Search in the include directories */
- return SearchFile (Name, Where);
-}
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
-void ForgetAllIncludePaths (void)
-/* Remove all include search paths. */
+void InitIncludePaths (void)
+/* Initialize the include path search list */
{
- ForgetAllSearchPaths (INC_STD | INC_BIN);
+ /* Create the search path lists */
+ IncSearchPath = NewSearchPath ();
+ BinSearchPath = NewSearchPath ();
}
-void InitIncludePaths (void)
-/* Initialize the include path search list */
+void FinishIncludePaths (void)
+/* Finish creating the include path search list. */
{
- /* Add some standard paths to the include search path */
- AddSearchPath ("", INC_STD); /* Current directory */
- AddSearchPath ("", INC_BIN);
-
- /* Add some compiled in search paths if defined at compile time */
-#ifdef CA65_INC
- AddSearchPath (CA65_INC, INC_STD);
-#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);
-}
+ AddSearchPathFromEnv (IncSearchPath, "CA65_INC");
+ /* 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. */
+#if defined(CA65_INC) && !defined(_WIN32)
+ AddSearchPath (IncSearchPath, STRINGIZE (CA65_INC));
+#endif
+ /* Add paths relative to the parent directory of the Windows binary. */
+ AddSubSearchPathFromWinBin (IncSearchPath, "asminc");
+}