From: Jérémie D. <Ba...@us...> - 2011-05-28 08:52:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 5df552366b95a2043d03913e69553e04cf78bb3f (commit) from 680647577e28cc060a5c859db28d900d1d4305b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5df552366b95a2043d03913e69553e04cf78bb3f Author: Jérémie Dimino <je...@di...> Date: Sat May 28 10:44:33 2011 +0200 [info] use oasis 0.2.1 ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/_tags b/info/control2011/_tags index 20c227a..bd0db84 100644 --- a/info/control2011/_tags +++ b/info/control2011/_tags @@ -2,10 +2,22 @@ <src/interfaces/*.ml>: -syntax_camlp4o # OASIS_START -# DO NOT EDIT (digest: 1d3ff08546f26990d32be2616f7495bc) +# DO NOT EDIT (digest: 52f8c36639e5a9f5ad9d72f069f8491a) +# Ignore VCS directories, you can use the same kind of rule outside +# OASIS_START/STOP if you want to exclude directories that contains +# useless stuff for the build process +<**/.svn>: -traverse +<**/.svn>: not_hygienic +".bzr": -traverse +".bzr": not_hygienic +".hg": -traverse +".hg": not_hygienic +".git": -traverse +".git": not_hygienic +"_darcs": -traverse +"_darcs": not_hygienic # Library krobot "src/lib": include -"src/lib/krobot.cmxs": use_krobot <src/lib/krobot.{cma,cmxa}>: use_libkrobot <src/lib/*.ml{,i}>: pkg_lwt.unix <src/lib/*.ml{,i}>: pkg_lwt.syntax @@ -15,7 +27,6 @@ "src/lib/krobot_message_stubs.c": pkg_lwt.react # Library krobot-can "src/can": include -"src/can/krobot-can.cmxs": use_krobot-can <src/can/krobot-can.{cma,cmxa}>: use_libkrobot-can <src/can/*.ml{,i}>: use_krobot <src/can/*.ml{,i}>: pkg_lwt.unix @@ -25,27 +36,29 @@ "src/can/can_stubs.c": pkg_lwt.unix "src/can/can_stubs.c": pkg_lwt.syntax "src/can/can_stubs.c": pkg_lwt.react -# Executable krobot-dump -<src/tools/krobot_dump.{native,byte}>: use_krobot -<src/tools/krobot_dump.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_dump.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_dump.{native,byte}>: pkg_lwt.react -# Executable krobot-dump-encoders -<src/tools/krobot_dump_encoders.{native,byte}>: use_krobot -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.react -# Executable krobot-driver -<src/driver/krobot_driver.{native,byte}>: use_krobot-can -<src/driver/krobot_driver.{native,byte}>: use_krobot -<src/driver/krobot_driver.{native,byte}>: pkg_lwt.unix -<src/driver/krobot_driver.{native,byte}>: pkg_lwt.syntax -<src/driver/krobot_driver.{native,byte}>: pkg_lwt.react -<src/driver/*.ml{,i}>: use_krobot-can -<src/driver/*.ml{,i}>: use_krobot -<src/driver/*.ml{,i}>: pkg_lwt.unix -<src/driver/*.ml{,i}>: pkg_lwt.syntax -<src/driver/*.ml{,i}>: pkg_lwt.react +# Executable dump-can +<examples/dump_can.{native,byte}>: use_krobot-can +<examples/dump_can.{native,byte}>: use_krobot +<examples/dump_can.{native,byte}>: pkg_lwt.unix +<examples/dump_can.{native,byte}>: pkg_lwt.syntax +<examples/dump_can.{native,byte}>: pkg_lwt.react +# Executable krobot-planner +<src/tools/krobot_planner.{native,byte}>: use_krobot +<src/tools/krobot_planner.{native,byte}>: pkg_ocamlgraph +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_planner.{native,byte}>: pkg_lwt.react +<src/tools/*.ml{,i}>: pkg_ocamlgraph +# Executable krobot-record +<src/tools/krobot_record.{native,byte}>: use_krobot +<src/tools/krobot_record.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_record.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_record.{native,byte}>: pkg_lwt.react +# Executable krobot-simulator +<src/tools/krobot_simulator.{native,byte}>: use_krobot +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.react # Executable krobot-viewer <src/tools/krobot_viewer.{native,byte}>: use_krobot <src/tools/krobot_viewer.{native,byte}>: pkg_lwt.unix @@ -74,11 +87,21 @@ <examples/send_can.{native,byte}>: pkg_lwt.unix <examples/send_can.{native,byte}>: pkg_lwt.syntax <examples/send_can.{native,byte}>: pkg_lwt.react +<examples/*.ml{,i}>: use_krobot-can +<examples/*.ml{,i}>: use_krobot +<examples/*.ml{,i}>: pkg_lwt.unix +<examples/*.ml{,i}>: pkg_lwt.syntax +<examples/*.ml{,i}>: pkg_lwt.react # Executable krobot-objects <src/tools/krobot_objects.{native,byte}>: use_krobot <src/tools/krobot_objects.{native,byte}>: pkg_lwt.unix <src/tools/krobot_objects.{native,byte}>: pkg_lwt.syntax <src/tools/krobot_objects.{native,byte}>: pkg_lwt.react +# Executable krobot-replay +<src/tools/krobot_replay.{native,byte}>: use_krobot +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_replay.{native,byte}>: pkg_lwt.react # Executable krobot-kill <src/tools/krobot_kill.{native,byte}>: use_krobot <src/tools/krobot_kill.{native,byte}>: pkg_lwt.unix @@ -91,34 +114,6 @@ <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.react <src/tools/krobot_plot_battery.{native,byte}>: pkg_lwt.glib <src/tools/krobot_plot_battery.{native,byte}>: pkg_cairo.lablgtk2 -# Executable krobot-replay -<src/tools/krobot_replay.{native,byte}>: use_krobot -<src/tools/krobot_replay.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_replay.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_replay.{native,byte}>: pkg_lwt.react -# Executable dump-can -<examples/dump_can.{native,byte}>: use_krobot-can -<examples/dump_can.{native,byte}>: use_krobot -<examples/dump_can.{native,byte}>: pkg_lwt.unix -<examples/dump_can.{native,byte}>: pkg_lwt.syntax -<examples/dump_can.{native,byte}>: pkg_lwt.react -<examples/*.ml{,i}>: use_krobot-can -<examples/*.ml{,i}>: use_krobot -<examples/*.ml{,i}>: pkg_lwt.unix -<examples/*.ml{,i}>: pkg_lwt.syntax -<examples/*.ml{,i}>: pkg_lwt.react -# Executable krobot-planner -<src/tools/krobot_planner.{native,byte}>: use_krobot -<src/tools/krobot_planner.{native,byte}>: pkg_ocamlgraph -<src/tools/krobot_planner.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_planner.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_planner.{native,byte}>: pkg_lwt.react -<src/tools/*.ml{,i}>: pkg_ocamlgraph -# Executable krobot-record -<src/tools/krobot_record.{native,byte}>: use_krobot -<src/tools/krobot_record.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_record.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_record.{native,byte}>: pkg_lwt.react # Executable krobot-plot <src/tools/krobot_plot.{native,byte}>: use_krobot <src/tools/krobot_plot.{native,byte}>: pkg_lwt.unix @@ -128,13 +123,29 @@ <src/tools/krobot_plot.{native,byte}>: pkg_cairo.lablgtk2 <src/tools/*.ml{,i}>: pkg_lwt.glib <src/tools/*.ml{,i}>: pkg_cairo.lablgtk2 -# Executable krobot-simulator -<src/tools/krobot_simulator.{native,byte}>: use_krobot -<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.unix -<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.syntax -<src/tools/krobot_simulator.{native,byte}>: pkg_lwt.react +# Executable krobot-dump +<src/tools/krobot_dump.{native,byte}>: use_krobot +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_dump.{native,byte}>: pkg_lwt.react +# Executable krobot-dump-encoders +<src/tools/krobot_dump_encoders.{native,byte}>: use_krobot +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.unix +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.syntax +<src/tools/krobot_dump_encoders.{native,byte}>: pkg_lwt.react <src/tools/*.ml{,i}>: use_krobot <src/tools/*.ml{,i}>: pkg_lwt.unix <src/tools/*.ml{,i}>: pkg_lwt.syntax <src/tools/*.ml{,i}>: pkg_lwt.react +# Executable krobot-driver +<src/driver/krobot_driver.{native,byte}>: use_krobot-can +<src/driver/krobot_driver.{native,byte}>: use_krobot +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.unix +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.syntax +<src/driver/krobot_driver.{native,byte}>: pkg_lwt.react +<src/driver/*.ml{,i}>: use_krobot-can +<src/driver/*.ml{,i}>: use_krobot +<src/driver/*.ml{,i}>: pkg_lwt.unix +<src/driver/*.ml{,i}>: pkg_lwt.syntax +<src/driver/*.ml{,i}>: pkg_lwt.react # OASIS_STOP diff --git a/info/control2011/configure b/info/control2011/configure index 6719c7c..97ed012 100755 --- a/info/control2011/configure +++ b/info/control2011/configure @@ -1,8 +1,27 @@ #!/bin/sh # OASIS_START -# DO NOT EDIT (digest: ed33e59fe00e48bc31edf413bbc8b8d6) +# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7) set -e -ocaml setup.ml -configure $* +FST=true +for i in "$@"; do + if $FST; then + set -- + FST=false + fi + + case $i in + --*=*) + ARG=${i%%=*} + VAL=${i##*=} + set -- "$@" "$ARG" "$VAL" + ;; + *) + set -- "$@" "$i" + ;; + esac +done + +ocaml setup.ml -configure "$@" # OASIS_STOP diff --git a/info/control2011/myocamlbuild.ml b/info/control2011/myocamlbuild.ml index 73d0550..5fd4717 100644 --- a/info/control2011/myocamlbuild.ml +++ b/info/control2011/myocamlbuild.ml @@ -1,12 +1,12 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 6313720c4a9fa3712417ffee35de107d) *) +(* DO NOT EDIT (digest: d2e269dc4718223067ec6884e511c44b) *) module OASISGettext = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISGettext.ml" - let ns_ str = + let ns_ str = str - let s_ str = + let s_ str = str let f_ (str : ('a, 'b, 'c, 'd) format4) = @@ -18,13 +18,13 @@ module OASISGettext = struct else fmt2^^"" - let init = + let init = [] end module OASISExpr = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISExpr.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExpr.ml" @@ -46,18 +46,18 @@ module OASISExpr = struct type 'a choices = (t * 'a) list let eval var_get t = - let rec eval' = + let rec eval' = function | EBool b -> b - | ENot e -> + | ENot e -> not (eval' e) | EAnd (e1, e2) -> (eval' e1) && (eval' e2) - | EOr (e1, e2) -> + | EOr (e1, e2) -> (eval' e1) || (eval' e2) | EFlag nm -> @@ -76,19 +76,19 @@ module OASISExpr = struct eval' t let choose ?printer ?name var_get lst = - let rec choose_aux = + let rec choose_aux = function | (cond, vl) :: tl -> - if eval var_get cond then - vl + if eval var_get cond then + vl else choose_aux tl | [] -> - let str_lst = + let str_lst = if lst = [] then s_ "<empty>" else - String.concat + String.concat (s_ ", ") (List.map (fun (cond, vl) -> @@ -97,10 +97,10 @@ module OASISExpr = struct | None -> s_ "<no printer>") lst) in - match name with + match name with | Some nm -> failwith - (Printf.sprintf + (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> @@ -115,14 +115,14 @@ end module BaseEnvLight = struct -# 21 "/home/dim/sources/oasis/src/base/BaseEnvLight.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) type t = string MapString.t let default_filename = - Filename.concat + Filename.concat (Sys.getcwd ()) "setup.data" @@ -138,23 +138,23 @@ module BaseEnvLight = struct let line = ref 1 in - let st_line = + let st_line = Stream.from (fun _ -> try - match Stream.next st with + match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in - let lexer = + let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = - match Stream.npeek 3 lexer with + match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> - Stream.junk lexer; - Stream.junk lexer; + Stream.junk lexer; + Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> @@ -177,8 +177,8 @@ module BaseEnvLight = struct end else begin - failwith - (Printf.sprintf + failwith + (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end @@ -188,23 +188,23 @@ module BaseEnvLight = struct let buff = Buffer.create ((String.length str) * 2) in - Buffer.add_substitute + Buffer.add_substitute buff - (fun var -> - try + (fun var -> + try var_expand (MapString.find var env) with Not_found -> - failwith - (Printf.sprintf + failwith + (Printf.sprintf "No variable %s defined when trying to expand %S." - var + var str)) str; Buffer.contents buff in var_expand (MapString.find name env) - let var_choose lst env = + let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst @@ -212,7 +212,7 @@ end module MyOCamlbuildFindlib = struct -# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild @@ -311,6 +311,7 @@ module MyOCamlbuildFindlib = struct * the "threads" package using the previous plugin. *) flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); + flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]); flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]) @@ -320,7 +321,7 @@ module MyOCamlbuildFindlib = struct end module MyOCamlbuildBase = struct -# 21 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" (** Base functions for writing myocamlbuild.ml @author Sylvain Le Gall @@ -335,7 +336,7 @@ module MyOCamlbuildBase = struct type name = string type tag = string -# 55 "/home/dim/sources/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" +# 55 "/home/dim/sources/oasis-0.2.1~alpha1/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" type t = { diff --git a/info/control2011/setup.ml b/info/control2011/setup.ml index 33d9d54..d186921 100644 --- a/info/control2011/setup.ml +++ b/info/control2011/setup.ml @@ -1,19 +1,19 @@ (* setup.ml generated for the first time by OASIS v0.2.0~alpha1 *) (* OASIS_START *) -(* DO NOT EDIT (digest: b50f9201082ebd643759d008620ee0bf) *) +(* DO NOT EDIT (digest: b415f0d22b968b7ffae162be7c9780ab) *) (* - Regenerated by OASIS v0.2.0 + Regenerated by OASIS v0.2.1~alpha1 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) module OASISGettext = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISGettext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISGettext.ml" - let ns_ str = + let ns_ str = str - let s_ str = + let s_ str = str let f_ (str : ('a, 'b, 'c, 'd) format4) = @@ -25,19 +25,19 @@ module OASISGettext = struct else fmt2^^"" - let init = + let init = [] end module OASISContext = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISContext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISContext.ml" - open OASISGettext + open OASISGettext type level = [ `Debug - | `Info + | `Info | `Warning | `Error] @@ -46,25 +46,21 @@ module OASISContext = struct verbose: bool; debug: bool; ignore_plugins: bool; - printf: level -> string -> unit; + printf: level -> string -> unit; } - let printf lvl str = - let beg = - match lvl with + let printf lvl str = + let beg = + match lvl with | `Error -> s_ "E: " | `Warning -> s_ "W: " | `Info -> s_ "I: " | `Debug -> s_ "D: " in - match lvl with - | `Error -> - prerr_endline (beg^str) - | _ -> - print_endline (beg^str) + prerr_endline (beg^str) let default = - ref + ref { verbose = true; debug = false; @@ -72,8 +68,8 @@ module OASISContext = struct printf = printf; } - let quiet = - {!default with + let quiet = + {!default with verbose = false; debug = false; } @@ -90,7 +86,7 @@ module OASISContext = struct end module OASISUtils = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISUtils.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISUtils.ml" module MapString = Map.Make(String) @@ -103,7 +99,7 @@ module OASISUtils = struct module SetString = Set.Make(String) let set_string_add_list st lst = - List.fold_left + List.fold_left (fun acc e -> SetString.add e acc) st lst @@ -113,15 +109,15 @@ module OASISUtils = struct SetString.empty - let compare_csl s1 s2 = + let compare_csl s1 s2 = String.compare (String.lowercase s1) (String.lowercase s2) - module HashStringCsl = + module HashStringCsl = Hashtbl.Make (struct type t = string - let equal s1 s2 = + let equal s1 s2 = (String.lowercase s1) = (String.lowercase s2) let hash s = @@ -135,16 +131,16 @@ module OASISUtils = struct let rec split_aux acc pos = if pos < str_len then ( - let pos_sep = + let pos_sep = try String.index_from str pos sep with Not_found -> str_len in - let part = - String.sub str pos (pos_sep - pos) + let part = + String.sub str pos (pos_sep - pos) in - let acc = + let acc = part :: acc in if pos_sep >= str_len then @@ -170,14 +166,14 @@ module OASISUtils = struct split_aux [] 0 - let varname_of_string ?(hyphen='_') s = + let varname_of_string ?(hyphen='_') s = if String.length s = 0 then begin - invalid_arg "varname_of_string" + invalid_arg "varname_of_string" end else begin - let buff = + let buff = Buffer.create (String.length s) in (* Start with a _ if digit *) @@ -186,10 +182,10 @@ module OASISUtils = struct String.iter (fun c -> - if ('a' <= c && c <= 'z') - || - ('A' <= c && c <= 'Z') - || + if ('a' <= c && c <= 'z') + || + ('A' <= c && c <= 'Z') + || ('0' <= c && c <= '9') then Buffer.add_char buff c else @@ -199,8 +195,8 @@ module OASISUtils = struct String.lowercase (Buffer.contents buff) end - let varname_concat ?(hyphen='_') p s = - let p = + let varname_concat ?(hyphen='_') p s = + let p = let p_len = String.length p in @@ -209,7 +205,7 @@ module OASISUtils = struct else p in - let s = + let s = let s_len = String.length s in @@ -221,34 +217,21 @@ module OASISUtils = struct Printf.sprintf "%s%c%s" p hyphen s - let is_varname str = + let is_varname str = str = varname_of_string str - let failwithf1 fmt a = - failwith (Printf.sprintf fmt a) - - let failwithf2 fmt a b = - failwith (Printf.sprintf fmt a b) - - let failwithf3 fmt a b c = - failwith (Printf.sprintf fmt a b c) - - let failwithf4 fmt a b c d = - failwith (Printf.sprintf fmt a b c d) - - let failwithf5 fmt a b c d e = - failwith (Printf.sprintf fmt a b c d e) + let failwithf fmt = Printf.ksprintf failwith fmt end module PropList = struct -# 21 "/home/dim/sources/oasis/src/oasis/PropList.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/PropList.ml" open OASISGettext type name = string - exception Not_set of name * string option + exception Not_set of name * string option exception No_printer of name exception Unknown_field of name * name @@ -268,7 +251,7 @@ module PropList = struct module Data = struct - type t = + type t = (name, unit -> unit) Hashtbl.t let create () = @@ -277,10 +260,10 @@ module PropList = struct let clear t = Hashtbl.clear t -# 59 "/home/dim/sources/oasis/src/oasis/PropList.ml" +# 66 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/PropList.ml" end - module Schema = + module Schema = struct type ('ctxt, 'extra) value = @@ -299,43 +282,43 @@ module PropList = struct name_norm: string -> string; } - let create ?(case_insensitive=false) nm = + let create ?(case_insensitive=false) nm = { name = nm; fields = Hashtbl.create 13; order = Queue.create (); - name_norm = - (if case_insensitive then + name_norm = + (if case_insensitive then String.lowercase else fun s -> s); } - let add t nm set get extra help = - let key = + let add t nm set get extra help = + let key = t.name_norm nm in if Hashtbl.mem t.fields key then failwith - (Printf.sprintf + (Printf.sprintf (f_ "Field '%s' is already defined in schema '%s'") nm t.name); - Hashtbl.add - t.fields - key + Hashtbl.add + t.fields + key { - set = set; - get = get; + set = set; + get = get; help = help; extra = extra; }; - Queue.add nm t.order + Queue.add nm t.order let mem t nm = - Hashtbl.mem t.fields nm + Hashtbl.mem t.fields nm - let find t nm = + let find t nm = try Hashtbl.find t.fields (t.name_norm nm) with Not_found -> @@ -345,28 +328,28 @@ module PropList = struct (find t nm).get data let set t data nm ?context x = - (find t nm).set - data - ?context + (find t nm).set + data + ?context x let fold f acc t = - Queue.fold + Queue.fold (fun acc k -> let v = find t k in f acc k v.extra v.help) - acc + acc t.order let iter f t = - fold + fold (fun () -> f) () t - let name t = + let name t = t.name end @@ -383,7 +366,7 @@ module PropList = struct extra: 'extra; } - let new_id = + let new_id = let last_id = ref 0 in @@ -391,20 +374,20 @@ module PropList = struct let create ?schema ?name ?parse ?print ?default ?update ?help extra = (* Default value container *) - let v = - ref None + let v = + ref None in (* If name is not given, create unique one *) - let nm = - match name with + let nm = + match name with | Some s -> s | None -> Printf.sprintf "_anon_%d" (new_id ()) in (* Last chance to get a value: the default *) - let default () = - match default with + let default () = + match default with | Some d -> d | None -> raise (Not_set (nm, Some (s_ "no default value"))) in @@ -412,22 +395,22 @@ module PropList = struct (* Get data *) let get data = (* Get value *) - try + try (Hashtbl.find data nm) (); - match !v with - | Some x -> x + match !v with + | Some x -> x | None -> default () with Not_found -> default () in (* Set data *) - let set data ?context x = - let x = - match update with + let set data ?context x = + let x = + match update with | Some f -> begin - try + try f ?context (get data) x with Not_set _ -> x @@ -435,21 +418,21 @@ module PropList = struct | None -> x in - Hashtbl.replace - data - nm - (fun () -> v := Some x) + Hashtbl.replace + data + nm + (fun () -> v := Some x) in (* Parse string value, if possible *) let parse = - match parse with - | Some f -> + match parse with + | Some f -> f | None -> fun ?context s -> - failwith - (Printf.sprintf + failwith + (Printf.sprintf (f_ "Cannot parse field '%s' when setting value %S") nm s) @@ -474,8 +457,8 @@ module PropList = struct print (get data) in - begin - match schema with + begin + match schema with | Some t -> Schema.add t nm sets gets extra help | None -> @@ -491,7 +474,7 @@ module PropList = struct extra = extra; } - let fset data t ?context x = + let fset data t ?context x = t.set data ?context x let fget data t = @@ -501,7 +484,7 @@ module PropList = struct t.sets data ?context s let fgets data t = - t.gets data + t.gets data end @@ -509,7 +492,7 @@ module PropList = struct struct let create ?schema ?name ?parse ?print ?default ?update ?help extra = - let fld = + let fld = Field.create ?schema ?name ?parse ?print ?default ?update ?help extra in fun data -> Field.fget data fld @@ -518,20 +501,20 @@ module PropList = struct end module OASISMessage = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISMessage.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISMessage.ml" open OASISGettext open OASISContext let generic_message ~ctxt lvl fmt = - let cond = - match lvl with + let cond = + match lvl with | `Debug -> ctxt.debug | _ -> ctxt.verbose in - Printf.ksprintf - (fun str -> + Printf.ksprintf + (fun str -> if cond then begin ctxt.printf lvl str @@ -541,7 +524,7 @@ module OASISMessage = struct let debug ~ctxt fmt = generic_message ~ctxt `Debug fmt - let info ~ctxt fmt = + let info ~ctxt fmt = generic_message ~ctxt `Info fmt let warning ~ctxt fmt = @@ -551,10 +534,10 @@ module OASISMessage = struct generic_message ~ctxt `Error fmt - let string_of_exception e = - try + let string_of_exception e = + try PropList.string_of_exception e - with + with | Failure s -> s | e -> @@ -567,7 +550,7 @@ module OASISMessage = struct end module OASISVersion = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISVersion.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISVersion.ml" open OASISGettext @@ -577,7 +560,7 @@ module OASISVersion = struct type t = string - type comparator = + type comparator = | VGreater of t | VGreaterEqual of t | VEqual of t @@ -595,17 +578,17 @@ module OASISVersion = struct ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') let is_special = - function + function | '.' | '+' | '-' | '~' -> true | _ -> false let rec version_compare v1 v2 = if v1 <> "" || v2 <> "" then begin - (* Compare ascii string, using special meaning for version + (* Compare ascii string, using special meaning for version * related char *) - let val_ascii c = + let val_ascii c = if c = '~' then -1 else if is_digit c then 0 else if c = '\000' then 0 @@ -619,16 +602,16 @@ module OASISVersion = struct let p = ref 0 in (** Compare ascii part *) - let compare_vascii () = + let compare_vascii () = let cmp = ref 0 in - while !cmp = 0 && - !p < len1 && !p < len2 && - not (is_digit v1.[!p] && is_digit v2.[!p]) do + while !cmp = 0 && + !p < len1 && !p < len2 && + not (is_digit v1.[!p] && is_digit v2.[!p]) do cmp := (val_ascii v1.[!p]) - (val_ascii v2.[!p]); incr p done; if !cmp = 0 && !p < len1 && !p = len2 then - val_ascii v1.[!p] + val_ascii v1.[!p] else if !cmp = 0 && !p = len1 && !p < len2 then - (val_ascii v2.[!p]) else @@ -636,17 +619,21 @@ module OASISVersion = struct in (** Compare digit part *) - let compare_digit () = + let compare_digit () = let extract_int v p = let start_p = !p in - while !p < String.length v && is_digit v.[!p] do + while !p < String.length v && is_digit v.[!p] do incr p done; - match String.sub v start_p (!p - start_p) with - | "" -> 0, - v - | s -> int_of_string s, - String.sub v !p ((String.length v) - !p) + let substr = + String.sub v !p ((String.length v) - !p) + in + let res = + match String.sub v start_p (!p - start_p) with + | "" -> 0 + | s -> int_of_string s + in + res, substr in let i1, tl1 = extract_int v1 (ref !p) in let i2, tl2 = extract_int v2 (ref !p) in @@ -656,7 +643,7 @@ module OASISVersion = struct match compare_vascii () with | 0 -> begin - match compare_digit () with + match compare_digit () with | 0, tl1, tl2 -> if tl1 <> "" && is_digit tl1.[0] then 1 @@ -677,13 +664,13 @@ module OASISVersion = struct let version_of_string str = - String.iter + String.iter (fun c -> if is_alpha c || is_digit c || is_special c then () else failwith - (Printf.sprintf + (Printf.sprintf (f_ "Char %C is not allowed in version '%s'") c str)) str; @@ -692,10 +679,10 @@ module OASISVersion = struct let string_of_version t = t - let chop t = - try - let pos = - String.rindex t '.' + let chop t = + try + let pos = + String.rindex t '.' in String.sub t 0 pos with Not_found -> @@ -719,25 +706,25 @@ module OASISVersion = struct (comparator_apply v op1) && (comparator_apply v op2) let rec string_of_comparator = - function + function | VGreater v -> "> "^(string_of_version v) | VEqual v -> "= "^(string_of_version v) | VLesser v -> "< "^(string_of_version v) | VGreaterEqual v -> ">= "^(string_of_version v) | VLesserEqual v -> "<= "^(string_of_version v) - | VOr (c1, c2) -> + | VOr (c1, c2) -> (string_of_comparator c1)^" || "^(string_of_comparator c2) - | VAnd (c1, c2) -> + | VAnd (c1, c2) -> (string_of_comparator c1)^" && "^(string_of_comparator c2) let rec varname_of_comparator = - let concat p v = + let concat p v = OASISUtils.varname_concat - p - (OASISUtils.varname_of_string + p + (OASISUtils.varname_of_string (string_of_version v)) in - function + function | VGreater v -> concat "gt" v | VLesser v -> concat "lt" v | VEqual v -> concat "eq" v @@ -751,7 +738,7 @@ module OASISVersion = struct end module OASISLicense = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISLicense.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISLicense.ml" (** License for _oasis fields @author Sylvain Le Gall @@ -763,13 +750,13 @@ module OASISLicense = struct type license_exception = string - type license_version = + type license_version = | Version of OASISVersion.t | VersionOrLater of OASISVersion.t | NoVersion - type license_dep_5 = + type license_dep_5 = { license: license; exceptions: license_exception list; @@ -784,7 +771,7 @@ module OASISLicense = struct end module OASISExpr = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISExpr.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExpr.ml" @@ -806,18 +793,18 @@ module OASISExpr = struct type 'a choices = (t * 'a) list let eval var_get t = - let rec eval' = + let rec eval' = function | EBool b -> b - | ENot e -> + | ENot e -> not (eval' e) | EAnd (e1, e2) -> (eval' e1) && (eval' e2) - | EOr (e1, e2) -> + | EOr (e1, e2) -> (eval' e1) || (eval' e2) | EFlag nm -> @@ -836,19 +823,19 @@ module OASISExpr = struct eval' t let choose ?printer ?name var_get lst = - let rec choose_aux = + let rec choose_aux = function | (cond, vl) :: tl -> - if eval var_get cond then - vl + if eval var_get cond then + vl else choose_aux tl | [] -> - let str_lst = + let str_lst = if lst = [] then s_ "<empty>" else - String.concat + String.concat (s_ ", ") (List.map (fun (cond, vl) -> @@ -857,10 +844,10 @@ module OASISExpr = struct | None -> s_ "<no printer>") lst) in - match name with + match name with | Some nm -> failwith - (Printf.sprintf + (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> @@ -874,7 +861,7 @@ module OASISExpr = struct end module OASISTypes = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISTypes.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTypes.ml" @@ -900,34 +887,34 @@ module OASISTypes = struct | Best - type dependency = + type dependency = | FindlibPackage of findlib_full * OASISVersion.comparator option | InternalLibrary of name type tool = | ExternalTool of name - | InternalExecutable of name + | InternalExecutable of name - type vcs = - | Darcs - | Git - | Svn - | Cvs - | Hg - | Bzr - | Arch + type vcs = + | Darcs + | Git + | Svn + | Cvs + | Hg + | Bzr + | Arch | Monotone | OtherVCS of url - type plugin_kind = - [ `Configure - | `Build - | `Doc - | `Test - | `Install + type plugin_kind = + [ `Configure + | `Build + | `Doc + | `Test + | `Install | `Extra ] @@ -947,18 +934,18 @@ module OASISTypes = struct type 'a plugin = 'a * name * OASISVersion.t option - type all_plugin = plugin_kind plugin + type all_plugin = plugin_kind plugin type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list -# 102 "/home/dim/sources/oasis/src/oasis/OASISTypes.ml" +# 102 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTypes.ml" type 'a conditional = 'a OASISExpr.choices - type custom = + type custom = { pre_command: (command_line option) conditional; - post_command: (command_line option) conditional; + post_command: (command_line option) conditional; } @@ -989,7 +976,7 @@ module OASISTypes = struct } - type library = + type library = { lib_modules: string list; lib_internal_modules: string list; @@ -998,19 +985,19 @@ module OASISTypes = struct lib_findlib_containers: findlib_name list; } - type executable = + type executable = { exec_custom: bool; exec_main_is: unix_filename; } - type flag = + type flag = { flag_description: string option; flag_default: bool conditional; } - type source_repository = + type source_repository = { src_repo_type: vcs; src_repo_location: url; @@ -1021,7 +1008,7 @@ module OASISTypes = struct src_repo_subdir: unix_filename option; } - type test = + type test = { test_type: [`Test] plugin; test_command: command_line conditional; @@ -1065,6 +1052,9 @@ module OASISTypes = struct | Doc of common_section * doc + type section_kind = + [ `Library | `Executable | `Flag | `SrcRepo | `Test | `Doc ] + type package = { oasis_version: OASISVersion.t; @@ -1105,7 +1095,7 @@ module OASISTypes = struct end module OASISUnixPath = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISUnixPath.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISUnixPath.ml" type unix_filename = string type unix_dirname = string @@ -1117,7 +1107,7 @@ module OASISUnixPath = struct let parent_dir_name = ".." - let concat f1 f2 = + let concat f1 f2 = if f1 = current_dir_name then f2 else if f2 = current_dir_name then @@ -1142,7 +1132,7 @@ module OASISUnixPath = struct current_dir_name let basename f = - try + try let pos_start = (String.rindex f '/') + 1 in @@ -1151,14 +1141,14 @@ module OASISUnixPath = struct f let chop_extension f = - try + try let last_dot = String.rindex f '.' in let sub = String.sub f 0 last_dot in - try + try let last_slash = String.rindex f '/' in @@ -1184,44 +1174,36 @@ module OASISUnixPath = struct end module OASISSection = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISSection.ml" - - (** Manipulate section - @author Sylvain Le Gall - *) - +# 1 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISSection.ml" open OASISTypes - type section_kind = - | KLibrary - | KExecutable - | KFlag - | KSrcRepo - | KTest - | KDoc - - (** Extract generic information - *) let section_kind_common = function | Library (cs, _, _) -> - KLibrary, cs + `Library, cs | Executable (cs, _, _) -> - KExecutable, cs + `Executable, cs | Flag (cs, _) -> - KFlag, cs + `Flag, cs | SrcRepo (cs, _) -> - KSrcRepo, cs + `SrcRepo, cs | Test (cs, _) -> - KTest, cs + `Test, cs | Doc (cs, _) -> - KDoc, cs + `Doc, cs - (** Common section of a section - *) let section_common sct = snd (section_kind_common sct) + let section_common_set cs = + function + | Library (_, bs, lib) -> Library (cs, bs, lib) + | Executable (_, bs, exec) -> Executable (cs, bs, exec) + | Flag (_, flg) -> Flag (cs, flg) + | SrcRepo (_, src_repo) -> SrcRepo (cs, src_repo) + | Test (_, tst) -> Test (cs, tst) + | Doc (_, doc) -> Doc (cs, doc) + (** Key used to identify section *) let section_id sct = @@ -1235,23 +1217,23 @@ module OASISSection = struct section_id sct in (match k with - | KLibrary -> "library" - | KExecutable -> "executable" - | KFlag -> "flag" - | KSrcRepo -> "src repository" - | KTest -> "test" - | KDoc -> "doc") + | `Library -> "library" + | `Executable -> "executable" + | `Flag -> "flag" + | `SrcRepo -> "src repository" + | `Test -> "test" + | `Doc -> "doc") ^" "^nm end module OASISBuildSection = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISBuildSection.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISBuildSection.ml" end module OASISExecutable = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISExecutable.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISExecutable.ml" open OASISTypes @@ -1282,7 +1264,7 @@ module OASISExecutable = struct end module OASISLibrary = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISLibrary.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISLibrary.ml" open OASISTypes open OASISUtils @@ -1290,20 +1272,20 @@ module OASISLibrary = struct type library_name = name - let generated_unix_files ~ctxt (cs, bs, lib) - source_file_exists is_native ext_lib ext_dll = + let generated_unix_files ~ctxt (cs, bs, lib) + source_file_exists is_native ext_lib ext_dll = (* The headers that should be compiled along *) - let headers = + let headers = List.fold_left (fun hdrs modul -> - try - let base_fn = + try + let base_fn = List.find - (fun fn -> + (fun fn -> source_file_exists (fn^".ml") || source_file_exists (fn^".mli") || source_file_exists (fn^".mll") || - source_file_exists (fn^".mly")) + source_file_exists (fn^".mly")) (List.map (OASISUnixPath.concat bs.bs_path) [modul; @@ -1336,9 +1318,9 @@ module OASISLibrary = struct [cs.cs_name^".cma"] :: acc in let native acc = - [cs.cs_name^".cmxs"] :: [cs.cs_name^".cmxa"] :: [cs.cs_name^(ext_lib ())] :: acc + [cs.cs_name^".cmxa"] :: [cs.cs_name^(ext_lib ())] :: acc in - match bs.bs_compiled_object with + match bs.bs_compiled_object with | Native -> byte (native acc_nopath) | Best when is_native () -> @@ -1348,7 +1330,7 @@ module OASISLibrary = struct in (* Add C library to be built *) - let acc_nopath = + let acc_nopath = if bs.bs_c_sources <> [] then begin ["lib"^cs.cs_name^(ext_lib ())] @@ -1370,12 +1352,12 @@ module OASISLibrary = struct headers - type group_t = + type group_t = | Container of findlib_name * (group_t list) - | Package of (findlib_name * + | Package of (findlib_name * common_section * - build_section * - library * + build_section * + library * (group_t list)) let group_libs pkg = @@ -1386,11 +1368,11 @@ module OASISLibrary = struct function | Library (cs, bs, lib) -> begin - match lib.lib_findlib_parent with + match lib.lib_findlib_parent with | Some p_nm -> begin let children = - try + try MapString.find p_nm mp with Not_found -> [] @@ -1408,7 +1390,7 @@ module OASISLibrary = struct (* Compute findlib name of a single node *) let findlib_name (cs, _, lib) = - match lib.lib_findlib_name with + match lib.lib_findlib_name with | Some nm -> nm | None -> cs.cs_name in @@ -1421,10 +1403,10 @@ module OASISLibrary = struct | [] -> Package (findlib_name acc, cs, bs, lib, - (try - List.rev_map + (try + List.rev_map (fun ((_, _, child_lib) as child_acc) -> - tree_of_library + tree_of_library child_lib.lib_findlib_containers child_acc) (MapString.find cs.cs_name children) @@ -1477,7 +1459,7 @@ module OASISLibrary = struct (** Compute internal to findlib library matchings, including subpackage and return a map of it. *) - let findlib_name_map pkg = + let findlib_name_map pkg = (* Compute names in a tree *) let rec findlib_names_aux path mp grp = @@ -1485,7 +1467,7 @@ module OASISLibrary = struct match grp with | Container (fndlb_nm, children) -> fndlb_nm, children, mp - + | Package (fndlb_nm, {cs_name = nm}, _, _, children) -> fndlb_nm, children, (MapString.add nm (path, fndlb_nm) mp) in @@ -1508,47 +1490,47 @@ module OASISLibrary = struct let findlib_of_name ?(recurse=false) map nm = - try - let (path, fndlb_nm) = + try + let (path, fndlb_nm) = MapString.find nm map in - match path with + match path with | Some pth when recurse -> pth^"."^fndlb_nm | _ -> fndlb_nm with Not_found -> - failwithf1 + failwithf (f_ "Unable to translate internal library '%s' to findlib name") nm let name_findlib_map pkg = - let mp = + let mp = findlib_name_map pkg in MapString.fold - (fun nm _ acc -> + (fun nm _ acc -> let fndlb_nm_full = - findlib_of_name - ~recurse:true - mp + findlib_of_name + ~recurse:true + mp nm in MapString.add fndlb_nm_full nm acc) mp MapString.empty - let findlib_of_group = + let findlib_of_group = function - | Container (fndlb_nm, _) + | Container (fndlb_nm, _) | Package (fndlb_nm, _, _, _, _) -> fndlb_nm let root_of_group grp = let rec root_lib_aux = - function + function | Container (_, children) -> - root_lib_lst children + root_lib_lst children | Package (_, cs, bs, lib, children) -> - if lib.lib_findlib_parent = None then + if lib.lib_findlib_parent = None then cs, bs, lib else root_lib_lst children @@ -1565,7 +1547,7 @@ module OASISLibrary = struct try root_lib_aux grp with Not_found -> - failwithf1 + failwithf (f_ "Unable to determine root library of findlib library '%s'") (findlib_of_group grp) @@ -1573,40 +1555,40 @@ module OASISLibrary = struct end module OASISFlag = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISFlag.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISFlag.ml" end module OASISPackage = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISPackage.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISPackage.ml" end module OASISSourceRepository = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISSourceRepository.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISSourceRepository.ml" end module OASISTest = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISTest.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISTest.ml" end module OASISDocument = struct -# 21 "/home/dim/sources/oasis/src/oasis/OASISDocument.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/oasis/OASISDocument.ml" end module BaseEnvLight = struct -# 21 "/home/dim/sources/oasis/src/base/BaseEnvLight.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) type t = string MapString.t let default_filename = - Filename.concat + Filename.concat (Sys.getcwd ()) "setup.data" @@ -1622,23 +1604,23 @@ module BaseEnvLight = struct let line = ref 1 in - let st_line = + let st_line = Stream.from (fun _ -> try - match Stream.next st with + match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in - let lexer = + let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = - match Stream.npeek 3 lexer with + match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> - Stream.junk lexer; - Stream.junk lexer; + Stream.junk lexer; + Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> @@ -1661,8 +1643,8 @@ module BaseEnvLight = struct end else begin - failwith - (Printf.sprintf + failwith + (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end @@ -1672,23 +1654,23 @@ module BaseEnvLight = struct let buff = Buffer.create ((String.length str) * 2) in - Buffer.add_substitute + Buffer.add_substitute buff - (fun var -> - try + (fun var -> + try var_expand (MapString.find var env) with Not_found -> - failwith - (Printf.sprintf + failwith + (Printf.sprintf "No variable %s defined when trying to expand %S." - var + var str)) str; Buffer.contents buff in var_expand (MapString.find name env) - let var_choose lst env = + let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst @@ -1696,20 +1678,20 @@ end module BaseContext = struct -# 21 "/home/dim/sources/oasis/src/base/BaseContext.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseContext.ml" - open OASISContext + open OASISContext - let args = args + let args = args let default = default end module BaseMessage = struct -# 21 "/home/dim/sources/oasis/src/base/BaseMessage.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseMessage.ml" - (** Message to user, overrid for Base + (** Message to user, overrid for Base @author Sylvain Le Gall *) open OASISMessage @@ -1728,7 +1710,7 @@ module BaseMessage = struct end module BaseFilePath = struct -# 21 "/home/dim/sources/oasis/src/base/BaseFilePath.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseFilePath.ml" open Filename @@ -1736,7 +1718,7 @@ module BaseFilePath = struct module Unix = OASISUnixPath let make = - function + function | [] -> invalid_arg "BaseFilename.make" | hd :: tl -> @@ -1760,16 +1742,15 @@ module BaseFilePath = struct end module BaseEnv = struct -# 21 "/home/dim/sources/oasis/src/base/BaseEnv.ml" +# 21 "/home/dim/sources/oasis-0.2.1~alpha1/src/base/BaseEnv.ml" - open OASISTypes open OASISGettext open OASISUtils open PropList module MapString = BaseEnvLight.MapString - type origin_t = + type origin_t = | ODefault | OGetEnv | OFileLoad @@ -1795,36 +1776,36 @@ module BaseEnv = struct Schema.create "environment" (* Environment data *) - let env = + let env = Data.create () (* Environment data from file *) - let env_from_file = + let env_from_file = ref MapString.empty (* Lexer for var *) - let var_lxr = + let var_lxr = Genlex.make_lexer [] let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in - Buffer.add_substitute + Buffer.add_substitute buff - (fun var -> - try - (* TODO: this is a quick hack to allow calling Test.Command + (fun var -> + try + (* TODO: this is a quick hack to allow calling Test.Command * without defining executable name really. I.e. if there is * an exec Executable toto, then $(toto) should be replace * by its real name. It is however useful to have this function - * for other variable that depend on the host and should be + * for other variable that depend on the host and should be * written better than that. *) let st = var_lxr (Stream.of_string var) in - match Stream.npeek 3 st with + match Stream.npeek 3 st with | [Genlex.Ident "utoh"; Genlex.Ident nm] -> BaseFilePath.of_unix (var_get nm) | [Genlex.Ident "utoh"; Genlex.String s] -> @@ -1836,18 +1817,18 @@ module BaseEnv = struct | [Genlex.Ident nm] -> var_get nm | _ -> - failwithf2 + failwithf (f_ "Unknown expression '%s' in variable expansion of %s.") var str - with + with | Unknown_field (_, _) -> - failwithf2 + failwithf (f_ "No variable %s defined when trying to expand %S.") - var + var str - | Stream.Error e -> - failwithf3 + | Stream.Error e -> + failwithf (f_ "Syntax error when parsing '%s' when trying to \ expand %S: %s") var @@ -1857,12 +1838,12 @@ module BaseEnv = struct Buffer.contents buff and var_get name = - let vl = - try + let vl = + try Schema.get schema env name with Unknown_field _ as e -> begin - try + try MapString.find name !env_from_file with Not_found -> raise e @@ -1871,30 +1852,30 @@ module BaseEnv = struct var_expand vl let var_choose ?printer ?name lst = - OASISExpr.choose + OASISExpr.choose ?printer ?name - var_get + var_get lst - let var_protect vl = - let buff = + let var_protect vl = + let buff = Buffer.create (String.length vl) in String.iter - (function + (function | '$' -> Buffer.add_string buff "\\$" | c -> Buffer.add_char buff c) vl; Buffer.contents buff - let var_define - ?(hide=false) - ?(dump=true) + let var_define + ?(hide=false) + ?(dump=true) ?short_desc ?(cli=CLINone) ?arg_help - ?group + ?group name (* TODO: type constraint on the fact that name must be a valid OCaml id *) dflt = @@ -1907,7 +1888,7 @@ module BaseEnv = struct ] in - let extra = + let extra = { hide = hide; dump = dump; @@ -1917,15 +1898,15 @@ module BaseEnv = struct } in - (* Try to find a value that can be defined + (* Try to find a value that can be defined *) - let var_get_low lst = + let var_get_low lst = let errors, res = List.fold_left (fun (errors, res) (_, v) -> if res = None then begin - try + try errors, Some (Lazy.force v) with | Not_found -> @@ -1940,15 +1921,15 @@ module BaseEnv = struct ([], None) (List.sort (fun (o1, _) (o2, _) -> - if o1 < o2 then + if o1 < o2 then 1 else if o1 = o2 then 0 - else + else -1) lst) in - match res, errors with + match res, errors with | Some v, _ -> v | None, [] -> @@ -1958,12 +1939,12 @@ module BaseEnv = struct in let help = - match short_desc with + match short_desc with | Some fs -> Some fs | None -> None in - let var_get_lst = + let var_get_lst = FieldRO.create ~schema ~name @@ -1978,14 +1959,14 @@ module BaseEnv = struct fun () -> var_expand (var_get_low (var_get_lst env)) - let var_redefine + let var_redefine ?hide ?dump ?short_desc ?cli ?arg_help - ?group - name + ?group + name dflt = if Schema.mem schema name then begin @@ -1994,22 +1975,22 @@ module BaseEnv = struct end else begin - var_define + var_define ?hide ?dump ?short_desc ?cli ?arg_help - ?group - name + ?group + name dflt end - let var_ignore (e : unit -> string) = + let var_ignore (e : unit -> str... [truncated message content] |