CAMLreturn (Val_unit);
}
+
+/* val transform : t -> string -> string -> transform_mode -> unit */
+CAMLprim value
+ocaml_augeas_transform (value tv, value lensv, value filev, value modev)
+{
+ CAMLparam4 (tv, lensv, filev, modev);
+ augeas_t t = Augeas_t_val (tv);
+ const char *lens = String_val (lensv);
+ const char *file = String_val (filev);
+ const int excl = Int_val (modev) == 1 ? 1 : 0;
+
+ if (aug_transform (t, lens, file, excl) == -1)
+ raise_error (t, "Augeas.transform");
+
+ CAMLreturn (Val_unit);
+}
| AugErrCpDesc
| AugErrUnknown of int
+type transform_mode =
+ | Include
+ | Exclude
+
exception Error of error_code * string * string * string
type path = string
= "ocaml_augeas_load"
external set : t -> path -> value option -> unit
= "ocaml_augeas_set"
+external transform : t -> string -> string -> transform_mode -> unit
+ = "ocaml_augeas_transform"
let () =
Callback.register_exception "Augeas.Error" (Error (AugErrInternal, "", "", ""))
| AugErrUnknown of int
(** Possible error codes. *)
+type transform_mode =
+ | Include
+ | Exclude
+ (** The operation mode for the {!transform} function. *)
+
exception Error of error_code * string * string * string
(** This exception is thrown when the underlying Augeas library
returns an error. The tuple represents:
val set : t -> path -> value option -> unit
(** [set t path] sets [value] as new value at [path]. *)
+
+val transform : t -> string -> string -> transform_mode -> unit
+ (** [transform t lens file mode] adds or removes (depending on
+ [mode]) the transformation of the specified [lens] for [file]. *)