From 3b0b37f616730c2b4719757303d42b4b009fcc0a Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Tue, 11 Nov 2003 20:16:11 +0000 Subject: [PATCH] Added functions to support preprocessor enhancement. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5296 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Swig/include.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/SWIG/Source/Swig/include.c b/SWIG/Source/Swig/include.c index 288bd662d..746aae309 100644 --- a/SWIG/Source/Swig/include.c +++ b/SWIG/Source/Swig/include.c @@ -68,6 +68,37 @@ Swig_add_directory(const String_or_char *dirname) { Append(directories, dirname); } +/* ----------------------------------------------------------------------------- + * Swig_push_directory() + * + * Inserts a directory at the front of the SWIG search path. This is used by + * the preprocessor to grab files in the same directory as other included files. + * ----------------------------------------------------------------------------- */ + +void +Swig_push_directory(const String_or_char *dirname) { + if (!directories) directories = NewList(); + assert(directories); + if (!DohIsString(dirname)) { + dirname = NewString((char *) dirname); + assert(dirname); + } + Insert(directories, 0, dirname); +} + +/* ----------------------------------------------------------------------------- + * Swig_pop_directory() + * + * Pops a directory off the front of the SWIG search path. This is used by + * the preprocessor. + * ----------------------------------------------------------------------------- */ + +void +Swig_pop_directory() { + if (!directories) return; + Delitem(directories,0); +} + /* ----------------------------------------------------------------------------- * Swig_last_file() *