aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/cpp/include.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-01 22:09:15 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-11-01 22:09:15 +0000
commitca1f5fcecdda1f33668825d35fdddcf371ba3bdf (patch)
tree0d2f37a7f9d513425c1795513ef34dda1629fd3d /code/tools/lcc/cpp/include.c
parenta6d8e02bc4e17a5b68d3d2f2287f6d7015bccc4d (diff)
downloadioquake3-aero-ca1f5fcecdda1f33668825d35fdddcf371ba3bdf.tar.gz
ioquake3-aero-ca1f5fcecdda1f33668825d35fdddcf371ba3bdf.zip
* Split off q_platform.h from q_shared.h
* Removed lcc PATH hack and replaced with something slightly less hacky * Removed all platform specific hostfiles from lcc and replaced with bytecode.c (from ankon) * Turned lcc option "-S" on permanently * Improved q3cpp so that it recursively adds include dirs to its list git-svn-id: svn://svn.icculus.org/quake3/trunk@209 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools/lcc/cpp/include.c')
-rw-r--r--code/tools/lcc/cpp/include.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/code/tools/lcc/cpp/include.c b/code/tools/lcc/cpp/include.c
index b3757e8..71bd90c 100644
--- a/code/tools/lcc/cpp/include.c
+++ b/code/tools/lcc/cpp/include.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
@@ -6,6 +7,29 @@ Includelist includelist[NINCLUDE];
extern char *objname;
+void appendDirToIncludeList( char *dir )
+{
+ int i;
+
+ //avoid adding it more than once
+ for (i=NINCLUDE-2; i>=0; i--) {
+ if (includelist[i].file &&
+ !strcmp (includelist[i].file, dir)) {
+ return;
+ }
+ }
+
+ for (i=NINCLUDE-2; i>=0; i--) {
+ if (includelist[i].file==NULL) {
+ includelist[i].always = 1;
+ includelist[i].file = dir;
+ break;
+ }
+ }
+ if (i<0)
+ error(FATAL, "Too many -I directives");
+}
+
void
doinclude(Tokenrow *trp)
{
@@ -44,6 +68,9 @@ doinclude(Tokenrow *trp)
if (trp->tp < trp->lp || len==0)
goto syntax;
fname[len] = '\0';
+
+ appendDirToIncludeList( basepath( fname ) );
+
if (fname[0]=='/') {
fd = open(fname, 0);
strcpy(iname, fname);