1%---------------------------------------------------------------------------% 2% Copyright (C) 2000 Imperial College London. 3% This file may only be copied under the terms of the GNU Library General 4% Public License - see the file COPYING.LIB. 5%---------------------------------------------------------------------------% 6 7% This module implements a few generic Mercury predicates, useful for 8% porting Mercury library modules to ECLiPSe. 9 10:- module(mercury). 11 12:- export 13 error/1, 14 report_lookup_error/3. 15 16error(String) :- 17 writeln(error, String), 18 abort. 19 20report_lookup_error(String, Key, Value) :- 21 writeln(error, String), 22 write(error, "Key: "), writeq(error, Key), nl(error), 23 write(error, "Value: "), writeq(error, Value), nl(error), 24 abort. 25 26:- comment(categories, ["Compatibility"]). 27:- comment(summary, "Mercury compatibility predicates."). 28:- comment(author, "Warwick Harvey"). 29:- comment(desc, html("\ 30 <P> 31 This module provides (a few) Mercury compatibility predicates, 32 useful for when porting Mercury modules to ECLiPSe. 33 </P> 34 ")). 35 36:- comment(error/1, [ 37 amode: error(++), 38 args: ["Message":"A string giving the error message to display"], 39 summary: "Abort, printing an error message.", 40 fail_if: "Never fails.", 41 resat: no, 42 desc: html("\ 43 <P> 44 Corresponds to Mercury's require:error/1 predicate. 45 </P> 46 ") 47]). 48 49:- comment(report_lookup_error/3, [ 50 amode: report_lookup_error(++, ++, ?), 51 args: ["Message":"A string giving the error message to display", 52 "Key":"The key that wasn't found", 53 "Value":"The corresponding value, if supplied"], 54 summary: "Report a lookup error and abort.", 55 fail_if: "Never fails.", 56 resat: no, 57 desc: html("\ 58 <P> 59 Corresponds to Mercury's require:report_lookup_error/3 predicate. 60 </P> 61 ") 62]). 63 64