mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
compiler/file_names.m:
Replace the current groups of extensions, which are based on the
shared purpose of the files with those extensions, with a smaller
number of groups, which are based on the algorithm we use to decide
in what (sub)directories we want to place files with those extensions.
The old distinctions based on purpose still remain in the naming
convention for the enum values within each of the new groups.
compiler/analysis.file.m:
compiler/analysis.m:
compiler/compile_target_code.m:
compiler/du_type_layout.m:
compiler/fact_table.m:
compiler/file_kind.m:
compiler/generate_dep_d_files.m:
compiler/llds_out_file.m:
compiler/make.file_names.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.track_flags.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_main.m:
compiler/mercury_compile_make_hlds.m:
compiler/mercury_compile_middle_passes.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
compiler/mode_constraints.m:
compiler/module_cmds.m:
compiler/prog_foreign.m:
compiler/recompilation.used_file.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the changes above.
110 lines
3.3 KiB
Mathematica
110 lines
3.3 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) is det.
|
|
:- pred int_file_kind_to_extension(int_file_kind::in,
|
|
string::out, ext::out) is det.
|
|
:- pred opt_file_kind_to_extension(opt_file_kind::in,
|
|
string::out, ext::out) is det.
|
|
|
|
:- pred extension_to_file_kind(string::in, file_kind::out) is semidet.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
file_kind_to_extension(fk_src, ".m").
|
|
file_kind_to_extension(fk_int(IntFileKind), ExtStr) :-
|
|
int_file_kind_to_extension(IntFileKind, ExtStr, _Ext).
|
|
file_kind_to_extension(fk_opt(OptFileKind), ExtStr) :-
|
|
opt_file_kind_to_extension(OptFileKind, ExtStr, _Ext).
|
|
|
|
int_file_kind_to_extension(ifk_int0,
|
|
".int0", ext_cur_ngs(ext_cur_ngs_int_int0)).
|
|
int_file_kind_to_extension(ifk_int1,
|
|
".int", ext_cur_ngs(ext_cur_ngs_int_int1)).
|
|
int_file_kind_to_extension(ifk_int2,
|
|
".int2", ext_cur_ngs(ext_cur_ngs_int_int2)).
|
|
int_file_kind_to_extension(ifk_int3,
|
|
".int3", ext_cur_ngs(ext_cur_ngs_int_int3)).
|
|
|
|
opt_file_kind_to_extension(ofk_opt, ".opt",
|
|
ext_cur_ngs_gs_max_ngs(ext_cur_ngs_gs_max_ngs_opt_plain)).
|
|
opt_file_kind_to_extension(ofk_trans_opt, ".trans_opt",
|
|
ext_cur_ngs_gs_max_ngs(ext_cur_ngs_gs_max_ngs_opt_trans)).
|
|
|
|
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.
|
|
%-----------------------------------------------------------------------------%
|