[m-rev.] for review: fix problem with mmc --make and .mm grades

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Jan 14 03:37:24 AEDT 2005


Estimated hours taken: 1
Branches: main

Fix a bug that has been causing the following tests to
fail on aral in the .mmsc grades.

	grade_subdirs/hello
	mmc_make/hello
	mmc_make/rebuild

The problem was that the grade string returned by
grade_directory_component/2 would contain not only the
.mmsc component but also the .mm  (which is an alternative
name for it).  This was a problem for mmc --make because it
ended up looking for the library in directory that did not
exist.

compiler/handle_options.m:
	In .mmsc and .dmmsc grades, make sure that the
	grade strings returned by grade_directory_component/2
	do not also contain the components .mm and .dmm.

Julien.

Workspace:/home/earth/juliensf/ws52
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.214
diff -u -r1.214 handle_options.m
--- compiler/handle_options.m	7 Jan 2005 02:31:15 -0000	1.214
+++ compiler/handle_options.m	13 Jan 2005 16:29:44 -0000
@@ -1655,9 +1655,32 @@
 		string__split(Grade0, PicRegIndex, LeftPart, RightPart0),
 		string__append(".picreg", RightPart, RightPart0)
 	->
-		Grade = LeftPart ++ RightPart
+		Grade1 = LeftPart ++ RightPart
 	;
-		Grade = Grade0
+		Grade1 = Grade0
+	),
+	%
+	% Strip out the `.mm' or `.dmm' part of the grade --
+	% `.mm' is implied by `.mmcs' and likewise `.dmm' is
+	% implied by `.dmmcs'.  If we don't do this then the
+	% the resulting grade string will contain both and
+	% we may end up looking for the library in a directory
+	% that doesn't exist.
+	%
+	(
+		string__sub_string_search(Grade0, ".mm", MM_Index),
+		string__split(Grade1, MM_Index, MM_LeftPart, MM_RightPart0),
+		string__append(".mm", MM_RightPart, MM_RightPart0)
+	->
+		Grade = MM_LeftPart ++ MM_RightPart
+	;
+		string__sub_string_search(Grade0, ".dmm", DMM_Index),
+		string__split(Grade1, DMM_Index, DMM_LeftPart, DMM_RightPart0),
+		string__append(".dmm", DMM_RightPart, DMM_RightPart0)
+	->
+		Grade = DMM_LeftPart ++ DMM_RightPart
+	;
+		Grade = Grade1
 	).

 compute_grade(Globals, Grade) :-
@@ -1873,7 +1896,12 @@
 	% Tag reservation components
 grade_component_table("rt", tag, [reserve_tag - bool(yes)], no).

-	% Mimimal model tabling components
+	% Minimal model tabling components
+	%
+	% NOTE: Changes here may need to be reflected in the code for
+	% handling minimal model grade components in the predicate
+	% grade_directory_component/2.
+	%
 grade_component_table("mm", minimal_model,
 	[use_minimal_model_stack_copy - bool(yes),
 	use_minimal_model_own_stacks - bool(no),

--------------------------------------------------------------------------
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