mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 21:35:49 +00:00
Estimated hours taken: 18 Branches: main Move the univ, maybe, pair and unit types from std_util into their own modules. std_util still contains the general purpose higher-order programming constructs. library/std_util.m: Move univ, maybe, pair and unit (plus any other related types and procedures) into their own modules. library/maybe.m: New module. This contains the maybe and maybe_error types and the associated procedures. library/pair.m: New module. This contains the pair type and associated procedures. library/unit.m: New module. This contains the types unit/0 and unit/1. library/univ.m: New module. This contains the univ type and associated procedures. library/library.m: Add the new modules. library/private_builtin.m: Update the declaration of the type_ctor_info struct for univ. runtime/mercury.h: Update the declaration for the type_ctor_info struct for univ. runtime/mercury_mcpp.h: runtime/mercury_hlc_types.h: Update the definition of MR_Univ. runtime/mercury_init.h: Fix a comment: ML_type_name is now exported from type_desc.m. compiler/mlds_to_il.m: Update the the name of the module that defines univs (which are handled specially by the il code generator.) library/*.m: compiler/*.m: browser/*.m: mdbcomp/*.m: profiler/*.m: deep_profiler/*.m: Conform to the above changes. Import the new modules where they are needed; don't import std_util where it isn't needed. Fix formatting in lots of modules. Delete duplicate module imports. tests/*: Update the test suite to confrom to the above changes.
69 lines
1.9 KiB
Mathematica
69 lines
1.9 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 1999-2000, 2003, 2005-2006 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
%-----------------------------------------------------------------------------%
|
|
% File: declarative_test.m
|
|
% Author: Mark Brown
|
|
%
|
|
% This module is a stand-alone version of the front end, suitable for
|
|
% testing.
|
|
|
|
:- module declarative_test.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module mdb.
|
|
:- import_module mdb.declarative_debugger.
|
|
:- import_module mdb.declarative_execution.
|
|
|
|
:- import_module list.
|
|
:- import_module map.
|
|
:- import_module require.
|
|
|
|
main(!IO) :-
|
|
process_arguments(MaybeFile, !IO),
|
|
(
|
|
MaybeFile = yes(File),
|
|
load_trace_node_map(File, Map, Key, !IO),
|
|
io.stdin_stream(StdIn, !IO),
|
|
io.stdout_stream(StdOut, !IO),
|
|
diagnoser_state_init(StdIn, StdOut, State),
|
|
diagnosis(Map, Key, Response, State, _, !IO),
|
|
io.write_string("Diagnoser response:\n", !IO),
|
|
io.write(Response, !IO),
|
|
io.nl(!IO)
|
|
;
|
|
MaybeFile = no,
|
|
usage(!IO)
|
|
).
|
|
|
|
:- pred process_arguments(maybe(io.input_stream)::out, io::di, io::uo) is det.
|
|
|
|
process_arguments(MaybeFile, !IO) :-
|
|
io.command_line_arguments(Args, !IO),
|
|
( Args = [FileName] ->
|
|
io.open_input(FileName, Res, !IO),
|
|
( Res = ok(File) ->
|
|
MaybeFile = yes(File)
|
|
;
|
|
MaybeFile = no
|
|
)
|
|
;
|
|
MaybeFile = no
|
|
).
|
|
|
|
:- pred usage(io::di, io::uo) is det.
|
|
|
|
usage(!IO) :-
|
|
io.progname_base("declarative_test", Name, !IO),
|
|
io.write_strings(["Usage: ", Name, " <filename>\n"], !IO).
|