You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Un nouveau constructeur List dans Arg.spec, pour prendre plusieurs arguments
apres
une option ...
arg.mli:
type spec =
| Unit of (unit -> unit) (* Call the function with unit argument )
| Set of bool ref ( Set the reference to true )
| Clear of bool ref ( Set the reference to false )
| String of (string -> unit) ( Call the function with a string argument )
| Int of (int -> unit) ( Call the function with an int argument )
| Float of (float -> unit) ( Call the function with a float argument )
| Rest of (string -> unit) ( Stop interpreting keywords and call the
function with each remaining argument )
| List of spec list ( This argument takes several arguments )
( The concrete type describing the behavior associated
with a keyword. *)
arg.ml:
type spec =
| Unit of (unit -> unit) (* Call the function with unit argument )
| Set of bool ref ( Set the reference to true )
| Clear of bool ref ( Set the reference to false )
| String of (string -> unit) ( Call the function with a string argument )
| Int of (int -> unit) ( Call the function with an int argument )
| Float of (float -> unit) ( Call the function with a float argument )
| Rest of (string -> unit) ( Stop interpreting keywords and call the
function with each remaining argument *)
| List of spec list
let parse speclist anonfun errmsg =
...
let rec iter action =
match action with
| Unit f -> f ();
| Set r -> r := true;
| Clear r -> r := false;
| String f when !current + 1 < l ->
let arg = Sys.argv.(!current+1) in
f arg;
incr current;
| Int f when !current + 1 < l ->
let arg = Sys.argv.(!current+1) in
begin try f (int_of_string arg)
with Failure "int_of_string" -> stop (Wrong (s, arg, "an
int
eger"))
end;
incr current;
| Float f when !current + 1 < l ->
let arg = Sys.argv.(!current+1) in
f (float_of_string arg);
incr current;
| Rest f ->
while !current < l-1 do
f Sys.argv.(!current+1);
incr current;
done;
| List list ->
let rec iter_list list =
match list with
[] -> ()
| action :: tail ->
iter action;
iter_list tail
in
iter_list list
| _ -> stop (Missing s)
in
iter action
The text was updated successfully, but these errors were encountered:
Original bug ID: 124
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: fabrice le fessant
Version: 3.00
OS: linux...
Submission from: cremant.inria.fr (128.93.8.143)
Un nouveau constructeur List dans Arg.spec, pour prendre plusieurs arguments
apres
une option ...
arg.mli:
type spec =
| Unit of (unit -> unit) (* Call the function with unit argument )
| Set of bool ref ( Set the reference to true )
| Clear of bool ref ( Set the reference to false )
| String of (string -> unit) ( Call the function with a string argument )
| Int of (int -> unit) ( Call the function with an int argument )
| Float of (float -> unit) ( Call the function with a float argument )
| Rest of (string -> unit) ( Stop interpreting keywords and call the
function with each remaining argument )
| List of spec list ( This argument takes several arguments )
( The concrete type describing the behavior associated
with a keyword. *)
arg.ml:
type spec =
| Unit of (unit -> unit) (* Call the function with unit argument )
| Set of bool ref ( Set the reference to true )
| Clear of bool ref ( Set the reference to false )
| String of (string -> unit) ( Call the function with a string argument )
| Int of (int -> unit) ( Call the function with an int argument )
| Float of (float -> unit) ( Call the function with a float argument )
| Rest of (string -> unit) ( Stop interpreting keywords and call the
function with each remaining argument *)
| List of spec list
let parse speclist anonfun errmsg =
...
let rec iter action =
match action with
| Unit f -> f ();
| Set r -> r := true;
| Clear r -> r := false;
| String f when !current + 1 < l ->
let arg = Sys.argv.(!current+1) in
f arg;
incr current;
| Int f when !current + 1 < l ->
let arg = Sys.argv.(!current+1) in
begin try f (int_of_string arg)
with Failure "int_of_string" -> stop (Wrong (s, arg, "an
int
eger"))
end;
incr current;
| Float f when !current + 1 < l ->
let arg = Sys.argv.(!current+1) in
f (float_of_string arg);
incr current;
| Rest f ->
while !current < l-1 do
f Sys.argv.(!current+1);
incr current;
done;
| List list ->
let rec iter_list list =
match list with
[] -> ()
| action :: tail ->
iter action;
iter_list tail
in
iter_list list
| _ -> stop (Missing s)
in
iter action
The text was updated successfully, but these errors were encountered: