Commit Graph

32 Commits

Author SHA1 Message Date
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Paul Bone
fc4b3ff196 Remove .cvsignore files
Remove old .cvsignore files, moving their contents to .gitignore files.
There are now no .cvsignore files in the repository.

I've also sorted some .gitignore files and avoided repeating a pattern in a
subdirectory's .gitignore file when it is already mentioned in the parent
.gitignore file.
2017-04-04 12:05:56 +10:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Sebastian Godelet
fcee76f671 Update .gitignore files.
Update .gitignore files to ignore Unix executables and intermediate files.

extras/.gitignore:
    ignore *.beams

extras/cgi/.gitignore:
extras/gator/.gitignore:
extras/graphics/mercury_cairo/tutorial/.gitignore:
extras/logged_output/.gitignore:
extras/monte/.gitignore:
extras/odbc/.gitignore:
extras/posix/samples/.gitignore:
extras/quickcheck/.gitignore:
extras/quickcheck/tutes/.gitignore:
extras/references/samples/.gitignore:
    ignore executable(s)

extras/references/tests/.gitignore:
extras/trailed_update/tests/.gitignore:
    ignore test *.res and *.out files,
    ignore executable

extras/windows_installer_generator/sample/.gitignore:
samples/concurrency/dining_philosophers/.gitignore:
samples/concurrency/midimon/.gitignore:
    ignore executables

tests/hard_coded/.gitignore:
    ignore *.o and *.obj object files
2014-11-06 22:33:48 +11:00
Julien Fischer
df345f7258 Ignore generated files in the extras.
Branches: main, 11.07

extras/*/.cvsignore:
	Ignore generated files in the extras.
2011-11-18 03:03:26 +00:00
Julien Fischer
c6a30b9942 Make compilation of extras/references more reliable.
Branches: main, 11.07

Make compilation of extras/references more reliable.

extras/references/Makefile:
extras/references/Mmakefile:
extras/references/Mercury.options:
	Use mmc --make to build and install this library (as we do with
	some of the other extras packages) instead of mmake.  This allows
	us to sue the grade filtering mechanism in mmc --make to ensure
	that we only install the library in grades that support trailing.

	Fix a number of problems that prevent this library installing cleanly:

	+ don't require the presence of asm_fast grades; build the library in
	the default grade with the trail segment component added.

	+ use trail segment grades instead of fixed sized trail grades (the latter
	are not installed anymore unless specifically requested by the user).

	+ install the C header file that is part of this library.

	+ delete ancient workarounds for supporting shared libraries on Linux.

extras/references/tests/Mmakefile:
extras/references/samples/Mmakefile:
	Conform to the above changes.

	Don't assume that the extension for static libraries is .a; it's
	not on some systems.

extras/references/global.m:
	Add a feature set pragma specifying that trailing is required.

extras/references/nb_reference.m:
	s/__/./

extras/lex/lex.m:
	Unrelated change: avoid using an obsolete function.
2011-11-16 07:12:49 +00:00
Julien Fischer
8ae6bf9bd4 Remove uses of the old C interface from the extras distribution.
Branches: main

Remove uses of the old C interface from the extras distribution.

extras/lazy_evaluation/lazy_list.m:
extras/quickcheck/qcheck.m:
extras/references/samples/max_of.m:
	Use the new foreign language interface instead of the old C
	interface.

extras/curses/basics.m:
	As above, and conform to our current coding standards.
2010-07-27 22:33:46 +00:00
Julien Fischer
36ac2b4c77 Merge late changes from the 0.13 branch onto the main branch.
Estimated hours taken: 0.5
Branches: main

Merge late changes from the 0.13 branch onto the main branch.

BUGS:
	Merge in additions from the 0.12(!) branch.

HISTORY:
	Fix typos and be more consistent about the formatting of dates.

NEWS:
	Move the news about checking inst declarations for consistency
	with visible type constructors to the post-0.13 news where it belongs.

	Merge changes to the 0.13 branch.

README.Solaris:
	Merge changes from the 0.13 branch.

compiler/notes/todo.html:
	Merge changes from the 0.13 branch.

doc/user_guide.texi:
	Merge changes from 0.13 branch related to trace counts
	documentation.

extras/curses/sample/smalltest.m:
extras/gator/genotype.m:
extras/references/tests/ref_test.m:
samples/rot13/rot13_ralph.m:
tests/mmc_make/complex_test.m:
tests/mmc_make/lib/complex.m:
	Merge minor fixes from the 0.13 branch.
2006-09-15 09:11:24 +00:00
Julien Fischer
778134ff1e Avoid purity mismatches between predicate delcarations and
Estimated hours taken: 0.1
Branches: main, release

extras/references/nb_references.m:
extras/references/reference.m:
extras/references/scoped_update.m:
	Avoid purity mismatches between predicate delcarations and
	foreign clauses.
2006-07-28 05:23:17 +00:00
Julien Fischer
f0d430aa63 Fix some typos in my last change.
extras/references/tests/glob_test.m:
	Fix some typos in my last change.
2006-04-21 05:04:04 +00:00
Julien Fischer
e001ac930a Fixes and cleanups for extras/references.
Estimated hours taken: 0.2
Branches: main, release

Fixes and cleanups for extras/references.

extras/references/Mmakefile:
	Don't emit warnings about the module global not exporting anything.

extras/references/global.m:
	Add a missing interface declaration and reformat the list of
	module imports.

extras/references/tests/ref_test.m:
extras/references/tests/glob_test.m:
extras/references/tests/glob_test_2.m:
	Add missing `MR_' prefixes.

	Use the new foreign language interface.

	Add missing character escapes.
2006-04-21 04:56:53 +00:00
Mark Brown
882674fc8a When creating a new backtrackable reference that uses choicepoint ids
Estimated hours taken: 20
Branches: main

When creating a new backtrackable reference that uses choicepoint ids
to avoid redundant trailing, set the initial value of the id using
MR_null_choicepoint_id() rather than MR_current_choicepoint_id().
If the current id is used, any updates that are performed before the
next choicepoint is created will not be trailed since the code for
updating the reference checks the stored id against the id that is
current at the time of the update, and only adds a trail entry if they
differ.

Normally this wouldn't be a problem because if execution ever does
backtrack to that initial choicepoint then it means it has backtracked
to a point before the reference was created, hence the reference should
no longer be live and it wouldn't matter that the reference was not
untrailed back to its initial value.  In this case the only effect of
this change is that at most one unnecessary entry may be added to the
trail.

However, if a predicate that creates such a reference is tabled, then the
reference will still exist in the table even after backtracking, and will
be produced again if that predicate is later called.  At this point the
reference will not necessarily have its correct initial value.

doc/reference_manual.texi:
	In the section on avoiding redundant trailing, advise users to
	use MR_null_choicepoint_id() if a mutable data structure is
	created by a predicate or function that is tabled.

extras/references/reference.m:
	Use MR_null_choicepoint_id() in the implementation of
	new_reference/2, and document the reason.

extras/references/tests/Mmakefile:
extras/references/tests/glob_test_2.m:
extras/references/tests/glob_test_2.exp:
	A test case that fails in grade asm_fast.gc.tr with the previous
	version of reference.m, but succeeds now.
2004-12-21 06:37:22 +00:00
Ralph Becket
a7eda91023 Some `\n's needed an extra level of escaping because they
Estimated hours taken: 0.2
Branches: main

extras/references/scoped_update.m:
        Some `\n's needed an extra level of escaping because they
        themselves appeared in escaped string literals.  In at
        least one case this caused a #define to break in the
        generated .c file.
2004-03-03 02:54:08 +00:00
Fergus Henderson
67afe2c9fc Various changes to make it easier to build the extras.
Estimated hours taken: 0.5
Branches: main, release

Various changes to make it easier to build the extras.

extras/dynamic_linking/Mmakefile:
	Don't require the existence of "../../../mercury/browser".

extras/posix/README:
	Mention that it may be necessary to set MLLIBS.

extras/references/Mmakefile:
	Don't include the "asm_fast.tr" grade in LIBGRADES, since by
	default the Mercury standard library doesn't get installed in
	that grade.
2004-02-17 00:00:24 +00:00
Fergus Henderson
3de9a418f1 Fix a bug: pass C compiler options in CFLAGS rather than in MGNUCFLAGS.
Estimated hours taken: 0.25
Branches: main

extras/references/tests/Mmakefile:
	Fix a bug: pass C compiler options in CFLAGS rather than in MGNUCFLAGS.
2003-08-12 07:01:35 +00:00
Fergus Henderson
339952e222 Use private_builtin.ref(T) rather than c_pointer for the
Branches: main
Estimated hours taken: 1

extras/references/nb_reference.m:
	Use private_builtin.ref(T) rather than c_pointer for the
	nb_reference type, so that nb_references can be copied using
	copy/1 or stored in `pragma memo' tables.
2003-08-12 06:52:48 +00:00
Fergus Henderson
dced016cc1 Fix a problem where different packages in the `extras' distribution
Estimated hours taken: 3
Branches: main, release

Fix a problem where different packages in the `extras' distribution
were being installed in different directories when you specified
INSTALL_PREFIX in the Mmake.params file.  Some honoured the INSTALL_PREFIX
setting, some appended "/extras", and some ignored it completely.

Also, add `clean' and `realclean' targets for the extras directory hierarchy,
and fix a few other minor bugs.

extras/lazy_evaluation/Mmakefile:
	Include Mmake.params, which previously wasn't included at all
	in this file.

extras/logged_output/Mmakefile:
extras/odbc/Mmakefile:
extras/quickcheck/Mmakefile:
	Append "/extras" to INSTALL_PREFIX, which previously wasn't done
	at all in these directories.

extras/cgi/Mmakefile:
extras/complex_numbers/Mmakefile:
extras/concurrency/Mmakefile:
extras/curs/Mmakefile:
extras/curses/Mmakefile:
extras/dynamic_linking/Mmakefile:
extras/moose/Mmakefile:
extras/posix/Mmakefile:
	Move the line `INSTALL_PREFIX := $(INSTALL_PREFIX/extras)'
	to before the include of Mmake.params, so as not to override
	the user's setting (only override the default setting).

extras/Mmakefile:
extras/concurrency/Mmakefile:
	Add `clean' and `realclean' targets.

extras/posix/Mmakefile:
	Add MGNUCFLAGS = --no-ansi, since this is needed on some systems.

extras/quickcheck/Mmakefile:
	Add "depend", "all", and "install" targets.
	Ensure that the "check" target runs the test program.

extras/quickcheck/qcheck.m:
	Set the exit status to non-zero if a test fails.

extras/references/Mmakefile:
	Adjust the setting of LIBGRADES to account for the fact that
	$(GRADE) is no longer implicitly included in $(LIBGRADES).
2003-01-16 10:44:26 +00:00
David Overton
fd8c5bcf78 Fix places where the code previously assumed that `nb_reference(T)' and
Estimated hours taken: 3
Branches: main

extras/references/nb_reference.m:
extras/references/reference.m:
extras/references/tests/glob_test.m:
extras/references/tests/ref_test.m:
	Fix places where the code previously assumed that `nb_reference(T)' and
	`reference(T)' had the same representation as `c_pointer'.
	This is not the case in some grades, e.g. the `--reserve-tag' grades.
2003-01-10 05:49:22 +00:00
Fergus Henderson
d62c697231 Add appropriate infrastructure to support doing `mmake depend && mmake
Estimated hours taken: 2
Branches: main

Add appropriate infrastructure to support doing `mmake depend && mmake
&& mmake install' in the `extras' directory, and having it automatically
install and build as much as possible.

extras/Mmakefile:
	New file.

extras/cgi/Mmakefile:
	Delete bogus reference to `ALL_LIBGRADES' and `mercury-config'.

extras/complex_numbers/Mmakefile:
extras/concurrency/Mmakefile:
extras/concurrency/concurrency.m:
extras/curses/Mmakefile:
extras/dynamic_linking/Mmakefile:
extras/lazy_evaluation/Mmakefile:
extras/lex/Mmakefile:
extras/moose/Mmakefile:
extras/xml/Mmakefile:
	Add rules for `mmake install'.

extras/references/scoped_update.m:
	Add macro guard around typedef in `c_header_code'.

extras/curs/Mmakefile:
extras/curses/Mmakefile:
	Define MERCURY_BOOTSTRAP_H, to avoid name clash on `bool'
	that is caused by our bootstrap code in runtime/Merucry.h.

extras/curs/curs.m:
	Add `promise_pure' declarations for all pure procedures.
	XXX Should this be needed?  These predicates all take
	io__state arguments.
2002-03-06 10:10:31 +00:00
Simon Taylor
c66cea0665 Add MR_ prefixes to uses of configuration macros.
Estimated hours taken: 2.5
Branches: main

Add MR_ prefixes to uses of configuration macros.
Bootcheck now succeeds with MR_NO_CONF_BACKWARDS_COMPAT.

Mmake.common.in:
	Define MR_NO_CONF_BACKWARDS_COMPAT when checking
	for namespace cleanliness.

RESERVED_MACRO_NAMES:
	Remove the configuration macros.

runtime/mercury_conf_bootstrap.h:
	Remove a duplicate definition of BOXED_FLOAT.

configure.in:
*/*.c:
*/*.h:
*/*.m:
	Add MR_ prefixes.
