[m-rev.] diff: fix tabling of enums

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Jan 10 16:32:23 AEDT 2005


compiler/table_gen.m:
	Fix a bug in the tabling of enums.

tests/tabling/test_enum.{m,exp}:
	Add a regression test for this fix.

tests/tabling/Mmakefile:
	Enable the new test.

Zoltan.

cvs server: Diffing .
cvs server: Diffing analysis
cvs server: Diffing bindist
cvs server: Diffing boehm_gc
cvs server: Diffing boehm_gc/Mac_files
cvs server: Diffing boehm_gc/cord
cvs server: Diffing boehm_gc/cord/private
cvs server: Diffing boehm_gc/doc
cvs server: Diffing boehm_gc/include
cvs server: Diffing boehm_gc/include/private
cvs server: Diffing boehm_gc/tests
cvs server: Diffing browser
cvs server: Diffing bytecode
cvs server: Diffing compiler
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.71
diff -u -b -r1.71 table_gen.m
--- compiler/table_gen.m	10 Jan 2005 05:23:41 -0000	1.71
+++ compiler/table_gen.m	10 Jan 2005 05:28:08 -0000
@@ -2170,7 +2170,7 @@
 				cur_table_node_name ++ ", " ++
 				int_to_string(EnumRange) ++ ", " ++
 				ArgName ++ ", " ++
-				next_table_node_name ++ ", " ++ ");\n"
+				next_table_node_name ++ ");\n"
 		;
 			error("gen_lookup_call_for_type: unexpected enum type")
 		)
cvs server: Diffing compiler/notes
cvs server: Diffing debian
cvs server: Diffing deep_profiler
cvs server: Diffing deep_profiler/notes
cvs server: Diffing doc
cvs server: Diffing extras
cvs server: Diffing extras/aditi
cvs server: Diffing extras/cgi
cvs server: Diffing extras/complex_numbers
cvs server: Diffing extras/complex_numbers/samples
cvs server: Diffing extras/complex_numbers/tests
cvs server: Diffing extras/concurrency
cvs server: Diffing extras/curs
cvs server: Diffing extras/curs/samples
cvs server: Diffing extras/curses
cvs server: Diffing extras/curses/sample
cvs server: Diffing extras/dynamic_linking
cvs server: Diffing extras/error
cvs server: Diffing extras/graphics
cvs server: Diffing extras/graphics/easyx
cvs server: Diffing extras/graphics/easyx/samples
cvs server: Diffing extras/graphics/mercury_glut
cvs server: Diffing extras/graphics/mercury_opengl
cvs server: Diffing extras/graphics/mercury_tcltk
cvs server: Diffing extras/graphics/samples
cvs server: Diffing extras/graphics/samples/calc
cvs server: Diffing extras/graphics/samples/gears
cvs server: Diffing extras/graphics/samples/maze
cvs server: Diffing extras/graphics/samples/pent
cvs server: Diffing extras/lazy_evaluation
cvs server: Diffing extras/lex
cvs server: Diffing extras/lex/samples
cvs server: Diffing extras/lex/tests
cvs server: Diffing extras/logged_output
cvs server: Diffing extras/moose
cvs server: Diffing extras/moose/samples
cvs server: Diffing extras/moose/tests
cvs server: Diffing extras/morphine
cvs server: Diffing extras/morphine/non-regression-tests
cvs server: Diffing extras/morphine/scripts
cvs server: Diffing extras/morphine/source
cvs server: Diffing extras/odbc
cvs server: Diffing extras/posix
cvs server: Diffing extras/quickcheck
cvs server: Diffing extras/quickcheck/tutes
cvs server: Diffing extras/references
cvs server: Diffing extras/references/samples
cvs server: Diffing extras/references/tests
cvs server: Diffing extras/stream
cvs server: Diffing extras/trailed_update
cvs server: Diffing extras/trailed_update/samples
cvs server: Diffing extras/trailed_update/tests
cvs server: Diffing extras/xml
cvs server: Diffing extras/xml/samples
cvs server: Diffing extras/xml_stylesheets
cvs server: Diffing java
cvs server: Diffing java/runtime
cvs server: Diffing library
cvs server: Diffing profiler
cvs server: Diffing robdd
cvs server: Diffing runtime
cvs server: Diffing runtime/GETOPT
cvs server: Diffing runtime/machdeps
cvs server: Diffing samples
cvs server: Diffing samples/c_interface
cvs server: Diffing samples/c_interface/c_calls_mercury
cvs server: Diffing samples/c_interface/cplusplus_calls_mercury
cvs server: Diffing samples/c_interface/mercury_calls_c
cvs server: Diffing samples/c_interface/mercury_calls_cplusplus
cvs server: Diffing samples/c_interface/mercury_calls_fortran
cvs server: Diffing samples/c_interface/simpler_c_calls_mercury
cvs server: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs server: Diffing samples/diff
cvs server: Diffing samples/muz
cvs server: Diffing samples/rot13
cvs server: Diffing samples/solutions
cvs server: Diffing samples/tests
cvs server: Diffing samples/tests/c_interface
cvs server: Diffing samples/tests/c_interface/c_calls_mercury
cvs server: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs server: Diffing samples/tests/c_interface/mercury_calls_c
cvs server: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs server: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs server: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs server: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs server: Diffing samples/tests/diff
cvs server: Diffing samples/tests/muz
cvs server: Diffing samples/tests/rot13
cvs server: Diffing samples/tests/solutions
cvs server: Diffing samples/tests/toplevel
cvs server: Diffing scripts
cvs server: Diffing tests
cvs server: Diffing tests/benchmarks
cvs server: Diffing tests/debugger
cvs server: Diffing tests/debugger/declarative
cvs server: Diffing tests/dppd
cvs server: Diffing tests/general
cvs server: Diffing tests/general/accumulator
cvs server: Diffing tests/general/string_format
cvs server: Diffing tests/general/structure_reuse
cvs server: Diffing tests/grade_subdirs
cvs server: Diffing tests/hard_coded
cvs server: Diffing tests/hard_coded/exceptions
cvs server: Diffing tests/hard_coded/purity
cvs server: Diffing tests/hard_coded/sub-modules
cvs server: Diffing tests/hard_coded/typeclasses
cvs server: Diffing tests/invalid
cvs server: Diffing tests/invalid/purity
cvs server: Diffing tests/misc_tests
cvs server: Diffing tests/mmc_make
cvs server: Diffing tests/mmc_make/lib
cvs server: Diffing tests/recompilation
cvs server: Diffing tests/tabling
Index: tests/tabling/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/tabling/Mmakefile,v
retrieving revision 1.34
diff -u -b -r1.34 Mmakefile
--- tests/tabling/Mmakefile	20 Jul 2004 04:41:42 -0000	1.34
+++ tests/tabling/Mmakefile	10 Jan 2005 05:28:08 -0000
@@ -19,6 +19,7 @@
 	memo_non \
 	oota \
 	table_foreign_output \
