X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fincpath.c;h=fdbca2a078e4b768334bca85e16d998a9f99aea0;hb=7aefd9b4e7b67908b7b3c38b6003c7f1a8d3ee2d;hp=b9e8d517ab07b79000672d627a642e3886a63fbb;hpb=a0d9edf5bab7cfb6693fce60aae2ee087e56fe5e;p=cc65 diff --git a/src/cc65/incpath.c b/src/cc65/incpath.c index b9e8d517a..fdbca2a07 100644 --- a/src/cc65/incpath.c +++ b/src/cc65/incpath.c @@ -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,34 +33,33 @@ -/* common */ -#include "searchpath.h" - /* cc65 */ #include "incpath.h" /*****************************************************************************/ -/* Code */ +/* Data */ /*****************************************************************************/ -void AddIncludePath (const char* NewPath, unsigned Where) -/* Add a new include path to the existing one */ -{ - AddSearchPath (NewPath, Where); -} +SearchPath* SysIncSearchPath; /* System include path */ +SearchPath* UsrIncSearchPath; /* User include path */ + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ -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. - */ +void ForgetAllIncludePaths (void) +/* Remove all include search paths. */ { - return SearchFile (Name, Where); + ForgetSearchPath (SysIncSearchPath); + ForgetSearchPath (UsrIncSearchPath); } @@ -68,15 +67,24 @@ char* FindInclude (const char* Name, unsigned Where) void InitIncludePaths (void) /* Initialize the include path search list */ { - /* Add some standard paths to the include search path */ - AddSearchPath ("", INC_USER); /* Current directory */ - AddSearchPath ("include", INC_SYS); + /* Create the search path lists */ + SysIncSearchPath = NewSearchPath (); + UsrIncSearchPath = NewSearchPath (); + + /* Add the current path to the user search path list */ + AddSearchPath (UsrIncSearchPath, ""); + + /* Add some compiled in search paths if defined at compile time */ #ifdef CC65_INC - AddSearchPath (CC65_INC, INC_SYS); -#else - AddSearchPath ("/usr/lib/cc65/include", INC_SYS); + AddSearchPath (SysIncSearchPath, CC65_INC); #endif - AddSearchPathFromEnv ("CC65_INC", INC_SYS | INC_USER); + + /* Add specific paths from the environment */ + AddSearchPathFromEnv (SysIncSearchPath, "CC65_INC"); + AddSearchPathFromEnv (UsrIncSearchPath, "CC65_INC"); + + /* Add paths relative to a main directory defined in an env var */ + AddSubSearchPathFromEnv (SysIncSearchPath, "CC65_HOME", "include"); }