summaryrefslogtreecommitdiff
path: root/parse/use.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-05-13 19:31:35 -0700
committerOri Bernstein <ori@eigenstate.org>2016-05-13 19:31:36 -0700
commit5bc9a99994e20a7d5ea6bc298e4b37bf7db2e48d (patch)
tree48888d7c487c74cf4227ef7ec3820be907738876 /parse/use.c
parentf8152dae21873cf42f2d65bdf657a717c2240a25 (diff)
downloadmc-5bc9a99994e20a7d5ea6bc298e4b37bf7db2e48d.tar.gz
Switch to using lib{}.use.
Does 3 things; 1) Teaches the compiler about how to load libfoo.use, falling back to 'foo' 2) teaches muse how to generate packages named 'pkg' in fille 'libthing.use' 3) teaches mbld how to look up and resolve libfoo.use named usefiles. Eventually a fallback will be implemented.
Diffstat (limited to 'parse/use.c')
-rw-r--r--parse/use.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/parse/use.c b/parse/use.c
index de95606..59421b1 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -1042,6 +1042,16 @@ void readuse(Node *use, Stab *st, Vis vis)
/* nonlocal (barename) uses are always searched on the include path */
} else {
for (i = 0; i < nincpaths; i++) {
+ snprintf(buf, sizeof buf, "lib%s.use", use->use.name);
+ t = strjoin(incpaths[i], "/");
+ p = strjoin(t, buf);
+ fd = fopen(p, "r");
+ if (fd) {
+ free(t);
+ break;
+ }
+ free(p);
+
t = strjoin(incpaths[i], "/");
p = strjoin(t, use->use.name);
fd = fopen(p, "r");