Allow external files to be included in foreign_decl and foreign_code.

Allow external files to be included in pragma foreign_decl and pragma
foreign_code declarations:

    :- pragma foreign_decl("Lang", include_file("Path")).
    :- pragma foreign_decl("Lang", local, include_file("Path")).
    :- pragma foreign_code("Lang", include_file("Path")).

where Path may be an absolute path to a file or a path relative to the
directory that contains the source file of the module containing the
declaration.

mmc --make takes include_file into account when computing dependencies.
Mmake is unchanged yet.

compiler/prog_data.m:
	Add types foreign_literal_or_include and foreign_include_file_info.

	Rename "foreign_code" where "foreign_proc" is meant.

compiler/prog_foreign.m:
	Use foreign_literal_or_include where we now want to allow include_file
	directives.

compiler/prog_io_pragma.m:
	Parse include_file forms of pragma foreign_decl and pragma
	foreign_code declarations.

	Rename "foreign_code" where "foreign_proc" is meant.

compiler/prog_io_typeclass.m:
	Use foreign_literal_or_include where we want to allow include_file.

	Make get_item_list_foreign_code return a list of foreign include
	files.

	Rename "foreign_code" where "foreign_proc" is meant.

compiler/file_names.m:
	Add a predicate to get a module's source file name.

	Add make_include_file_path.

	Reorder a predicate within the module.

compiler/file_util.m:
	Add write_include_file_contents, a common predicate for copying
	the contents of an included file into the output.

	Make output_to_file catch and report exceptions from
	write_include_file_contents, and return a success code.

compiler/export.m:
compiler/llds_out_file.m:
compiler/llds_out_util.m:
compiler/mercury_compile_llds_back_end.m:
	Handle include_file directives when generating target code.

	Make output_llds use output_to_file, and propagate its success code.

	Conform to changes.

compiler/mercury_compile_mlds_back_end.m:
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
	Handle include_file directives when generating target code.

	Propagate success codes from output_to_file.

compiler/elds_to_erlang.m:
compiler/mercury_compile_erl_back_end.m:
	Handle include_file directives when generating target code.

	Propagate success code from output_to_file.

	Fix a tiny bug: the "do not edit" comment names the .erl file
	as the source file.

compiler/mercury_compile.m:
	Take account of the success codes now returned by target code
	generators, stopping on failure.

compiler/mercury_to_mercury.m:
	Print out include_file directives.

compiler/module_imports.m:
	Record in module_imports the list of included files.

compiler/make.dependencies.m:
	Add files referenced by include_file directives as dependencies of
	the module's compiled-code target.

compiler/make.module_dep_file.m:
	Introduce .module_dep file format version 2, which has an additional
	field: the list of included files that the module depends on.

	Refactor the .module_dep file parsing code.

compiler/add_pragma.m:
compiler/add_solver.m:
compiler/coverage_profiling.m:
compiler/det_analysis.m:
compiler/erl_call_gen.m:
compiler/erl_code_gen.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/hlds_out_goal.m:
compiler/intermod.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
compiler/ml_code_gen.m:
compiler/modecheck_goal.m:
compiler/modules.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/prog_item.m:
compiler/typecheck.m:
compiler/unique_modes.m:
compiler/write_deps_file.m:
	Conform to changes.

	Rename "foreign_code" where "foreign_proc" is meant.

doc/reference_manual.texi:
	Document include_file as a lanaguage extension.

tests/invalid/Mmakefile:
tests/invalid/foreign_include_file_missing.err_exp:
tests/invalid/foreign_include_file_missing.m:
tests/mmc_make/Mmakefile:
tests/mmc_make/inc/code.c:
tests/mmc_make/inc/code.cs:
tests/mmc_make/inc/code.erl:
tests/mmc_make/inc/code.java:
tests/mmc_make/inc/decl.cs:
tests/mmc_make/inc/decl.erl:
tests/mmc_make/inc/decl.h:
tests/mmc_make/inc/decl.java:
tests/mmc_make/include_file.exp:
tests/mmc_make/include_file.m:
	Add test cases.

NEWS:
	Announce the change.
Fix duplicate error message from mmc --make.

mmc --make reports a duplicate error message when a dependency file
cannot be found, e.g.

** Error: file `./foo' not found: file `./foo' not found

make.dependencies.m:
	Fix the problem.
Add foreign include files to makefile dependencies files.

List files included by pragma foreign_decl and pragma foreign_code
declarations in the makefile dependencies file (`.d') generated for
a module.

The written dependencies are more conservative than necessary
(e.g. C target files should not depend on Java include files),
but I don't think any more effort is warranted.

compiler/module_imports.m:
	Add get_foreign_include_files to return a list of include files
	from a list of items.

compiler/modules.m:
	Add foreign include files when initialising the module_imports
	structure in grab_imported_modules. Otherwise it will be empty
	when the `.d' file is automatically generated as a side-effect
	of generating target code.

compiler/write_deps_file.m:
	Write include files from the module_imports structure into the
	`.d' file.

doc/reference_manual.texi:
	Update manual.

tests/invalid/Mmakefile:
	Make `missing_file' a phony target.  This change makes `make'
	aware of the dependency and report the error, instead of
	running the test case that checks the compiler's reaction
	to the missing file.