diff --git a/doc/mes.texi b/doc/mes.texi index 67219e62..7fed87db 100644 --- a/doc/mes.texi +++ b/doc/mes.texi @@ -85,6 +85,7 @@ Bootstrapping * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * Invoking Mes:: Running Mes, a minimalist Guile lookalike. * Invoking MesCC:: Running the MesCC bootstrap compiler. +* Invoking mesar:: Invoking Mes @@ -98,6 +99,7 @@ Contributing * Building from Git:: The latest and greatest. * Running Mes From the Source Tree:: Hacker tricks. +* Porting GNU Mes:: Teach Mes about your platform. * The Perfect Setup:: The right tools. * Coding Style:: Hygiene of the contributor. * Submitting Patches:: Share your work. @@ -585,6 +587,7 @@ responsibility. * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * Invoking Mes:: Running Mes, a minimalist Guile lookalike. * Invoking MesCC:: Running the MesCC bootstrap compiler. +* Invoking mesar:: @end menu @node The Mes Bootstrap Process @@ -874,7 +877,7 @@ preprocess and compile only; do not assemble or link @item --std=STANDARD assume that the input sources are for STANDARD -@item -v, --version +@item -V,--version display version and exit @item -w,--write=TYPE @@ -918,6 +921,34 @@ during the parsing phase. @end table +@node Invoking mesar +@section Invoking mesar + +@example +mesar @var{option}@dots{} @var{command} @file{ARCHIVE-FILE} @file{FILE}@dots{} +@end example + +The @var{command} is ignored for compatibility with @file{ar} + +@example + r[ab][f][u] - replace existing or insert new file(s) into the archive + [c] - do not warn if the library had to be created + [D] - use zero for timestamps and uids/gids (default) +@end example + +and assumed to be @var{crD}. + +The @var{option}s can be among the following: + +@table @code + +@item -h, --help +display this help and exit + +@item -V,--version +display version and exit + +@end table @c ********************************************************************* @node Contributing diff --git a/mes/module/mes/boot-0.scm b/mes/module/mes/boot-0.scm index bca82483..1925bf5f 100644 --- a/mes/module/mes/boot-0.scm +++ b/mes/module/mes/boot-0.scm @@ -213,6 +213,7 @@ (load-path (single-char #\L) (value #t)) (main (single-char #\e) (value #t)) (source (single-char #\s) (value #t)) + (version (single-char #\v)) (version (single-char #\V))))) (getopt-long args option-spec #:stop-at-first-non-option #t))) (define (source-arg? o) @@ -234,8 +235,9 @@ (exit 0)) (and (or help? usage?) (display "Usage: mes [OPTION]... [FILE]... -Evaluate code with Mes, interactively or from a script. +Scheme interpreter for bootstrapping the GNU system. +Options: [-s] FILE load source code from FILE, and exit -c EXPR evalute expression EXPR, and exit -- stop scanning arguments; run interactively diff --git a/module/mescc.scm b/module/mescc.scm index 36696d76..707a85eb 100644 --- a/module/mescc.scm +++ b/module/mescc.scm @@ -92,6 +92,9 @@ (and (or help? usage?) (format (or (and usage? (current-error-port)) (current-output-port)) "\ Usage: mescc [OPTION]... FILE... +C99 compiler in Scheme for bootstrapping the GNU system. + +Options: --align align globals --arch=ARCH compile for ARCH [~a] -dumpmachine display the compiler's target machine @@ -112,7 +115,7 @@ Usage: mescc [OPTION]... FILE... -O LEVEL use optimizing LEVEL -S preprocess and compile only; do not assemble or link --std=STANDARD assume that the input sources are for STANDARD - -v, --version display version and exit + -V,--version display version and exit -w,--write=TYPE dump Nyacc AST using TYPE {pretty-print,write} -x LANGUAGE specify LANGUAGE of the following input files diff --git a/scripts/diff.scm b/scripts/diff.scm index b075cdc6..387d3e8b 100755 --- a/scripts/diff.scm +++ b/scripts/diff.scm @@ -113,10 +113,28 @@ exec ${MES-mes} -L ${0%/*} -e '(diff)' -s "$0" "$@" (cdr a-lines) (cdr b-lines)))))))))) (define (main args) - (let* ((files (cdr args)) - (files (if (string-prefix? "-" (car files)) (cdr files) files)) - (hunks (apply diff-files (list-head files 2)))) - (when (pair? hunks) - (display (string-join (append-map hunk->lines hunks) "\n")) - (newline) - (exit 1)))) + (let ((files (cdr args))) + (when (or (null? files) + (equal? (car files) "-h") + (equal? (car files) "--help")) + (display " +Usage: diff.scm [OPTION]... FILES +Compare FILES line by line. + +Options: + -u,--unified display unified diff (default) + -h,--help display this help and exit + -V,--version display version information and exit +") + (exit (if (null? files) 2 0))) + (when (or (equal? (car files) "-V") + (equal? (car files) "--version")) + (display " +diff.scm (GNU Mes) 0.20 +")) + (let* ((files (if (string-prefix? "-" (car files)) (cdr files) files)) + (hunks (apply diff-files (list-head files 2)))) + (when (pair? hunks) + (display (string-join (append-map hunk->lines hunks) "\n")) + (newline) + (exit 1))))) diff --git a/scripts/mesar.in b/scripts/mesar.in index 883f7d34..364aa67d 100644 --- a/scripts/mesar.in +++ b/scripts/mesar.in @@ -22,10 +22,56 @@ if [ "$V" = 2 ]; then set -x fi +# parse arguments +while [ $# -gt 0 ]; do + case $1 in + (-h|--help) + cat <&2 + exit 2 +fi +archive=$1 shift +if [ -z "$archive" ]; then + echo "AR: Usage error: missing archive" 1>&2 + exit 2 +fi +if [ $# -eq 0 ]; then + echo "AR: Usage error: missing object files" 1>&2 + exit 2 +fi M1_archive=$(dirname "$archive")/$(basename "$archive" .a).s for o in "$@"; do s=$(dirname "$o")/$(basename "$o" .o).s