2002-02-13 09:56:49 +00:00
David Overton
7cda95695e Add "MR_" prefixes to a number of identifiers which were missing them.
Estimated hours taken: 0.5
Branches: main


extras/references/c_reference.h:
extras/references/nb_reference.m:
extras/references/reference.m:
extras/references/scoped_update.m:
	Add "MR_" prefixes to a number of identifiers which were missing them.
2002-01-21 05:20:35 +00:00
Zoltan Somogyi
a1cd1a1633 Optionally test the extras directory during bootchecks.
Estimated hours taken: 4

Optionally test the extras directory during bootchecks.

tools/bootcheck
	Add an option, -e, for testing the extras directory. Rename the
	-T/--test-only option as -n/--no-bootcheck, since it does not prevent
	the testing of the extras.

	Bootcheck only test the subdirectories in extras which have an
	Mmakefile and which can be tested in all grades and in all setups.

extras/*/Mmakefile:
	Updates to include extras/Mmake.params if it exists (to get the
	parameters, including grades, of the bootcheck) and to add a check
	target, which in most cases does not do anything yet (which means
	that the only testing we do is checking that the program compiles
	all right). Making "mmake check" do something meaningful will be
	up to the authors of the various subdirectories involved.

	In many cases, add .PHONY annotations on the relevant targets,
	and copyright notices.

extras/aditi/NOBOOTTEST:
	Prevent the automatic testing of the aditi subdirectory from
	bootcheck, since this can be done only on a machine with Aditi
	installed.

extras/aditi/NOBOOTTEST:
	Prevent the automatic testing of the aditi subdirectory from
	bootcheck, since this can be done only on a machine with Aditi
	installed.

extras/aditi/NOBOOTTEST:
	Prevent the automatic testing of this subdirectory from bootcheck,
	since this can be done only on a machine with Aditi installed.

extras/dynamic_linking/NOBOOTTEST:
	Prevent the automatic testing of this subdirectory from bootcheck,
	since this can be done only on a machine with the dl library already
	installed.

extras/logged_out/NOBOOTTEST:
	Prevent the automatic testing of this subdirectory from bootcheck,
	since this can be done only in grades with the right kind of stream
	support.

extras/odbc/NOBOOTTEST:
	Prevent the automatic testing of this subdirectory from bootcheck,
	since this can be done only on a machine with ODBC installed.

extras/references/NOBOOTTEST:
extras/trailed_update/NOBOOTTEST:
	Prevent the automatic testing of this subdirectory from bootcheck,
	since this can be done only in trailing grades.

extras/*/.nocopyright:
	Mention the NOBOOTTEST files in the relevant .nocopyright files.
