Commit Graph

15 Commits

Author SHA1 Message Date
Fergus Henderson
38ae5fe0c5 Fix a bug which caused link errors in some grades for some test cases
Estimated hours taken: 1

Fix a bug which caused link errors in some grades for some test cases
where the module name wasn't the same as the file name, and which
probably would have caused runtime errors in some grades for test
cases using nested modules.

compiler/modules.m:
	Call $(C2INIT) with $(foo.cs) instead of $(foo.ms).
	This is necessary now that a single .m file can get compiled
	to multiple .c files, if it contains nested modules,
	or to a .c file whose name reflects the module name rather
	than the source file name.

util/mkinit.c:
scripts/c2init.in:
	For efficiency, change c2init and mkinit so that when c2init's
	arguments are `.c' files, it computes the init function based
	on the filename (like it used to do with `.m' files), rather
	than by reading the file contents and searching for "** INIT"
	comments.  Add a new option `-x' (`--extra-inits') which keeps
	the old behaviour.

compiler/modules.m:
scripts/Mmake.rules:
	Instead of deleting the `_init.c' file every time we recreate
	the `.dep' file, just tell make that the `_init.c' file depends on
	the `.dep' file, so that make will remake it if the `.dep' file
	changes.  (I don't know why I didn't do it that way in the
	first place.)
1998-05-30 13:34:17 +00:00
Fergus Henderson
a6357c33bb Fix a small quoting bug in my previous change.
Estimated hours taken: 0.1

scripts/c2init.in:
	Fix a small quoting bug in my previous change.
1997-09-06 12:04:15 +00:00
Fergus Henderson
8bc9cf2d1c Use only libmercury.init and runtime.init in $MERCURY_MOD_LIB_DIR,
Estimated hours taken: 0.25

scripts/c2init.in:
	Use only libmercury.init and runtime.init in $MERCURY_MOD_LIB_DIR,
	rather than using `$MERCURY_MOD_LIB_DIR/*'.  This avoids problems
	if other .init files (e.g. cfloat_lib.init) are installed in
	the same directory.
1997-09-06 11:44:02 +00:00
Fergus Henderson
d1cc2ddee4 Split up the startup interface so that there are seperate
Estimated hours taken: 8

Split up the startup interface so that there are seperate
initialization and termination functions, rather than just a single
mercury_runtime_main() function which does everything.
Also change things so that the io__state data is stored in global
variables.

runtime/init.h:
util/mkinit.c:
runtime/wrapper.h:
runtime/wrapper.mod:
	Move declarations for stuff defined in wrapper.mod from init.h
	to wrapper.h.  Clean up the remainder of init.h so that it
	is clear which parts are interface and which are just there
	for use by *_init.c.

	Change the automatically-generated *_init.c files
	so that they call mercury_runtime_init(),
	mercury_runtime_main(), and mercury_runtime_terminate(),
	rather than just mercury_runtime_main().
	Define these new two functions in wrapper.mod.

	Delete the library_entry_point; change do_interpreter
	to call program_entry_point directly, rather than via
	library_entry_point.

runtime/engine.h:
runtime/engine.mod:
	Add new function terminate_engine().
	Delete the function start_mercury_engine();
	move the code that used to be there to the end
	of init_engine().

runtime/context.h:
runtime/context.mod:
	Add new function shutdown_processes().
	(The current implementation is just a stub.)
	Add a call to debug_memory() in init_process_context().

runtime/memory.h:
runtime/memory.c:
	Export the debug_memory() function, for use by context.c.

library/io.m:
library/io.nu.nl:
	Change things so that the io__state data is stored in C global
	variables (or, for Prolog, using assert/retract), rather than
	passing around a data structure.  (Actually we still pass the
	data structure around, but it is just a dummy Word that never
	gets used.)

	Delete the old hand-coded io__run predicate, which was
	the library entry point; instead export C functions
	ML_io_init_state() and ML_io_finalize_state().	Move the
	code for handling profiling from io__run to do_interpreter
	in runtime/wrapper.mod.

scripts/c2init.in:
	Change the default entry point from io__run_0_0 to main_2_0
1997-09-05 22:38:58 +00:00
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Fergus Henderson
8ce103cc76 Add Unix-style man pages for most of the Mercury development tools.
scripts/c2init.in:
scripts/mmake.in:
scripts/msc.in:
	Small changes to the help messages to make them come out
	better when converted to man pages.

scripts/mgnuc.in:
	Add a `--help' option.
1997-02-07 14:17:41 +00:00
Fergus Henderson
d14bdd2eee More stuff to support non-Mercury main() programs.
Estimated hours taken: 0.5

More stuff to support non-Mercury main() programs.

util/c2init.c:
	Implement a new `-l' / `--libary' option.
	If this option is enabled, we pass `-l' to mkinit,
	which has the end result that we don't emit a main(),
	but instead we emit a mercury_main(argc, argv, stack_bottom)
	function that can be called from C.
1997-02-01 00:12:06 +00:00
Fergus Henderson
62377e8bf2 Fix a portability problem: ULTRIX's /bin/sh does not understand
Estimated hours taken: 0.5

scripts/{c2init,mnc,mnl,msc,msl}.in:
	Fix a portability problem: ULTRIX's /bin/sh does not understand
	`shift 2', so I've replaced all occurrences of this with
	`shift; shift'.  (Thanks to Jeff Schultz for the bug report.)
1996-05-13 06:12:48 +00:00
Fergus Henderson
8cf86fd1ef Replace all uses of
scripts/*.in:
	Replace all uses of

		... "$@" ...

	with

		case $# in
			0) ... ...
			*) ... "$@" ...
		esac

	since on ULTRIX and OSF, "$@" does the wrong thing if $# is 0.
1995-09-18 07:14:09 +00:00
Fergus Henderson
eaf2c48c34 Don't use `getopts', since it is not portable.
c2init.in:
	Don't use `getopts', since it is not portable.
	Add long versions of all the options.
	Improve usage message.
1995-07-21 08:13:26 +00:00
Zoltan Somogyi
1849d45e77 Fixed usage message.
c2init.in:
	Fixed usage message.
1995-05-29 01:49:39 +00:00
Fergus Henderson
60bc8f3ef9 Change "#!/bin/sh" to "#! /bin/sh", since the latter is more portable.
scripts/*.in:
	Change "#!/bin/sh" to "#! /bin/sh", since the latter is more portable.
	Add "# @configure_input@" to the start of each file.
1995-05-19 08:17:46 +00:00
Fergus Henderson
1a468516f1 Another correction to the comments.
scripts/c2init.in:
	Another correction to the comments.
1995-05-19 07:35:01 +00:00
Fergus Henderson
aada31a38f Update the comments, which had become obsolete.
scripts/c2init.in:
	Update the comments, which had become obsolete.
1995-05-19 07:30:35 +00:00
Fergus Henderson
b02471a037 Change things so that we invoke a new `c2init' script to create the init files,
rather than invoking `mkinit' directly.  The reason is that `mkinit' only
does part of `mod2init's old job; `c2init' collects the filenames of the
standard library modules (possibly overridden by environment variables)
and passes these, together with the modules named on the command line,
to `mkinit'.
1995-05-13 05:51:35 +00:00