Files
mercury/compiler/options.m
Fergus Henderson 92d1371b4c New file: converts the prog_io data structure back into Mercury source
mercury_to_mercury.nl:
	New file: converts the prog_io data structure back into Mercury source
	code.

term_io.nl:
	Export mercury_quote_string for use by mercury_to_mercury.nl.

Makefile, doit.nl:
	Add mercury_to_mercury.

options.nl, toplevel.nl:
	Add a new option to save the interface of a module to a `.int' file,
	using mercury_to_mercury.

Makefile:
	Modify the rule for the `clean' target so that it removes `.int' files.

mercury_builtin.nl:
	Fix the module name.

std_util.nl:
	Suppress warnings from nit.
1994-03-14 14:53:58 +00:00

69 lines
2.0 KiB
Mathematica

%-----------------------------------------------------------------------------%
% Define the stuff necessary so that getopt.nl
% can parse the command-line options.
% When we implement higher-order preds, this and
% getopt.nl should be rewritten to use them.
% Currently the interface dependencies are very hairy.
:- module options.
:- interface.
:- import_module int, string, std_util, list, io.
:- type option_data ---> bool(bool)
; int(int) % not yet implemented
; string(string) % not yet implemented
; accumulating(list(string)). % not yet imp.
:- pred short_option(character::in, option::out) is semidet.
:- pred long_option(string::in, option::out) is semidet.
:- pred option_defaults(list(pair(option, option_data))::output) is det.
% A couple of misc utilities
:- pred maybe_report_stats(bool::input, io__state::di, io__state::uo).
:- pred maybe_write_string(bool::input, string::input,
io__state::di, io__state::uo).
:- type option ---> verbose
; very_verbose
; dump_hlds
; generate_code
; builtin_module
; make_interface.
:- implementation.
option_defaults([
verbose - bool(no),
very_verbose - bool(no),
dump_hlds - bool(no),
generate_code - bool(no),
builtin_module - string("mercury_builtin"),
make_interface - bool(no)
]).
short_option('v', verbose).
short_option('w', very_verbose).
short_option('d', dump_hlds).
short_option('g', generate_code).
short_option('b', builtin_module).
short_option('i', make_interface).
long_option("verbose", verbose).
long_option("very-verbose", very_verbose).
long_option("dump-hlds", dump_hlds).
long_option("generate-code", generate_code).
long_option("builtin-module", builtin_module).
long_option("make-interface", make_interface).
maybe_report_stats(yes) --> io__report_stats.
maybe_report_stats(no) --> [].
maybe_write_string(yes, String) --> io__write_string(String).
maybe_write_string(no, _) --> [].
:- end_module options.
%-----------------------------------------------------------------------------%