module R = Helm_registry
module X = HExtlib
-module T = Types
-module G = Grafite
module HG = Http_getter
+module GA = GrafiteAst
+module T = Types
+module G = Grafite
module O = Options
type script = {
remove_lines: int;
excludes: string list;
includes: (string * string) list;
+ iparams: (string * string) list;
coercions: (string * string) list;
files: string list;
requires: (string * string) list;
| "gallina8", _ -> T.Gallina8, ".v", []
| "grafite", "" -> T.Grafite "", ".ma", []
| "grafite", s -> T.Grafite s, ".ma", [s]
- | _ -> failwith "unknown input type"
+ | s, _ -> failwith ("unknown input type: " ^ s)
in
let get_output_type key =
match R.get_string key with
| "procedural" -> T.Procedural
| "declarative" -> T.Declarative
- | _ -> failwith "unknown output type"
+ | s -> failwith ("unknown output type: " ^ s)
in
load_registry registry;
let input_type, input_ext, excludes =
remove_lines = R.get_int "package.heading_lines";
excludes = excludes;
includes = get_pairs "package.include";
+ iparams = get_pairs "package.inline";
coercions = get_pairs "package.coercion";
files = [];
requires = [];
let ext = if script.is_ma then ".ma" else ".mma" in
Filename.concat st.output_path (name ^ ext)
+let get_iparams st name =
+ let map = function
+ | "nodefaults" -> GA.IPNoDefaults
+ | s -> failwith ("unknown inline parameter: " ^ s)
+ in
+ List.map map (X.list_assoc_all name st.iparams)
+
let commit st name =
let i = get_index st name in
let script = st.scripts.(i) in
let in_base_uri = Filename.concat st.input_base_uri name in
let out_base_uri = Filename.concat st.output_base_uri name in
let filter path = function
- | T.Inline (b, k, obj, p, f) ->
+ | T.Inline (b, k, obj, p, f, params) ->
let obj, p =
if b then Filename.concat (make_path path) obj, make_prefix path
else obj, p
in
let s = obj ^ G.string_of_inline_kind k in
- path, Some (T.Inline (b, k, Filename.concat in_base_uri s, p, f))
+ let full_s = Filename.concat in_base_uri s in
+ let params = params @ get_iparams st (Filename.concat name obj) in
+ path, Some (T.Inline (b, k, full_s, p, f, params))
| T.Include s ->
begin
try path, Some (T.Include (List.assoc s st.requires))