summaryrefslogtreecommitdiff
path: root/muse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-11-17 20:53:32 -0800
committerOri Bernstein <ori@eigenstate.org>2015-11-17 20:53:32 -0800
commit8531896f8d21ba1e727262aaf5cd96043590b480 (patch)
tree7c01441755f56ab66d33c37d3ac41642ddc46c0b /muse
parentc20862cda53c711fe476f6c7d0f6631af47a4933 (diff)
downloadmc-8531896f8d21ba1e727262aaf5cd96043590b480.tar.gz
MEGAPATCH: Tabification.
Tabs > spaces. By 4 spaces, to be precise. Let's use them.
Diffstat (limited to 'muse')
-rw-r--r--muse/muse.c140
1 files changed, 70 insertions, 70 deletions
diff --git a/muse/muse.c b/muse/muse.c
index c00ade6..cec2b20 100644
--- a/muse/muse.c
+++ b/muse/muse.c
@@ -26,87 +26,87 @@ size_t nextralibs;
static void usage(char *prog)
{
- printf("%s [-hIdos] [-o outfile] [-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");
- printf("\t-d\tPrint debug dumps\n");
- printf("\t-o out\tOutput to outfile\n");
- printf("\t-s\tShow the contents of usefiles `inputs`\n");
+ printf("%s [-hIdos] [-o outfile] [-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");
+ printf("\t-d\tPrint debug dumps\n");
+ printf("\t-o out\tOutput to outfile\n");
+ printf("\t-s\tShow the contents of usefiles `inputs`\n");
}
static void mergeuse(char *path)
{
- FILE *f;
- Stab *st;
+ FILE *f;
+ Stab *st;
- st = file->file.globls;
- f = fopen(path, "r");
- if (!f)
- die("Couldn't open %s\n", path);
- loaduse(path, f, st, Visexport);
- fclose(f);
+ st = file->file.globls;
+ f = fopen(path, "r");
+ if (!f)
+ die("Couldn't open %s\n", path);
+ loaduse(path, f, st, Visexport);
+ fclose(f);
}
int main(int argc, char **argv)
{
- Optctx ctx;
- size_t i;
- FILE *f;
+ Optctx ctx;
+ size_t i;
+ FILE *f;
- optinit(&ctx, "d:hmo:I:l:", argv, argc);
- while (!optdone(&ctx)) {
- switch (optnext(&ctx)) {
- case 'h':
- usage(argv[0]);
- exit(0);
- break;
- case 'o':
- outfile = ctx.optarg;
- break;
- case 'd':
- while (ctx.optarg && *ctx.optarg)
- debugopt[*ctx.optarg++ & 0x7f] = 1;
- break;
- case 'I':
- lappend(&incpaths, &nincpaths, ctx.optarg);
- break;
- case 'l':
- lappend(&extralibs, &nextralibs, ctx.optarg);
- break;
- case 's':
- show = 1;
- break;
- default:
- usage(argv[0]);
- exit(0);
- break;
- }
- }
+ optinit(&ctx, "d:hmo:I:l:", argv, argc);
+ while (!optdone(&ctx)) {
+ switch (optnext(&ctx)) {
+ case 'h':
+ usage(argv[0]);
+ exit(0);
+ break;
+ case 'o':
+ outfile = ctx.optarg;
+ break;
+ case 'd':
+ while (ctx.optarg && *ctx.optarg)
+ debugopt[*ctx.optarg++ & 0x7f] = 1;
+ break;
+ case 'I':
+ lappend(&incpaths, &nincpaths, ctx.optarg);
+ break;
+ case 'l':
+ lappend(&extralibs, &nextralibs, ctx.optarg);
+ break;
+ case 's':
+ show = 1;
+ break;
+ default:
+ usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
- lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
- if (!outfile) {
- fprintf(stderr, "output file needed when merging usefiles.\n");
- exit(1);
- }
+ lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
+ if (!outfile) {
+ fprintf(stderr, "output file needed when merging usefiles.\n");
+ exit(1);
+ }
- /* read and parse the file */
- file = mkfile("internal");
- file->file.globls = mkstab(0);
- updatens(file->file.globls, outfile);
- tyinit(file->file.globls);
- for (i = 0; i < ctx.nargs; i++)
- mergeuse(ctx.args[i]);
- infer(file);
- tagexports(file, 1);
- addextlibs(file, extralibs, nextralibs);
+ /* read and parse the file */
+ file = mkfile("internal");
+ file->file.globls = mkstab(0);
+ updatens(file->file.globls, outfile);
+ tyinit(file->file.globls);
+ for (i = 0; i < ctx.nargs; i++)
+ mergeuse(ctx.args[i]);
+ infer(file);
+ tagexports(file, 1);
+ addextlibs(file, extralibs, nextralibs);
- /* generate the usefile */
- f = fopen(outfile, "w");
- if (debugopt['s'] || show)
- dumpstab(file->file.globls, stdout);
- else
- writeuse(f, file);
- fclose(f);
- return 0;
+ /* generate the usefile */
+ f = fopen(outfile, "w");
+ if (debugopt['s'] || show)
+ dumpstab(file->file.globls, stdout);
+ else
+ writeuse(f, file);
+ fclose(f);
+ return 0;
}