From: Richard W.M. Jones Date: Tue, 6 Jun 2017 14:14:46 +0000 (+0100) Subject: Implement Augeas.load API. X-Git-Tag: v0.6~30 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3c2a975fdd1314729c6d7b591344ef1ac80c65a8;p=ocaml-augeas.git Implement Augeas.load API. --- diff --git a/augeas-c.c b/augeas-c.c index 3f5431b..c06bf92 100644 --- a/augeas-c.c +++ b/augeas-c.c @@ -273,3 +273,16 @@ ocaml_augeas_save (value tv) CAMLreturn (Val_unit); } + +/* val load : t -> unit */ +CAMLprim value +ocaml_augeas_load (value tv) +{ + CAMLparam1 (tv); + augeas_t t = Augeas_t_val (tv); + + if (aug_load (t) == -1) + raise_error ("Augeas.load"); + + CAMLreturn (Val_unit); +} diff --git a/augeas.ml b/augeas.ml index fa6c680..f556df0 100644 --- a/augeas.ml +++ b/augeas.ml @@ -52,6 +52,8 @@ external count_matches : t -> path -> int = "ocaml_augeas_count_matches" external save : t -> unit = "ocaml_augeas_save" +external load : t -> unit + = "ocaml_augeas_load" let () = Callback.register_exception "Augeas.Error" (Error "") diff --git a/augeas.mli b/augeas.mli index bada127..64e8240 100644 --- a/augeas.mli +++ b/augeas.mli @@ -90,3 +90,6 @@ val count_matches : t -> path -> int val save : t -> unit (** [save t] saves all pending changes to disk. *) + +val load : t -> unit + (** [load t] loads files into the tree. *)