2000-11-21 23:52:54 +00:00
Zoltan Somogyi
76943f86ff New files.
Estimated hours taken: 0.1

extras/*/.nocopyright:
	New files.
2000-11-21 23:48:36 +00:00
Zoltan Somogyi
ec7cae8c58 Clean up some typeinfo handling code that is only enabled in non-gc grades.
Estimated hours taken: 2

Clean up some typeinfo handling code that is only enabled in non-gc grades.

runtime/mercury_deep_copy.[ch]:
	Make the typeinfo arg of MR_make_long_lived MR_TypeInfo, not Word.

runtime/mercury_tabling_macros.h:
	Treat the typeinfo arg of MR_make_permanent, a macro that calls
	MR_make_long_lived, a MR_TypeInfo, not Word.

extras/reference/nb_reference.m:
	Treat the typeinfo arg of MR_make_long_lived a MR_TypeInfo, not Word.

library/exception.m:
library/std_util.m:
	Treat the typeinfo arg of deep_copy as MR_TypeInfo, not Word.

	Also fix some other warnings in std_util.m.

library/private_builtin.m:
	Pass the addresses of type_ctor_infos (which function as type_infos)
	to MR_TABLE_SAVE_ANSWER.

	Expect that argument to be a typeinfo, not the name of a type_ctor_info
	to take the address of.

trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
	Treat the typeinfo arg of deep_copy as MR_TypeInfo, not Word.
2000-04-14 07:20:38 +00:00
Warwick Harvey
5ffdd46a80 This change basically exposes the C types used for implementing the
Estimated hours taken: 12 (this figure a wild guess, because most of this
stuff was done about 6 months ago and left to rot).

This change basically exposes the C types used for implementing the
`reference' and `nb_reference' types in extras/references, so that if the
user wishes to allocate these types somewhere other than on the heap, they
can.  This is needed by HAL in order to implement global variables.

extras/references/c_reference.h:
        New file, intended to expose the C types used by the `reference'
        and `nb_reference' modules, so that the user can allocate them
        somewhere other than on the heap if they need to.

extras/references/nb_reference.m:
        Added a new predicate `init/2' for initialising a user-allocated
        `nb_reference'.

extras/references/reference.m:
        Moved the `ME_Reference' type to c_reference.h, and added a new
        predicate `init/2' for initialising a user-allocated `reference'.

extras/references/README:
        Added entries for the new `c_reference.h' and `tests/glob_test.m'
        files, as well as correcting the name of `tests/ref_test.m'.

extras/references/tests/Mmakefile:
        Added `glob_test' to the list of programs to build.

extras/references/tests/glob_test.m:
        Test case for statically-allocated reference types, implementing
        global variables.  Adapted from output from the HAL compiler.

extras/references/tests/glob_test.exp:
        Expected output from `glob_test'.
2000-01-28 03:37:14 +00:00
Warwick Harvey
9338420eb6 Fixed/cleaned up a few things in extras/references:
Estimated hours taken: 1

Fixed/cleaned up a few things in extras/references:

extras/references/Mmakefile:
        Made the building of the programs in the `samples' subdirectory part
        of a new `install_check' target (rather than the old `check'
        target), since the Mmakefile in that directory assumes the library
        has been installed already.

extras/references/tests/ref_test.m:
        Updated so it works again.  It was trying to do I/O in contexts
        which weren't det.  Basically introduced a new impure pragma c_code
        predicate for dumping the value of an integer to standard output.
2000-01-28 03:32:33 +00:00
Peter Schachte
b52737da7a Fix comment rot in extras/references
Estimated hours taken: 0.1

README:
reference.m:
	fix comments referring to the Mercury manuals to correct for
	manual restructuring.
1999-11-18 05:44:56 +00:00
Warwick Harvey
be51ca48b6 Added built-in mmake support for installing user libraries.
Estimated hours taken: 30

Added built-in mmake support for installing user libraries.

Mmake.common.in:
	Moved the definitions of many of the generic install directories
	(plus FULLARCH and LIBGRADES) to scripts/Mmake.vars.in, so they
	can be used for things other than just the Mercury compiler.

compiler/modules.m:
	Added code to generate appropriate lib<module>.install* targets.
	Improved the dependency list generated for the lib<module> target to
	include intermodule optimisation files if and only if the
	appropriate flags have been set (previously it always depended on
	the `.opt' files, but never on the `.trans_opt' files).

scripts/Mmake.rules:
	Added some rules for use when installing libraries.

scripts/Mmake.vars.in:
	Added the definitions of many of the generic install directories
	(plus FULLARCH and LIBGRADES) from Mmake.common.in.
	Added support for overriding and/or adding to the definition of
	LIBGRADES on a per-library basis.

scripts/mercury_cleanup_install:
	New script, for cleaning up after failed installs.

scripts/Mmakefile:
	Added `mercury_cleanup_install' to the list of scripts to be
	installed.

bindist/Mmakefile:
bindist/bindist.Makefile.in:
	Added `mercury_cleanup_install' and `vpath_find' to the list of
	utilities included in and installed by a binary distribution.  These
	are used by some of the install targets.

doc/user_guide.texi:
	Documented the new features.

extras/references/Mmakefile:
extras/references/samples/Mmakefile:
	Changed to exploit/test new features.
1999-10-21 14:36:39 +00:00
Zoltan Somogyi
466c844964 Make the retry command work in trailing grades (e.g. for HAL).
Estimated hours taken: 18

Make the retry command work in trailing grades (e.g. for HAL).

compiler/trace.m:
	In trailing grades, reserve two stack slots to hold (a) the trail
	pointer on entry, and (b) a new ticket obtained on entry. Arrange to
	put the numbers of these stack slots in the proc layout.

compiler/stack_layout.m:
	Put the number of the first of these stack slots in the proc layout.

compiler/code_info.m:
	Arrange the default: there are no such slots if debugging is not
	enabled.

compiler/code_gen.m:
	Insert code to discard the allocated ticket, in the success epilog
	of model_det procedures, the success and failure epilogs of model_semi
	procedures, and the failure epilogs of model_non procedures.
	(Model_det procedures don't have failure epilogs, and discarding
	the ticket in the success epilog of a model_non procedure would be
	premature.)

compiler/llds.m:
	Add two new alternatives to the type describing stack slots:
	a stack slot may contain a trail pointer or a ticket.

	Add a new reason for resetting the trail: a retry in the debugger.

compiler/llds_out.m:
	Minor changes to conform to llds.m, and to make diagnostic output
	less misleading.

library/builtin.m:
	Add the type_ctor_info for the new "types" describing stored trail
	pointers and tickets.

	Bring up to date the type_ctor_infos of other "types" used only
	for describing stack slots.

library/std_util.m:
	Add the missing code to handle the type_ctor_infos of trail pointers,
	tickets and other "types" used only for describing stack slots.

runtime/mercury_type_info.h:
	Add a new type_ctor representation value for stored trail pointers,
	tickets, and for other "types" used only for describing stack slots.

runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
	Add the missing code to handle the type_ctor_infos of trail pointers,
	tickets and other "types" used only for describing stack slots.

runtime/mercury_stack_layout.h:
	Add a field to proc layouts to hold either the number of the first
	of the two stack slots holding trail info, or -1.

runtime/mercury_trail.h:
	Add the new reason why the trail may be reset.

trace/mercury_trace.c:
	In trailing grades, reset the trail, with the reason being given
	as retry, when the debugger's retry command is executed.

extras/references/scoped_update.m:
extras/trailed_update/var.m:
clpr/cfloat.m:
extras/trailed_update/tests/func_trail_test.m:
extras/trailed_update/tests/func_trail_test_2.m:
	Handle MR_retry as a reason for unwinding the trail.
1999-10-08 02:56:24 +00:00
Fergus Henderson
98b0afa001 Use clean_local' instead of clean' and `realclean_local' instead
Estimated hours taken: 0.75

Mmakefile:
*/Mmakefile:
*/*/Mmakefile:
*/*/*/Mmakefile:
	Use `clean_local' instead of `clean' and `realclean_local' instead
	of `realclean' where appropriate.  This is necessary now that
	`realclean' does not depend on `clean'.
1999-09-16 04:46:31 +00:00
Warwick Harvey
174ea0ff5b Split the automatically generated .dep' file into two files. The new .dv'
Estimated hours taken: 15

Split the automatically generated `.dep' file into two files.  The new `.dv'
file contains all the variable definitions which used to be in the `.dep'
file, which now contains just the rules.  With mmake including the `.dv'
files before the user's Mmakefile and the `.dep' files after, this allows
user-defined Mmakefiles to refer to the automatically-generated variables
and automatically-generated rules to refer to variables defined in the
user's Mmakefile.  This was possible before to a limited extent, but in
particular dependency lists for automatically-generated rules could not
refer to user-defined variables.

Also introduced `C2INITARGS' as part of an illustration of how this change
is useful (though probably this should be a separate change).  `C2INITARGS'
should be used to specify extra files to be passed to `c2init', rather than
the currently-used `C2INITFLAGS' (which should only be used for option
flags).  The `_init.c' target should depend on these extra arguments, but it
was not possible to do this automatically prior to this change (at least,
not if one wanted to support per-program specification of `C2INITARGS').

compiler/modules.m:
	Generate the new `.dv' files and revised `.dep' files.
	Update the `change_clean' and `real_clean' targets to delete the
	`.dv' files.
	Update the `_init.c' rule to refer to `$(ALL_C2INITARGS)' as well as
	`$(ALL_C2INITFLAGS)', and add a dependency on `$(ALL_C2INITARGS)'.

scripts/Mmake.rules:
	Add appropriate rules and dependencies for `.dv' files.

scripts/Mmake.vars.in:
	Add definitions for implementing `C2INITARGS'.

scripts/mmake.in:
	Add code for using `.dv' files (while maintaining backward
	compatibility for when they don't exist).

doc/user_guide.texi:
	Document the new `.dv' files.
	Document the new `C2INITARGS' variables and the dependencies they
	imply.

../clpr/Mmakefile:
../clpr/samples/Mmakefile:
extras/complex_numbers/samples/Mmakefile:
extras/complex_numbers/tests/Mmakefile:
extras/graphics/mercury_opengl/Mmakefile:
extras/references/samples/Mmakefile:
extras/references/tests/Mmakefile:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
	Update to use `C2INITARGS' instead of `C2INITFLAGS', where
	appropriate, and remove any now-obsolete `%_init.c' dependencies
	(which wouldn't have worked anyway since GNU Make ignores pattern
	dependencies with no commands).
1999-07-20 03:39:24 +00:00
Warwick Harvey
9cbccbd5dc This change adds a new extras directory, "references".
Estimated hours taken: 70 (plus whatever pets spent when he wrote the
original version of this)

This change adds a new extras directory, "references".  This directory
contains two impure reference type modules and a module that allows scoped
non-backtrackable update, along with examples of using them and tests.
These modules are intended to be useful when HAL is retargetted to Mercury,
for implementing global variables (backtracking and non-backtracking), and
may also be useful for the debugger.

In order to implement these features, a new memory zone "global heap" was
added to the runtime system, for a heap which is not reclaimed on failure,
along with a pair of functions for copying terms to this heap.

runtime/mercury_deep_copy.c:
runtime/mercury_deep_copy.h:
	Added two functions, MR_make_permanent() and
	MR_make_partially_permanent(), which essentially do a deep copy of a
	term to the global heap.
	(In conservative GC grades, these functions actually do nothing).

runtime/mercury_engine.c:
runtime/mercury_engine.h:
	Added fields global_heap_zone and e_global_hp (for the global heap
	and its heap pointer) to the MR_mercury_engine_struct, along with
	appropriate initialisation, etc.
	Defined MR_heap_zone, MR_solutions_heap_zone, and
	MR_global_heap_zone for convenient access to the corresponding field
	of the relevant Mercury engine.

runtime/mercury_memory.c:
	Added code for handling the size and zone size of the global heap.

runtime/mercury_regorder.h:
runtime/mercury_regs.h:
	Defined MR_global_hp (the global heap pointer for general use),
	along with corresponding other changes.

runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
	Added declarations and initialisation of the size and zone_size of
	the global_heap.
	Added an entry for MR_GLOBAL_HP_RN to print_register_usage_counts()
	(plus missing entries for MR_SOL_HP_RN, MR_MIN_HP_REC and
	MR_MIN_SOL_HP_REC).

New files:

extras/references/Mmakefile:
	Mmakefile for building and testing these modules.

extras/references/README:
	Description of contents of this directory.

extras/references/global.m:
	A wrapper module for building a library containing the nb_reference,
	reference and scoped_update modules.

extras/references/nb_reference.m:
	Implements references which are not backtracked on failure.

extras/references/reference.m:
	Implements references which *are* backtracked on failure.

extras/references/scoped_update.m:
	Allows nested scoping of non-backtracking references.

extras/references/samples/Mmakefile:
extras/references/samples/max_of.m:
extras/references/samples/max_test.exp:
extras/references/samples/max_test.m:
	An example of using a non-backtracking reference (to find the
	maximum of the solutions generated by a predicate), with tests.

extras/references/tests/Mmakefile:
extras/references/tests/ref_test.exp:
extras/references/tests/ref_test.m:
	Some tests of references (backtracking and non-backtracking) and
	scoping.
1998-06-18 04:30:48 +00:00