mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-10 19:33:11 +00:00
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.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Copyright (C) 1997-1999 The University of Melbourne.
|
||||
# Copyright (C) 1997-2000 The University of Melbourne.
|
||||
# This file may only be copied under the terms of the GNU Library General
|
||||
# Public License - see the file COPYING.LIB in the Mercury distribution.
|
||||
#-----------------------------------------------------------------------------#
|
||||
@@ -21,11 +21,14 @@ depend: global.depend
|
||||
cd tests && mmake $(MMAKEFLAGS) GRADEFLAGS="$(GRADEFLAGS)" depend
|
||||
|
||||
check: libglobal
|
||||
cd samples && mmake $(MMAKEFLAGS) GRADEFLAGS="$(GRADEFLAGS)" check
|
||||
cd tests && mmake $(MMAKEFLAGS) GRADEFLAGS="$(GRADEFLAGS)" check
|
||||
|
||||
install: libglobal.install
|
||||
|
||||
install_check:
|
||||
cd samples && mmake $(MMAKEFLAGS) GRADEFLAGS="$(GRADEFLAGS)" \
|
||||
EXTRA_LIB_DIRS="$(INSTALL_PREFIX)/lib/mercury" check
|
||||
|
||||
clean: clean_subdirs
|
||||
|
||||
.PHONY: clean_subdirs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%-----------------------------------------------------------------------------%
|
||||
% Copyright (C) 1998 University of Melbourne.
|
||||
% Copyright (C) 1998,2000 University of Melbourne.
|
||||
% This file may only be copied under the terms of the GNU General
|
||||
% Public License - see the file COPYING in the Mercury distribution.
|
||||
%-----------------------------------------------------------------------------%
|
||||
@@ -20,38 +20,32 @@
|
||||
:- import_module int.
|
||||
:- import_module reference, nb_reference, scoped_update.
|
||||
|
||||
main -->
|
||||
{ impure new_reference(3,X) },
|
||||
{ impure new_nb_reference(3,Y) },
|
||||
main(IO, IO) :-
|
||||
impure new_reference(3, X),
|
||||
impure new_nb_reference(3, Y),
|
||||
(
|
||||
{ impure update(X, 42) },
|
||||
{ impure update(Y, 42) },
|
||||
{ semipure value(X,V1) },
|
||||
{ semipure value(Y,W1) },
|
||||
print(V1),
|
||||
nl,
|
||||
print(W1),
|
||||
nl,
|
||||
{same(X, X1)},
|
||||
{same(Y, Y1)},
|
||||
{ impure update(X1, 7) },
|
||||
{ impure update(Y1, 7) },
|
||||
{ semipure value(X, V2) },
|
||||
{ semipure value(Y, W2) },
|
||||
print(V2),
|
||||
nl,
|
||||
print(W2),
|
||||
nl,
|
||||
{ impure scope_test }
|
||||
impure update(X, 42),
|
||||
impure update(Y, 42),
|
||||
semipure value(X, V1),
|
||||
semipure value(Y, W1),
|
||||
impure dump_integer(V1),
|
||||
impure dump_integer(W1),
|
||||
same(X, X1),
|
||||
same(Y, Y1),
|
||||
impure update(X1, 7),
|
||||
impure update(Y1, 7),
|
||||
semipure value(X, V2),
|
||||
semipure value(Y, W2),
|
||||
impure dump_integer(V2),
|
||||
impure dump_integer(W2),
|
||||
impure scope_test
|
||||
;
|
||||
{ impure scope_test2 }
|
||||
impure scope_test2
|
||||
;
|
||||
{ semipure value(X, V3) },
|
||||
print(V3),
|
||||
nl,
|
||||
{ semipure value(Y, W3) },
|
||||
print(W3),
|
||||
nl
|
||||
semipure value(X, V3),
|
||||
impure dump_integer(V3),
|
||||
semipure value(Y, W3),
|
||||
impure dump_integer(W3)
|
||||
).
|
||||
|
||||
|
||||
@@ -144,3 +138,10 @@ small_int(3).
|
||||
(int) Old, (int) New);
|
||||
").
|
||||
|
||||
|
||||
:- impure pred dump_integer(int::in) is det.
|
||||
|
||||
:- pragma c_code(dump_integer(X::in), will_not_call_mercury, "
|
||||
printf(""%d\n"", X);
|
||||
").
|
||||
|
||||
|
||||
Reference in New Issue
Block a user