Commit Graph

29 Commits

Author SHA1 Message Date
Fergus Henderson
4d9e6d0b51 Implement string__split/4 and string__first_char/3 in C.
runtime/io.mod:
	Implement string__split/4 and string__first_char/3 in C.
1995-04-17 23:38:46 +00:00
Fergus Henderson
05a06e5bc5 Oops, modframe(do_fail)' should have been modframe(ENTRY(do_fail))',
io.mod:
	Oops, `modframe(do_fail)' should have been `modframe(ENTRY(do_fail))',
	so that it works with `-s fast'.
1995-04-17 17:37:14 +00:00
Fergus Henderson
6e8294eee2 Add incr_hp_atomic macro, which for USE_CONSERVATIVE_GC
imp.h:
	Add incr_hp_atomic macro, which for USE_CONSERVATIVE_GC
	invokes GC_MALLOC_ATOMIC() rather than GC_MALLOC().

io.mod:
	Use the new incr_hp_atomic() macro for allocating strings.
	Add implementations of string__index/2, string__length/2,
	and string__append/3.

Note - these changes sped up the compiler by nearly 40%!
1995-04-15 06:09:39 +00:00
Fergus Henderson
d7457e7144 Add semidet_succeed and semidet_fail.
runtime/io.mod:
	Add semidet_succeed and semidet_fail.
1995-04-11 13:24:15 +00:00
Fergus Henderson
3fc5389b53 Add copyright notices.
runtime/*:
	Add copyright notices.
1995-03-30 21:57:11 +00:00
Fergus Henderson
f3f7008f2d Implement io__putback_char/4 using ungetc() (for efficiency).
io.mod:
	Implement io__putback_char/4 using ungetc() (for efficiency).
1995-03-19 10:42:42 +00:00
Fergus Henderson
4d96493489 Add floating-point support.
code/io.mod:
	Add floating-point support.
1995-03-15 14:12:18 +00:00
Fergus Henderson
e68c61c354 If the chmod fails, don't worry about it.
Cakefile:
	If the chmod fails, don't worry about it.

ext_signal.h:
	Comment out most of the file if __sgi is defined.
	It didn't seem to work on the sgi.

wrapper.mod:
	Fix a serious bug with the -w option.

io.mod:
	Change io__run/0 so that it works even if main/2 is nondet.
	We need this (until we have implemented solutions/2) for the
	benchmarks.

memory.c, wrapper.h, wrapper.mod:
	Fix yet another serious modulus-on-signed-int bug.
	This stopped things working if you used shared libraries,
	since the address of fake_regs was negative, which confused
	the init_memory() function.
1995-03-06 10:37:16 +00:00
Fergus Henderson
47d2dd97d5 Don't include the default definition of main/2 in the library.
Cakefile:
	Don't include the default definition of main/2 in the library.

ext_stdlib.h:
	Remove most of the stuff here, since it was causing problems
	compiling on Irix.

ext_signal.h:
	Remove definition of MINSIGSTKSZ.

io.mod:
	Line numbers start from 1, not 0.

io.mod, wrapper.mod, wrapper.h:
	Implement io__{set,get}_exit_status.

prof.h:
	Add declaration of prof_current_proc.
1995-03-04 14:35:52 +00:00
Peter Ross
c94a851582 Redefined the tailcall macro's to include the Caller address for
imp.h:
	Redefined the tailcall macro's to include the Caller address for
	profiling, and to call the profile function.

*.mod:
	Changed all the handwritten tailcall's to conform to the new tailcall.
	Need to add makelocalentry macro so that I can save all the handwritten
	label names and they can be looked up by mprof.

prof.*:
	Added some more comment's.
1995-02-28 04:32:32 +00:00
Fergus Henderson
d4c7b3e54f Add new grades asm_*.
examples/Mercury:
	Add new grades asm_*.

wrapper.mod:
	Add a new -h (help) option.
	Change the behaviour of the -l option:
		Exit after printing the labels
		Don't use popen("sort -n"), since it's an unnecessary OS
		dependency and the user can do it anyway.
		[And because we weren't checking whether the call
		succeeded, and I didn't want to add checking code...]

io.mod, init.h, wrapper.mod, label.c:
	Remove support for automatically calling *_input.
	Optimize things so that we only call init_modules() if we
	are going to need the label names.
1995-02-26 17:50:40 +00:00
Fergus Henderson
5835cddc6a Cakefile dummy.c dummy.h engine.h engine.mod imp.h io.mod label.h wrapper.mod:
Make various changes required for using assembler labels.
1995-02-26 13:52:58 +00:00
Fergus Henderson
9841169e9a Make things work with conservative garbage collection.
imp.h:
	Make things work with conservative garbage collection.

tags.h, io.mod:
	Make things work with --tags none.
1995-02-15 03:58:01 +00:00
Fergus Henderson
c9efd870c5 Fix a couple of bugs and add some comments.
io.mod:
	Fix a couple of bugs and add some comments.
1995-02-10 02:02:21 +00:00
Fergus Henderson
7f068ffe15 Modify Tom's fix to io__do_open_input so that it reflects the
io.mod:
	Modify Tom's fix to io__do_open_input so that it reflects the
	documentation in io.nl.  Also apply a similar fix to
	io__do_open_{output,append}.
1995-02-09 23:16:48 +00:00
Thomas Conway
6eed92d988 a couple of alterations. Sort-of bug fixes:
io.mod:
	a couple of alterations. Sort-of bug fixes:
		- the mercury level expects an int return status of
		  -1 for invalid file opening, but the mod level code
		  was returning NULL.
		- univ_to_type was comparing the addresses of the
		  type_info structures which is incorrect.
1995-02-09 13:27:25 +00:00
Fergus Henderson
952953d4d2 Use __Unify___foo rather than unify_foo since the name mangling
io.mod:
	Use __Unify___foo rather than unify_foo since the name mangling
	for unification preds has changed.
	Also add __Compare__ and __Index__ for the types
	io__stream, io__external_state and univ.
1995-02-08 06:33:04 +00:00
Peter Ross
a05ed0ae3f Included prof.c and prof.h in the compile
Cakefile :
	Included prof.c and prof.h in the compile

CFLAGSFILE:
	Added the USE_PROFILING flag.

engine.mod:
	Added calls so that all the profiling info is dumped to a file

prof.*:
	Added some comments.

imp.h:
	Modified the call and localcall macros so that they save the
	callee-caller address pair if USE_PROFILING defined.

*.mod:
	Added the extra argument to all calls and local calls for the
	handwritten mod files.
1995-02-08 05:19:19 +00:00
Fergus Henderson
a5c1750ecb Add an entry point io__run/0 which initializes the io_state
Cakefile, io.mod, wrapper.h, wrapper.mod, main.mod:
	Add an entry point io__run/0 which initializes the io_state
	and then calls main/2.  Add a default do-nothing definition for
	main/2 in main.mod.  Implement io__command_line_arguments/3.

call.mod:
	Implement compare/3, index/2, and unify/2.
1995-02-07 07:06:53 +00:00
Fergus Henderson
af25449758 Various updates to defined some undefined procedures, including
io.mod:
	Various updates to defined some undefined procedures, including
	string__to_float, io__line_number, and unification procedures
	for univ, io__external_state, and io__stream.
	Fix a bug (wrongly used field 1 instead of field 0) in type_to_univ.
1995-02-02 05:40:47 +00:00
Fergus Henderson
9d3dfa2712 Change the implementation of type_to_univ/2 so that it uses
io.mod:
	Change the implementation of type_to_univ/2 so that it uses
	the --polymorphism calling convention, and uses the address
	of the unification predicate passed as a type identifier.
1995-01-20 02:38:53 +00:00
Fergus Henderson
f3b01045f0 Define Integer' to be a signed type the same size as Word'.
imp.h:
	Define `Integer' to be a signed type the same size as `Word'.

