mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
This is a first step towards a much finer grained partition.
compiler/file_names.m:
Split the ext type into ext_src and ext_other, as mentioned above.
Add the first predicate for checking whether a string falls into
a given category of extensions.
Add an XXX proposing a better solution for an old problem that does not
actually arise in practice.
compiler/compile_target_code.m:
Split the two-moded predicate maybe_pic_object_file_extension into
two separate one-mode predicates, one for each old mode. The
implementations of the two modes were already separate, because
the two modes already did different jobs: while one went from PIC
to an "extension", the other went from an "extension string" to PIC.
Until now, "extension" and "extension string" were equivalent;
after this diff, they aren't anymore.
Delete an unused argument.
compiler/make.util.m:
Split the two-moded predicate target_extension into
two separate one-mode predicates, one for each old mode,
for the same reason as maybe_pic_object_file_extension above:
the fact that "extension" and "extension string" are now distinct.
compiler/options_file.m:
Move debug infrastructure here from mercury_compile_main.m, to help
debug possible problems with options files. (I had such a problem
while writing this diff.)
Improve how progress messages are printed.
compiler/options.m:
Make an error message more useful.
compiler/mercury_compile_main.m:
Add infrastructure for debugging possible problems with command lines.
(I had such a problem while writing this diff.)
compiler/analysis.m:
Conform to the changes above. Put the arguments of some methods
into the same order as similar predicates in file_names.m.
compiler/find_module.m:
Conform to the changes above. Delete an unused argument,
compiler/analysis.file.m:
compiler/du_type_layout.m:
compiler/elds_to_erlang.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_kind.m:
compiler/generate_dep_d_files.m:
compiler/grab_modules.m:
compiler/llds_out_file.m:
compiler/make.build.m:
compiler/make.deps_set.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_middle_passes.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
compiler/mmc_analysis.m:
compiler/mode_constraints.m:
compiler/module_cmds.m:
compiler/prog_foreign.m:
compiler/read_modules.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/source_file_map.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
105 lines
3.2 KiB
Mathematica
105 lines
3.2 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2015-2011 The Mercury team.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% File: file_kind.m.
|
|
% Main author: zs.
|
|
%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module parse_tree.file_kind.
|
|
:- interface.
|
|
|
|
:- import_module parse_tree.file_names.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% The different kinds of files that the frontend of the Mercury compiler
|
|
% deals with:
|
|
%
|
|
% - source files,
|
|
% - automatically generated interface files, and
|
|
% - automatically generated optimization files.
|
|
%
|
|
|
|
:- type file_kind
|
|
---> fk_src
|
|
; fk_int(int_file_kind)
|
|
; fk_opt(opt_file_kind).
|
|
|
|
:- type int_or_opt_file_kind
|
|
---> iofk_int(int_file_kind)
|
|
; iofk_opt(opt_file_kind).
|
|
|
|
:- type src_file_kind
|
|
---> sfk_src.
|
|
|
|
:- type int_file_kind
|
|
---> ifk_int0
|
|
; ifk_int1
|
|
; ifk_int2
|
|
; ifk_int3.
|
|
|
|
:- type opt_file_kind
|
|
---> ofk_opt
|
|
; ofk_trans_opt.
|
|
|
|
:- pred file_kind_to_extension(file_kind::in, string::out, ext::out) is det.
|
|
:- pred int_file_kind_to_extension(int_file_kind::in,
|
|
string::out, other_ext::out) is det.
|
|
:- pred opt_file_kind_to_extension(opt_file_kind::in,
|
|
string::out, other_ext::out) is det.
|
|
|
|
:- pred extension_to_file_kind(string::in, file_kind::out) is semidet.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
file_kind_to_extension(fk_src, ".m", ext_src).
|
|
file_kind_to_extension(fk_int(IntFileKind), ExtStr, ext_other(OtherExt)) :-
|
|
int_file_kind_to_extension(IntFileKind, ExtStr, OtherExt).
|
|
file_kind_to_extension(fk_opt(OptFileKind), ExtStr, ext_other(OtherExt)) :-
|
|
opt_file_kind_to_extension(OptFileKind, ExtStr, OtherExt).
|
|
|
|
int_file_kind_to_extension(ifk_int0, ".int0", other_ext(".int0")).
|
|
int_file_kind_to_extension(ifk_int2, ".int2", other_ext(".int2")).
|
|
int_file_kind_to_extension(ifk_int3, ".int3", other_ext(".int3")).
|
|
int_file_kind_to_extension(ifk_int1, ".int", other_ext(".int")).
|
|
|
|
opt_file_kind_to_extension(ofk_opt, ".opt", other_ext(".opt")).
|
|
opt_file_kind_to_extension(ofk_trans_opt, ".trans_opt",
|
|
other_ext(".trans_opt")).
|
|
|
|
extension_to_file_kind(ExtStr, FileKind) :-
|
|
(
|
|
ExtStr = ".m",
|
|
FileKind = fk_src
|
|
;
|
|
ExtStr = ".int0",
|
|
FileKind = fk_int(ifk_int0)
|
|
;
|
|
ExtStr = ".int3",
|
|
FileKind = fk_int(ifk_int3)
|
|
;
|
|
ExtStr = ".int2",
|
|
FileKind = fk_int(ifk_int2)
|
|
;
|
|
ExtStr = ".int",
|
|
FileKind = fk_int(ifk_int1)
|
|
;
|
|
ExtStr = ".opt",
|
|
FileKind = fk_opt(ofk_opt)
|
|
;
|
|
ExtStr = ".trans_opt",
|
|
FileKind = fk_opt(ofk_trans_opt)
|
|
).
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- end_module parse_tree.file_kind.
|
|
%-----------------------------------------------------------------------------%
|