diff options
author | Ori Bernstein <ori@eigenstate.org> | 2012-08-19 12:35:21 -0400 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2012-08-19 12:35:21 -0400 |
commit | fa9b8ec335f027943f5757503b2c2ebb283cc502 (patch) | |
tree | 95a7203f8b8bd568e5ed194fa3297c3c99e8a752 | |
parent | 8fc0919576234ccc15a9f66e43a326fd15f9ca79 (diff) | |
download | mc-fa9b8ec335f027943f5757503b2c2ebb283cc502.tar.gz |
Add to the manpages.
-rw-r--r-- | doc/mc.1 | 4 | ||||
-rw-r--r-- | doc/muse.1 | 92 | ||||
-rw-r--r-- | util/muse.c | 17 |
3 files changed, 108 insertions, 5 deletions
@@ -1,4 +1,4 @@ -.TH MC2 1 +.TH MC 1 .SH NAME 6m .SH SYNOPSIS @@ -28,7 +28,7 @@ The following architectures are currently supported: x86-64 .PP -The compiler options are as follows: +The compiler options are: .TP .B -d [flTri] diff --git a/doc/muse.1 b/doc/muse.1 new file mode 100644 index 0000000..24f7323 --- /dev/null +++ b/doc/muse.1 @@ -0,0 +1,92 @@ +.TH MUSE 1 +.SH NAME +muse +.SH SYNOPSIS +.B muse +.I -[hmidos] +.I [file...] +.br +.SH DESCRIPTION +.PP +The 'muse' tool takes as input a Myrddin source file and generates +a usefile from it. A usefile collects definitions exported from the +package specifications in Myrddin source code, and makes them available +for other programs to include with a 'use' statement. +.PP +It can also merge together a number of usefiles into one larger usefile +including all of the exported symbols. If an output file name is not given, +and we are not merging usefiles, then an input file named +.I filename.myr +will have a usefile named +.I filename.use +generated. + +If the filename does not end with the suffix +.I .myr +then the suffix +.I .o +will simply be appended to it. + +.PP +The muse program is architecture independent, and a usefile generated +on one architecture will work with another. However, the format of the +generated file is not stable, and is not guaranteed to work across +compiler versions. + +.PP +The muse options are: + +.TP +.B -d [flTri] +Prints debugging dumps. Additional options may be given to give more +debugging information for specific intermediate states of the compilation. + +.TP +.B -h +Prints a summary of the available options. + +.TP +.B -I path +Add 'path' to the search path for unquoted use statments. This option +does not affect the search path for local usefiles, which are always +searched relative to the compiler's current working directory. Without +any options, the search path defaults to /usr/include/myr. + +.TP +.B -o output-file +Specifies that the generated usefile should be named +.I output-file + +.TP +.B -s +Print a summary of the symbols exported from the usefile that is specified. + +.SH EXAMPLE +.EX + muse foo.myr + muse -o bar.use bar-system-version.myr + muse -mo library foo.use bar.use +.EE + +.SH FILES +The source for muse is available from +.B git://git.eigenstate.org/git/ori/mc2.git +and lives in the +.I util/ +directory within the source tree. + +.SH SEE ALSO +.IR mc(1) +.IR ld(1) +.IR as(1) + +.SH BUGS +.PP +There is insufficient checking and validation done on usefiles. +.PP +The file format is unstable, and not at all compact. +.PP +This utility should not exist. Instead, the compiler should put the +exported symbol information into the object file or library directly. +.PP +The file format is not closed under concatentation. diff --git a/util/muse.c b/util/muse.c index 336f794..42ae747 100644 --- a/util/muse.c +++ b/util/muse.c @@ -47,7 +47,9 @@ static void dumpuse(char *path) static void genuse(char *path) { Stab *globls; + char *p; FILE *f; + char buf[1024]; globls = file->file.globls; tyinit(globls); @@ -55,9 +57,13 @@ static void genuse(char *path) yyparse(); infer(file); - if (!outfile) - die("need output file name right now. FIX THIS."); - f = fopen(outfile, "w"); + if (outfile) { + p = outfile; + } else { + swapsuffix(buf, sizeof buf, path, ".myr", ".use"); + p = buf; + } + f = fopen(p, "w"); writeuse(f, file); fclose(f); } @@ -109,6 +115,11 @@ int main(int argc, char **argv) } if (merge) { + if (!outfile) { + fprintf(stderr, "Output file needed when merging usefiles."); + exit(1); + } + file = mkfile("internal"); file->file.exports = mkstab(); file->file.globls = mkstab(); |