From 5af9d066ccb95741752b621d96dd33f4c27e5b2b Mon Sep 17 00:00:00 2001 From: ketmar Date: Mon, 18 Aug 2014 23:05:13 +0300 Subject: [PATCH] nothing --- defaults/build/Jambase.build.hdr | 22 +++++++++++++++++++++- defaults/main/Jambase.main.gdc | 2 +- src/headers.c | 30 +++++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/defaults/build/Jambase.build.hdr b/defaults/build/Jambase.build.hdr index db85f5e..05895e4 100644 --- a/defaults/build/Jambase.build.hdr +++ b/defaults/build/Jambase.build.hdr @@ -33,7 +33,7 @@ rule HdrMacroFile { # automatically during header scanning on sources handled by the @Object # rule (e.g. sources in @Main or @Library rules) # -rule HdrRule-default { +rule HdrRule-default source : headers { # HdrRule source : headers ; # N.B. This rule is called during binding, potentially after @@ -48,7 +48,27 @@ rule HdrRule-default { local s = $(>:G=$(HDRGRIST:E)) ; +# Echo "HdrRule (<):" $(<) ; +# Echo "HdrRule (1):" $(1) ; +# Echo "HdrRule (2):" $(2) ; +# Echo "HdrRule (3):" $(3) ; +# Echo "HdrRule (4):" $(4) ; +# Echo "HdrRule (s):" $(s) ; + Includes $(<) : $(s) ; + + # include "package.d" -- just in case +# if $(headers) ~= '^.+/.+\.d$' { +# local mt = [ Match '^(.+).d$' : $(headers) ] ; +# if $(mt[1]) { +# mt = $(mt[1]) /package.d ; +# mt = $(mt:J=) ; +# s = $(mt:G=$(HDRGRIST:E)) ; +# Echo "s:" $(s) ; +# Includes $(<) : $(s) ; +# } +# } + SEARCH on $(s) = $(HDRSEARCH) ; NoCare $(s) ; diff --git a/defaults/main/Jambase.main.gdc b/defaults/main/Jambase.main.gdc index aa5147d..717b988 100644 --- a/defaults/main/Jambase.main.gdc +++ b/defaults/main/Jambase.main.gdc @@ -19,7 +19,7 @@ # _image_ may be supplied without suffix. # rule Gdc-Main { - DLANG = `tan` ; + #DLANG = `tan` ; local _tgts = [ --MainNormalizeTargets-- $(1) : $(3) ] ; local _xl = [ --MainFromObjects-- $(<) : $(>:S=$(SUFOBJ)) : $(_tgts) : Gdc-Link : $(>) ] ; Objects $(_xl) : $(3) : $(1) ; diff --git a/src/headers.c b/src/headers.c index 7416c81..7ded295 100644 --- a/src/headers.c +++ b/src/headers.c @@ -108,13 +108,37 @@ LIST *headers1 (const char *file, LIST *hdrscan) { } } } - if (DEBUG_HEADER) printf("DBG: trying header [%s]\n", file); - if (!(f = fopen(file, "r"))) return result; + { + char *t = strrchr(file, '.'); + dlang = (t != NULL && (strcmp(t, ".d") == 0 || strcmp(t, ".di") == 0)); + } + if (DEBUG_HEADER) printf("DBG: trying header [%s] (D=%d)\n", file, dlang); + //fprintf(stderr, "DBG: trying header [%s] (D=%d)\n", file, dlang); + if (!(f = fopen(file, "r"))) { + // for D: try package.d + if (dlang) { + char *na = alloca(strlen(file)*2); + strcpy(na, file); + char *t = strrchr(na, '.'); + if (t != NULL) *na = 0; + strcat(na, "/package.d"); + //fprintf(stderr, "*** TRYING package: [%s]\n", na); + file = na; + if (!(f = fopen(file, "r"))) return result; + //fprintf(stderr, "*** FOUND package: [%s]\n", na); + } else { + return result; + } + return result; + } + //fprintf(stderr, "DBG: processing header [%s] (D=%d)\n", file, dlang); + /* { LIST *t = var_get("DLANG"); dlang = (t != NULL && t->string[0]); //fprintf(stderr, "DLANG: %d\n", dlang); } + */ if (dlang) { re[rec++] = regexp_compile("\\bimport\\s+(.+?)\\s*;", 0); re[rec++] = regexp_compile("\\bimport\\s*\\((.+?)\\)", 0); @@ -164,7 +188,7 @@ LIST *headers1 (const char *file, LIST *hdrscan) { if (*p) { for (t = p; *t; ++t) if (*t == '.') *t = '/'; *(strrchr(p, '/')) = '.'; // restore '.d' - //fprintf(stderr, "dlang include: [%s]\n", p); + fprintf(stderr, "dlang include: [%s]\n", p); result = list_new(result, p, 0); } s = mt[1].ep; -- 2.11.4.GIT