[m-rev.] for review: header files for erlang backend
Peter Wang
wangp at students.csse.unimelb.edu.au
Wed Jul 11 18:29:16 AEST 2007
Estimated hours taken: 4
Branches: main
Add support for header files to the Erlang back-end. These have the extension
.hrl. Code from :- pragma foreign_decls are put into the modules's .hrl file,
unless it has the `local' attribute. Header files of imported modules
are automatically included in the generated Erlang source files.
compiler/elds.m:
compiler/erl_code_gen.m:
Record imported modules in the ELDS structure.
compiler/elds_to_erlang.m:
Generate .hrl files when generating .erl files.
Add -include("<module>.erl"). directives in generated .erl files,
for each imported module.
compiler/options.m:
Add option --erlang-include-directory <dir> which specifies
where to search for .hrl files.
compiler/handle_options.m:
Add --erlang-include-directory <dir>/lib/<grade>/inc
to search for .hrl files for installed libraries.
Add --erlang-include-directory <pwd>/Mercury/hrls
or <pwd>/Mercury/<grade>/Mercury/hrls
to search for .hrl files for the current directory.
compiler/compile_target_code.m:
Pass -I<dir> options to the Erlang compiler for each
--erlang-include-directory <dir> option.
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/modules.m:
Update `mmc --make' to build, install and clean .hrl files.
Unrelated fix: mark _init.erl and _init.beam files as grade dependent.
doc/user_guide.texi:
Document --erlang-include-directory and --erlang-native-code (which was
missed previously).
library/io.m:
Add `local' attributes to foreign_decls which shouldn't be exported.
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.113
diff -u -r1.113 compile_target_code.m
--- compiler/compile_target_code.m 9 Jul 2007 03:16:43 -0000 1.113
+++ compiler/compile_target_code.m 11 Jul 2007 08:07:57 -0000
@@ -948,6 +948,11 @@
),
ERLANGFLAGS = string.join_list(" ", ErlangFlagsList),
+ globals.io_lookup_accumulating_option(erlang_include_directory,
+ Erlang_Incl_Dirs, !IO),
+ InclOpt = string.append_list(list.condense(list.map(
+ (func(E_INCL) = ["-I", quote_arg(E_INCL), " "]), Erlang_Incl_Dirs))),
+
globals.io_lookup_bool_option(use_subdirs, UseSubdirs, !IO),
globals.io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs, !IO),
globals.io_lookup_string_option(fullarch, FullArch, !IO),
@@ -971,8 +976,8 @@
DestDir = ""
),
- string.append_list([ErlangCompiler, " ", DestDir, ERLANGFLAGS, " ",
- ErlangFile], Command),
+ string.append_list([ErlangCompiler, " ", InclOpt, DestDir, ERLANGFLAGS,
+ " ", ErlangFile], Command),
invoke_system_command(ErrorStream, cmd_verbose_commands, Command,
Succeeded, !IO).
Index: compiler/elds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/elds.m,v
retrieving revision 1.14
diff -u -r1.14 elds.m
--- compiler/elds.m 9 Jul 2007 04:48:43 -0000 1.14
+++ compiler/elds.m 11 Jul 2007 08:07:57 -0000
@@ -45,6 +45,9 @@
% The original Mercury module name.
elds_name :: module_name,
+ % Modules imported by this module.
+ elds_imports :: set(module_name),
+
% Foreign code declarations.
elds_foreign_decls :: list(foreign_decl_code),
Index: compiler/elds_to_erlang.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/elds_to_erlang.m,v
retrieving revision 1.23
diff -u -r1.23 elds_to_erlang.m
--- compiler/elds_to_erlang.m 5 Jul 2007 02:53:48 -0000 1.23
+++ compiler/elds_to_erlang.m 11 Jul 2007 08:07:57 -0000
@@ -25,8 +25,9 @@
% output_elds(ELDS, !IO):
%
- % Output Erlang code to the appropriate .erl file. The file names are
- % determined by the module name.
+ % Output Erlang code to the appropriate .erl file
+ % and exported foreign_decls to the corresponding .hrl file.
+ % The file names are determined by the module name.
%
:- pred output_elds(module_info::in, elds::in, io::di, io::uo) is det.
@@ -70,30 +71,24 @@
%-----------------------------------------------------------------------------%
output_elds(ModuleInfo, ELDS, !IO) :-
- module_name_to_file_name(ELDS ^ elds_name, ".erl", yes,
- SourceFileName, !IO),
+ Name = ELDS ^ elds_name,
+ module_name_to_file_name(Name, ".erl", yes, SourceFileName, !IO),
+ module_name_to_file_name(Name, ".hrl", yes, HeaderFileName, !IO),
output_to_file(SourceFileName, output_erl_file(ModuleInfo, ELDS,
+ SourceFileName), !IO),
+ output_to_file(HeaderFileName, output_hrl_file(Name, ELDS,
SourceFileName), !IO).
:- pred output_erl_file(module_info::in, elds::in, string::in,
io::di, io::uo) is det.
output_erl_file(ModuleInfo, ELDS, SourceFileName, !IO) :-
- ELDS = elds(ModuleName, ForeignDecls, ForeignBodies, ProcDefns,
+ ELDS = elds(ModuleName, Imports, ForeignDecls, ForeignBodies, ProcDefns,
ForeignExportDefns, RttiDefns, InitPreds, FinalPreds),
AddMainWrapper = should_add_main_wrapper(ModuleInfo),
% Output intro.
- library.version(Version),
- io.write_strings([
- "%\n",
- "% Automatically generated from `", SourceFileName, "'\n",
- "% by the Mercury compiler,\n",
- "% version ", Version, ".\n",
- "% Do not edit.\n",
- "%\n",
- "\n"
- ], !IO),
+ output_do_no_edit_comment(SourceFileName, !IO),
% Write module annotations.
io.write_string("-module(", !IO),
@@ -113,6 +108,8 @@
% Useful for debugging.
io.write_string("% -compile(export_all).\n", !IO),
+ set.fold(output_include_header_ann, Imports, !IO),
+
% Output foreign declarations.
list.foldl(output_foreign_decl_code, ForeignDecls, !IO),
@@ -161,6 +158,20 @@
!IO),
list.foldl(output_rtti_defn(ModuleInfo), RttiDefns, !IO).
+:- pred output_do_no_edit_comment(string::in, io::di, io::uo) is det.
+
+output_do_no_edit_comment(SourceFileName, !IO) :-
+ library.version(Version),
+ io.write_strings([
+ "%\n",
+ "% Automatically generated from `", SourceFileName, "'\n",
+ "% by the Mercury compiler,\n",
+ "% version ", Version, ".\n",
+ "% Do not edit.\n",
+ "%\n",
+ "\n"
+ ], !IO).
+
%-----------------------------------------------------------------------------%
:- pred output_export_ann(module_info::in, elds_defn::in,
@@ -367,6 +378,16 @@
%-----------------------------------------------------------------------------%
+:- pred output_include_header_ann(module_name::in, io::di, io::uo) is det.
+
+output_include_header_ann(Import, !IO) :-
+ module_name_to_search_file_name(Import, ".hrl", HeaderFile, !IO),
+ io.write_string("-include(""", !IO),
+ write_with_escaping(in_string, HeaderFile, !IO),
+ io.write_string(""").\n", !IO).
+
+%-----------------------------------------------------------------------------%
+
:- pred output_foreign_decl_code(foreign_decl_code::in, io::di, io::uo) is det.
output_foreign_decl_code(foreign_decl_code(_Lang, _IsLocal, Code, _Context),
@@ -1157,6 +1178,41 @@
escape("\\\\", 92).
%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+
+:- pred output_hrl_file(module_name::in, elds::in, string::in,
+ io::di, io::uo) is det.
+
+output_hrl_file(ModuleName, ELDS, SourceFileName, !IO) :-
+ output_do_no_edit_comment(SourceFileName, !IO),
+
+ MangledModuleName = sym_name_mangle(ModuleName),
+ string.to_upper(MangledModuleName, UppercaseModuleName),
+ string.append(UppercaseModuleName, "_HRL", GuardMacroName),
+ io.write_strings([
+ "-ifndef(", GuardMacroName, ").\n",
+ "-define(", GuardMacroName, ", 1).\n"
+ ], !IO),
+
+ ForeignDecls = ELDS ^ elds_foreign_decls,
+ list.foldl(output_exported_foreign_decl_code, ForeignDecls, !IO),
+
+ io.write_string("-endif.\n", !IO).
+
+:- pred output_exported_foreign_decl_code(foreign_decl_code::in,
+ io::di, io::uo) is det.
+
+output_exported_foreign_decl_code(ForeignDecl, !IO) :-
+ IsLocal = ForeignDecl ^ fdecl_is_local,
+ (
+ IsLocal = foreign_decl_is_local
+ ;
+ IsLocal = foreign_decl_is_exported,
+ output_foreign_decl_code(ForeignDecl, !IO)
+ ).
+
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
:- type indent == int.
Index: compiler/erl_code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/erl_code_gen.m,v
retrieving revision 1.19
diff -u -r1.19 erl_code_gen.m
--- compiler/erl_code_gen.m 9 Jul 2007 04:48:43 -0000 1.19
+++ compiler/erl_code_gen.m 11 Jul 2007 08:07:57 -0000
@@ -23,7 +23,6 @@
% TODO: (this is incomplete)
% - contexts are ignored at the moment
% - RTTI
-% - support non-local foreign code declarations (e.g. for macros)
%
%-----------------------------------------------------------------------------%
@@ -83,6 +82,7 @@
erl_code_gen(ModuleInfo, ELDS, !IO) :-
module_info_get_name(ModuleInfo, ModuleName),
erl_gen_preds(ModuleInfo, ProcDefns, !IO),
+ erl_gen_imports(ModuleInfo, Imports),
filter_erlang_foreigns(ModuleInfo, ForeignDecls, ForeignBodies,
PragmaExports, !IO),
erl_gen_foreign_exports(ProcDefns, PragmaExports, ForeignExportDefns),
@@ -90,9 +90,17 @@
RttiDefns = [],
module_info_user_init_pred_procs(ModuleInfo, InitPredProcs),
module_info_user_final_pred_procs(ModuleInfo, FinalPredProcs),
- ELDS = elds(ModuleName, ForeignDecls, ForeignBodies, ProcDefns,
+ ELDS = elds(ModuleName, Imports, ForeignDecls, ForeignBodies, ProcDefns,
ForeignExportDefns, RttiDefns, InitPredProcs, FinalPredProcs).
+:- pred erl_gen_imports(module_info::in, set(module_name)::out) is det.
+
+erl_gen_imports(ModuleInfo, AllImports) :-
+ module_info_get_all_deps(ModuleInfo, AllImports0),
+ % No module needs to import itself.
+ module_info_get_name(ModuleInfo, ThisModule),
+ AllImports = set.delete(AllImports0, ThisModule).
+
:- pred filter_erlang_foreigns(module_info::in, list(foreign_decl_code)::out,
list(foreign_body_code)::out, list(pragma_exported_proc)::out,
io::di, io::uo) is det.
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.304
diff -u -r1.304 handle_options.m
--- compiler/handle_options.m 2 Jul 2007 05:30:28 -0000 1.304
+++ compiler/handle_options.m 11 Jul 2007 08:07:57 -0000
@@ -1665,7 +1665,7 @@
),
%
- % Handle the `.opt', C header, init file and library search
+ % Handle the `.opt', C and Erlang header, init file and library search
% directories for installed libraries. These couldn't be handled by
% options.m because they are grade dependent.
%
@@ -1689,14 +1689,18 @@
globals.set_option(runtime_link_library_directories,
accumulating(Rpath ++ ExtraLinkLibDirs), !Globals),
- ExtraCIncludeDirs = list.map(
+ ExtraIncludeDirs = list.map(
(func(MercuryLibDir) =
MercuryLibDir/"lib"/GradeString/"inc"
), MercuryLibDirs),
globals.lookup_accumulating_option(!.Globals, c_include_directory,
CIncludeDirs),
globals.set_option(c_include_directory,
- accumulating(ExtraCIncludeDirs ++ CIncludeDirs), !Globals),
+ accumulating(ExtraIncludeDirs ++ CIncludeDirs), !Globals),
+ globals.lookup_accumulating_option(!.Globals,
+ erlang_include_directory, ErlangIncludeDirs),
+ globals.set_option(erlang_include_directory,
+ accumulating(ExtraIncludeDirs ++ ErlangIncludeDirs), !Globals),
ExtraIntermodDirs = list.map(
(func(MercuryLibDir) =
@@ -1804,7 +1808,7 @@
accumulating(InitDirs), !Globals),
%
- % When searching for a header (.mh or .mih) file,
+ % When searching for a header (.mh, .mih, .hrl) file,
% module_name_to_file_name uses the plain header name, so we need to
% add the full path to the header files in the current directory,
% and any directories listed with --search-library-files-directory.
@@ -1812,9 +1816,11 @@
globals.lookup_bool_option(!.Globals, use_subdirs, UseSubdirs),
(
( UseGradeSubdirs = yes ->
- ToMihsSubdir = (func(Dir) = ToGradeSubdir(Dir)/"Mercury"/"mihs")
+ ToMihsSubdir = (func(Dir) = ToGradeSubdir(Dir)/"Mercury"/"mihs"),
+ ToHrlsSubdir = (func(Dir) = ToGradeSubdir(Dir)/"Mercury"/"hrls")
; UseSubdirs = yes ->
- ToMihsSubdir = (func(Dir) = Dir/"Mercury"/"mihs")
+ ToMihsSubdir = (func(Dir) = Dir/"Mercury"/"mihs"),
+ ToHrlsSubdir = (func(Dir) = Dir/"Mercury"/"hrls")
;
fail
)
@@ -1826,7 +1832,14 @@
SubdirCIncludeDirs = [dir.this_directory, MihsSubdir |
SearchLibMihsSubdirs ++ CIncludeDirs1],
globals.set_option(c_include_directory,
- accumulating(SubdirCIncludeDirs), !Globals)
+ accumulating(SubdirCIncludeDirs), !Globals),
+
+ globals.lookup_accumulating_option(!.Globals,
+ erlang_include_directory, ErlangIncludeDirs1),
+ HrlsSubdir = ToHrlsSubdir(dir.this_directory),
+ SubdirErlangIncludeDirs = [HrlsSubdir | ErlangIncludeDirs1],
+ globals.set_option(erlang_include_directory,
+ accumulating(SubdirErlangIncludeDirs), !Globals)
;
true
),
Index: compiler/make.dependencies.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.dependencies.m,v
retrieving revision 1.38
diff -u -r1.38 make.dependencies.m
--- compiler/make.dependencies.m 30 May 2007 05:15:04 -0000 1.38
+++ compiler/make.dependencies.m 11 Jul 2007 08:07:57 -0000
@@ -200,6 +200,8 @@
]).
target_dependencies(Globals, module_target_java_code) =
compiled_code_dependencies(Globals).
+target_dependencies(Globals, module_target_erlang_header) =
+ target_dependencies(Globals, module_target_erlang_code).
target_dependencies(Globals, module_target_erlang_code) =
compiled_code_dependencies(Globals).
target_dependencies(_, module_target_erlang_beam_code) =
Index: compiler/make.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.m,v
retrieving revision 1.47
diff -u -r1.47 make.m
--- compiler/make.m 30 May 2007 05:15:04 -0000 1.47
+++ compiler/make.m 11 Jul 2007 08:07:57 -0000
@@ -177,6 +177,7 @@
; module_target_il_code
; module_target_il_asm
; module_target_java_code
+ ; module_target_erlang_header
; module_target_erlang_code
; module_target_erlang_beam_code
; module_target_asm_code(pic)
Index: compiler/make.module_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.module_target.m,v
retrieving revision 1.55
diff -u -r1.55 make.module_target.m
--- compiler/make.module_target.m 30 May 2007 05:15:04 -0000 1.55
+++ compiler/make.module_target.m 11 Jul 2007 08:07:57 -0000
@@ -726,6 +726,8 @@
target_code_to_object_code(non_pic) - [].
compilation_task(_, module_target_java_code) =
process_module(task_compile_to_target_code) - ["--java-only"].
+compilation_task(Globals, module_target_erlang_header) =
+ compilation_task(Globals, module_target_erlang_code).
compilation_task(_, module_target_erlang_code) =
process_module(task_compile_to_target_code) - ["--erlang-only"].
compilation_task(_, module_target_erlang_beam_code) =
Index: compiler/make.program_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.program_target.m,v
retrieving revision 1.75
diff -u -r1.75 make.program_target.m
--- compiler/make.program_target.m 10 Jul 2007 01:32:40 -0000 1.75
+++ compiler/make.program_target.m 11 Jul 2007 08:07:57 -0000
@@ -1050,6 +1050,11 @@
HeaderSucceeded = HeaderSucceeded1 `and` HeaderSucceeded2
;
+ Target = target_erlang
+ ->
+ module_name_to_file_name(ModuleName, ".hrl", no, FileName, !IO),
+ install_file(FileName, LibDir/"inc", HeaderSucceeded, !IO)
+ ;
HeaderSucceeded = yes
),
Succeeded = bool.and_list([HeaderSucceeded | Results])
@@ -1602,6 +1607,7 @@
[module_target_errors, module_target_c_code,
module_target_c_header(header_mih), module_target_il_code,
module_target_java_code, module_target_erlang_code,
+ module_target_erlang_header,
module_target_erlang_beam_code], !Info, !IO),
list.foldl2(make_remove_file(very_verbose, ModuleName),
@@ -1682,7 +1688,8 @@
module_target_unqualified_short_interface,
module_target_intermodule_interface,
module_target_analysis_registry,
- module_target_c_header(header_mh)
+ module_target_c_header(header_mh),
+ module_target_erlang_header
],
!Info, !IO),
make_remove_file(very_verbose, ModuleName, make_module_dep_file_extension,
Index: compiler/make.util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.util.m,v
retrieving revision 1.47
diff -u -r1.47 make.util.m
--- compiler/make.util.m 30 May 2007 05:15:05 -0000 1.47
+++ compiler/make.util.m 11 Jul 2007 08:07:57 -0000
@@ -1004,6 +1004,7 @@
% XXX ".exe" if the module contains main.
target_extension(_, module_target_il_asm) = yes(".dll").
target_extension(_, module_target_java_code) = yes(".java").
+target_extension(_, module_target_erlang_header) = yes(".hrl").
target_extension(_, module_target_erlang_code) = yes(".erl").
target_extension(_, module_target_erlang_beam_code) = yes(".beam").
target_extension(_, module_target_asm_code(non_pic)) = yes(".s").
@@ -1143,6 +1144,8 @@
search_for_file_type(module_target_il_code) = no.
search_for_file_type(module_target_il_asm) = no.
search_for_file_type(module_target_java_code) = no.
+search_for_file_type(module_target_erlang_header) =
+ yes(erlang_include_directory).
search_for_file_type(module_target_erlang_code) = no.
search_for_file_type(module_target_erlang_beam_code) = no.
search_for_file_type(module_target_asm_code(_)) = no.
@@ -1166,6 +1169,7 @@
; Target = module_target_short_interface
; Target = module_target_unqualified_short_interface
; Target = module_target_c_header(header_mh)
+ ; Target = module_target_erlang_header
; Target = module_target_xml_doc
),
IsDependent = no
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.433
diff -u -r1.433 modules.m
--- compiler/modules.m 15 Jun 2007 10:35:50 -0000 1.433
+++ compiler/modules.m 11 Jul 2007 08:07:58 -0000
@@ -875,6 +875,7 @@
;
(
( string.suffix(Ext, ".erl")
+ ; string.suffix(Ext, ".hrl")
; string.suffix(Ext, ".beam")
)
->
@@ -935,10 +936,13 @@
% in installed libraries will work. `--c-include-directory' is
% set so that searches for files in the current directory will
% work.
+ % Similarly for `.hrl' files. We set `--erlang-include-directory'
+ % for those.
%
Search = yes,
( Ext = ".mih"
; Ext = ".mih.tmp"
+ ; Ext = ".hrl"
)
)
->
@@ -1280,12 +1284,15 @@
file_is_arch_or_grade_dependent_2(".erl_date").
file_is_arch_or_grade_dependent_2(".beam").
file_is_arch_or_grade_dependent_2(".beams").
+file_is_arch_or_grade_dependent_2(".hrl").
file_is_arch_or_grade_dependent_2(".dir").
file_is_arch_or_grade_dependent_2(".dll").
file_is_arch_or_grade_dependent_2(".$A").
file_is_arch_or_grade_dependent_2(".a").
file_is_arch_or_grade_dependent_2("_init.c").
file_is_arch_or_grade_dependent_2("_init.$O").
+file_is_arch_or_grade_dependent_2("_init.erl").
+file_is_arch_or_grade_dependent_2("_init.beam").
%-----------------------------------------------------------------------------%
%
@@ -3528,8 +3535,7 @@
;
Target = target_erlang,
ForeignImportTargets = [BeamFileName],
- % XXX not sure about this
- ForeignImportExt = ".erl"
+ ForeignImportExt = ".hrl"
;
Target = target_c,
% NOTE: for C (and asm) the possible targets might be a .o
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.574
diff -u -r1.574 options.m
--- compiler/options.m 10 Jul 2007 00:15:03 -0000 1.574
+++ compiler/options.m 11 Jul 2007 08:07:58 -0000
@@ -54,6 +54,7 @@
% Add a directory to search for Mercury libraries. This
% adds `--search-directory', `--c-include-directory',
+ % `--erlang-include-directory',
% `--library-directory' and `--init-file-directory' options.
%
:- func option_table_add_mercury_library_directory(option_table, string)
@@ -62,7 +63,8 @@
% Add a directory using all of the
% `--search-directory', `--intermod-directory',
% `--library-directory', `--init-file-directory' and
- % `--c-include-directory' options.
+ % `--c-include-directory', `--erlang-include-directory'
+ % options.
%
:- func option_table_add_search_library_files_directory(option_table,
string) = option_table.
@@ -716,6 +718,7 @@
; erlang_interpreter
; erlang_flags
; quoted_erlang_flag
+ ; erlang_include_directory
; erlang_object_file_extension
; erlang_native_code
@@ -1485,6 +1488,7 @@
erlang_interpreter - string("erl"),
erlang_flags - accumulating([]),
quoted_erlang_flag - string_special,
+ erlang_include_directory - accumulating([]),
erlang_object_file_extension - string(".beam"),
erlang_native_code - bool(no)
]).
@@ -2305,6 +2309,8 @@
long_option("erlang-compiler", erlang_compiler).
long_option("erlang-flags", erlang_flags).
long_option("erlang-flag", quoted_erlang_flag).
+long_option("erlang-include-directory", erlang_include_directory).
+long_option("erlang-include-dir", erlang_include_directory).
long_option("erlang-object-file-extension", erlang_object_file_extension).
long_option("erlang-native-code", erlang_native_code).
@@ -2649,6 +2655,7 @@
list.foldl(append_to_accumulating_option, [
search_directories - dir.make_path_name(Dir, "ints"),
c_include_directory - dir.make_path_name(Dir, "inc"),
+ erlang_include_directory - dir.make_path_name(Dir, "inc"),
mercury_library_directories - Dir
], OptionTable0).
@@ -2658,6 +2665,7 @@
list.foldl(append_to_accumulating_option, [
search_directories - Dir,
c_include_directory - Dir,
+ erlang_include_directory - Dir,
search_library_files_directories - Dir
], OptionTable0).
@@ -4709,6 +4717,9 @@
"\tSpecify options to be passed to the Erlang compiler.",
"\t`--erlang-flag' should be used for single words which need",
"\tto be quoted when passed to the shell.",
+ "--erlang-include-directory <dir>, --erlang-include-dir <dir>",
+ "\tAppend <dir> to the list of directories to be searched for",
+ "\tErlang header files (.hrl).",
"--erlang-native-code",
"\tAdd `+native' to the start of flags passed to the Erlang compiler.",
"\tCancelled out by `--no-erlang-native-code' so it's useful when you",
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.533
diff -u -r1.533 user_guide.texi
--- doc/user_guide.texi 9 Jul 2007 03:16:44 -0000 1.533
+++ doc/user_guide.texi 11 Jul 2007 08:07:59 -0000
@@ -9006,6 +9006,25 @@
@samp{--erlang-flag} should be used for single words which need
to be quoted when passed to the shell.
+ at sp 1
+ at item --erlang-include-directory @var{dir}
+ at itemx --erlang-include-dir @var{dir}
+ at findex --erlang-include-directory
+ at findex --erlang-include-dir
+ at cindex Include directories
+ at cindex Directories
+Append @var{dir} to the list of directories to be searched for
+Erlang header files (.hrl).
+
+ at sp 1
+ at item --erlang-native-code
+ at findex --erlang-native-code
+ at cindex Erlang compiler options
+Add @samp{+native} to the start of flags passed to the Erlang compiler.
+Cancelled out by @samp{--no-erlang-native-code} so it's useful when you
+wish to enable native code generation for all modules except for
+a select few.
+
@c This option is not fully implemented and not very useful.
@c @sp 1
@c @item --erlang-object-file-extension @var{extension}
@@ -9106,9 +9125,9 @@
Search @var{directory} for Mercury library files have not yet been
installed. Similar to adding @var{directory} using all of the
@samp{--search-directory}, @samp{--intermod-directory},
- at samp{--library-directory}, @samp{--init-file-directory} and
- at samp{--c-include-directory} options, but
-does the right thing when @samp{--use-subdirs} or
+ at samp{--library-directory}, @samp{--init-file-directory},
+ at samp{--c-include-directory} and @samp{--erlang-include-directory}
+options, but does the right thing when @samp{--use-subdirs} or
@samp{--use-grade-subdirs} options are used.
@sp 1
@@ -9121,7 +9140,8 @@
Append @var{directory} to the list of directories to
be searched for Mercury libraries.
This will add @samp{--search-directory}, @samp{--library-directory},
- at samp{--init-file-directory} and @samp{--c-include-directory}
+ at samp{--init-file-directory}, @samp{--c-include-directory}
+and @samp{--erlang-include-directory}
options as needed. @xref{Using installed libraries with mmc --make}.
@sp 1
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.394
diff -u -r1.394 io.m
--- library/io.m 22 Jun 2007 04:42:21 -0000 1.394
+++ library/io.m 11 Jul 2007 08:08:00 -0000
@@ -6110,7 +6110,7 @@
static java.lang.Exception MR_io_exception;
").
-:- pragma foreign_decl("Erlang", "
+:- pragma foreign_decl("Erlang", local, "
% These need to be exported because code in foreign_procs may be inlined
% into other modules. Hence, calls to these functions must be module
@@ -9686,7 +9686,7 @@
end
").
-:- pragma foreign_decl("Erlang", "
+:- pragma foreign_decl("Erlang", local, "
-export(['ML_do_make_temp_2'/5]).
").
:- pragma foreign_code("Erlang", "
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list