for review: additions to getopt.m

Thomas Charles CONWAY conway at cs.mu.oz.au
Thu Jun 19 15:00:43 AEST 1997


Hi

Here are a couple of new predicates for getopt.m

-- 
ZZ:wq!
^X^C
Thomas Conway               				      conway at cs.mu.oz.au
AD DEUM ET VINUM	  			      Every sword has two edges.

library/getopt.m:
	add getopt__lookup_accumulating_option/3 and
	getopt__lookup_maybe_string_option/3.

NEWS:
	mention maybe_string option data and the two new predicates.


cvs diff: Diffing .
Index: NEWS
===================================================================
RCS file: /home/staff/zs/imp/mercury/NEWS,v
retrieving revision 1.53
diff -u -r1.53 NEWS
--- NEWS	1997/06/19 01:55:07	1.53
+++ NEWS	1997/06/19 04:56:50
@@ -192,3 +192,8 @@
     that also do I/O. Also, we've added have list__map_foldl/5, which is an
     amalgam of list__map/3 and list__foldl/4.
 
+  - We've added a new type of option data: maybe_string(maybe(string)). See
+    library/getopt.m for details. Also added to getopt are some missing
+    option-lookup predicates: getopt__lookup_accumulating_option/3 and
+    getopt__lookup_maybe_string_option/3.
+
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing doc
cvs diff: Diffing library
Index: library/getopt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/getopt.m,v
retrieving revision 1.13
diff -u -r1.13 getopt.m
--- getopt.m	1997/06/10 02:55:05	1.13
+++ getopt.m	1997/06/19 04:28:40
@@ -147,6 +147,14 @@
 :- pred getopt__lookup_string_option(option_table(Option), Option, string).
 :- mode getopt__lookup_string_option(in, in, out) is det.
 
+:- pred getopt__lookup_maybe_string_option(option_table(Option), Option,
+		maybe(string)).
+:- mode getopt__lookup_maybe_string_option(in, in, out) is det.
+
+:- pred getopt__lookup_accumulating_option(option_table(Option), Option,
+		list(string)).
+:- mode getopt__lookup_accumulating_option(in, in, out) is det.
+
 %-----------------------------------------------------------------------------%
 
 :- implementation.
@@ -588,6 +596,20 @@
 		Val = Val0
 	;
 		error("Expected string option and didn't get one.")
+	).
+
+getopt__lookup_maybe_string_option(OptionTable, Opt, Val) :-
+	( map__lookup(OptionTable, Opt, maybe_string(Val0)) ->
+		Val = Val0
+	;
+		error("Expected maybe_string option and didn't get one.")
+	).
+
+getopt__lookup_accumulating_option(OptionTable, Opt, Val) :-
+	( map__lookup(OptionTable, Opt, accumulating(Val0)) ->
+		Val = Val0
+	;
+		error("Expected accumulating option and didn't get one.")
 	).
 
 %-----------------------------------------------------------------------------%
cvs diff: Diffing lp_solve
cvs diff: Diffing lp_solve/lp_examples
cvs diff: Diffing profiler
cvs diff: Diffing runtime
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/diff
cvs diff: Diffing scripts
cvs diff: Diffing tools
cvs diff: Diffing trial
cvs diff: Diffing util



More information about the developers mailing list