summaryrefslogtreecommitdiff
path: root/muse
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 /muse
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 'muse')
-rw-r--r--muse/muse.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/muse/muse.c b/muse/muse.c
index 8b884ab..ccd8c58 100644
--- a/muse/muse.c
+++ b/muse/muse.c
@@ -18,6 +18,7 @@
/* FIXME: move into one place...? */
Node *file;
char *outfile;
+char *pkgname;
int show;
char debugopt[128];
char **incpaths;
@@ -27,7 +28,7 @@ size_t nextralibs;
static void usage(char *prog)
{
- printf("%s [-hIdos] [-o outfile] [-m] inputs\n", prog);
+ printf("%s [-hIdos] [-o outfile] [-p pkgname] [-m] inputs\n", prog);
printf("\t-h\tprint this help\n");
printf("\t\tThe outfile must be the same name as each package merged.\n");
printf("\t-I path\tAdd 'path' to use search path\n");
@@ -55,13 +56,16 @@ int main(int argc, char **argv)
size_t i;
FILE *f;
- optinit(&ctx, "sd:hmo:I:l:", argv, argc);
+ optinit(&ctx, "sd:hmo:p:I:l:", argv, argc);
while (!optdone(&ctx)) {
switch (optnext(&ctx)) {
case 'h':
usage(argv[0]);
exit(0);
break;
+ case 'p':
+ pkgname = ctx.optarg;
+ break;
case 'o':
outfile = ctx.optarg;
break;
@@ -90,11 +94,13 @@ int main(int argc, char **argv)
fprintf(stderr, "output file needed when merging usefiles.\n");
exit(1);
}
+ if (!pkgname)
+ pkgname = outfile;
/* read and parse the file */
file = mkfile("internal");
file->file.globls = mkstab(0);
- updatens(file->file.globls, outfile);
+ updatens(file->file.globls, pkgname);
tyinit(file->file.globls);
for (i = 0; i < ctx.nargs; i++)
mergeuse(ctx.args[i]);