[m-rev.] for review: adding promise ex declarations to the hlds with error checking

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Feb 21 18:10:40 AEDT 2002


On 20-Feb-2002, Lars Yencken <lljy at students.cs.mu.oz.au> wrote:
> diff -u hlds_data.m hlds_data.m
> --- hlds_data.m
> +++ hlds_data.m
...
>  exclusive_table_add(ExclusiveId, PredId, ExclusiveTable0, ExclusiveTable) :-
>  	(
> -		map__search(ExclusiveTable0, PredId, ExclusiveIds)
> +		multi_map__contains(ExclusiveTable0, PredId)
>  	->
> -		map__det_update(ExclusiveTable0, PredId, 
> -				[ExclusiveId|ExclusiveIds], ExclusiveTable)
> +		multi_map__det_update(ExclusiveTable0, PredId, ExclusiveId, 
> +				ExclusiveTable)
>  	;
> -		map__det_insert(ExclusiveTable0, PredId, [ExclusiveId], 
> +		multi_map__det_insert(ExclusiveTable0, PredId, ExclusiveId, 
>  				ExclusiveTable)
>  	).

Just use `multimap__set'.

> diff -u make_hlds.m make_hlds.m
> --- make_hlds.m
> +++ make_hlds.m
> @@ -8462,8 +8464,8 @@
>  		check_promise_ex_goal(PromiseType, Goal)
>  	; { GoalExpr =  ( _ ; _ ) } ->
>  		{ flatten_to_disj_list(GoalExpr - Context, DisjList) },
> -		{ list__map(flatten_to_cons_list, DisjList, DisjConsList) },
> -		check_list_cons_list(PromiseType, DisjConsList)
> +		{ list__map(flatten_to_conj_list, DisjList, DisjConsList) },
> +		check_disjunction(PromiseType, DisjConsList)

s/DisjConsList/DisjConjList/g

> +check_disjunction(PromiseType, DisjConsList) -->
>  	(
>  		{ DisjConsList = [] }
>  	;
> -		{ DisjConsList = [ConsList|Rest] },
> -		check_cons_list(PromiseType, ConsList, no),
> -		check_list_cons_list(PromiseType, Rest)
> +		{ DisjConsList = [ConsList | Rest] },
> +		check_disj_arm(PromiseType, ConsList, no),
> +		check_disjunction(PromiseType, Rest)
>  	).

Likewise.

>  promise_ex_error(PromiseType, Context, Message) -->
> -	io__set_exit_status(1),
> -	prog_out__write_context(Context),
> -	io__write_string("In " ++ 
> -		prog_out__promise_to_string(PromiseType) ++ " declaration:\n"),
> -	prog_out__write_context(Context),
> -	io__write_string("  error: "),
> -	io__write_string(Message),
> -	io__nl.
> +	{ ErrorPieces = [
> +		words("In"),
> +		fixed("`" ++ prog_out__promise_to_string(PromiseType) ++ "' declaration:"),

That should be

		fixed("`" ++ prog_out__promise_to_string(PromiseType) ++ "'"),
		words("declaration:"),

to allow word wrap there.

Otherwise that looks fine now.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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