imp.h, io.mod:
	Replace incr_hp/1 macro with incr_hp/2.

list.c, std.h:
	Various minor cleanups.

tags.h:
	Replace all the casts to `unsigned' and `uint' with cases
	to `Word'.
1995-01-14 16:28:53 +00:00
Fergus Henderson
485774d973 Finish implementing string__to_int_list.
io.mod:
	Finish implementing string__to_int_list.

mod2c:
	Fix bug in #line output.
1994-10-13 21:54:43 +00:00
Fergus Henderson
fb4974c301 Use gcc's __attribute__((noreturn)) to suppress warnings
aux.c:
	Use gcc's __attribute__((noreturn)) to suppress warnings
	in functions that call fatal_error().

io.mod:
	Fix ANSI incompatibility: stdin/stdout/stderr might not be constants.
	Initialize mercury_std***.file on startup, rather than statically.

	Add io__write_char, intToString, and string__to_int_list.

mod2c:
	Fix bug in the pattern match for labels: it was only
	checking for lowercase, and hence it didn't work for intToString.

(All these changes have been tested on both munta and kryten.)
1994-10-13 16:13:22 +00:00
Fergus Henderson
79666048a6 Added a fatal_error() function to centralize error-handling.
aux.c, aux.h, imp.h
	Added a fatal_error() function to centralize error-handling.
	Various things in imp.h modified to use it.

io.mod:
	Added lots of new code.
	Most of the predicates in io.nu.nl are implemented now.
	I also implemented a few preds from the other .nu.nl files in here.

wrapper.c, wrapper.h:
	Export `progname', because it's needed by io.mod.
1994-10-06 18:07:58 +00:00
Zoltan Somogyi
af68e1e7c9 made the system compile with only one (unavoidable) warning 1994-08-15 07:15:27 +00:00
Zoltan Somogyi
73d802662b Made the Cakefile import examples/Mercury to ensure consistency.
Changes to examples/Mercury required changes to some other files.

The most important such change is that mod2c and gnuc now take a speed
grade argument of the form -s{fast,reg,jump,none,init,debug}. The -s
option of mod2c supersedes the -g option which is retained for backward
compatibility.

Renamed test_harness to wrapper because underscores now separate grade names
from the rest of the file base name in cake rules.
1994-07-14 05:52:54 +00:00
Zoltan Somogyi
7e1123553a Reorganized header files: each system module now has its own header file.
Some of these are included in imp.h, some aren't; the criterion is whether
automatically generated modules need the information in them.

Created a system whereby Mercury programs can be automatically compiled.

One part is the Mercury cakefile in examples (and the Cakefile that uses it),
which defines two targets for each Mercury program. These are e.g. nrev_fast
and nrev_debug for nrev.nl. As usual with System, the file Conf has one
line for each program in the directory; the file Entry likewise contains
the default entry point. Mod2init now inserts the default entry point
into the xxx_init.c file, and test_harness picks it up from there.

The other part is the creation and installation of the files and tools
referred to by the Mercury cakefile. These include scripts in /usr/contrib/bin,
the system modules in /usr/contrib/lib/mercury/modules, the system header
files in /usr/contrib/lib/mercury/inc, and two libraries, lib{fast,debug}mer.a
in each of /usr/contrib/lib/mercury/{sun4,sgi}.
1994-07-12 10:41:11 +00:00
Thomas Conway
f9b36a2274 A primitive io library (with a bit of require).
io.mod:
	A primitive io library (with a bit of require).
1994-07-05 04:56:25 +00:00