+	test_enum \
 	unused_args
 
 SIMPLE_LOOP_PROGS = \
Index: tests/tabling/test_enum.exp
===================================================================
RCS file: tests/tabling/test_enum.exp
diff -N tests/tabling/test_enum.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/tabling/test_enum.exp	10 Jan 2005 05:28:08 -0000
@@ -0,0 +1,6 @@
+test_exec 110
+start_cond_initial 100: 111
+start_cond_initial 100: 111
+test_exec 220
+start_cond_ord 200: 221
+start_cond_ord 200: 221
Index: tests/tabling/test_enum.m
===================================================================
RCS file: tests/tabling/test_enum.m
diff -N tests/tabling/test_enum.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/tabling/test_enum.m	10 Jan 2005 05:28:08 -0000
@@ -0,0 +1,54 @@
+% A test case to exercise the code for tabling enums.
+
+:- module test_enum.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int, string, list.
+
+:- type start_cond_type
+	--->    start_cond_initial
+	;       start_cond_ord.
+
+main(!IO) :-
+	test(start_cond_initial, 100, !IO),
+	test(start_cond_initial, 100, !IO),
+	test(start_cond_ord, 200, !IO),
+	test(start_cond_ord, 200, !IO).
+
+:- pred test(start_cond_type::in, int::in, io::di, io::uo) is det.
+
+test(Cond, In, !IO) :-
+	Out = get_start_state(Cond, In),
+	io__write(Cond, !IO),
+	io__format(" %d: %d\n", [i(In), i(Out)], !IO).
+
+:- pragma no_inline(get_start_state/2).
+:- pragma memo(get_start_state/2).
+
+:- func get_start_state(start_cond_type, int) = int.
+
+get_start_state(StartCond, Anchor) = State :-
+	(
+		StartCond = start_cond_initial,
+		test_exec(Anchor + 10, State)
+	;
+		StartCond = start_cond_ord,
+		test_exec(Anchor + 20, State)
+	).
+
+:- pred test_exec(int::in, int::out) is det.
+
+:- pragma foreign_proc("C",
+	test_exec(In::in, Out::out),
+	[will_not_call_mercury, promise_pure, thread_safe],
+"
+	printf(""test_exec %d\\n"", In);
+	Out = In + 1;
+").
cvs server: Diffing tests/term
cvs server: Diffing tests/valid
cvs server: Diffing tests/warnings
cvs server: Diffing tools
cvs server: Diffing trace
cvs server: Diffing util
cvs server: Diffing vim
cvs server: Diffing vim/after
cvs server: Diffing vim/ftplugin
cvs server: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list