whenjobs initial version.
[whenjobs.git] / lib / whenfile.mli
diff --git a/lib/whenfile.mli b/lib/whenfile.mli
new file mode 100644 (file)
index 0000000..345c758
--- /dev/null
@@ -0,0 +1,50 @@
+(* whenjobs
+ * Copyright (C) 2012 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+(** This module is used when compiling whenjobs input files. *)
+
+val init : unit -> unit
+(** "Initialize" the module.  Clear the list of jobs and other
+    internal variables so we are ready to parse a new file. *)
+
+val get_jobs : unit -> Whenutils.job list
+(** Get the jobs added since {!init} was called. *)
+
+val add_when_job : Camlp4.PreCast.Loc.t -> string -> Camlp4.PreCast.Ast.expr -> Whenutils.shell_script -> unit
+(** When a 'when' macro appears as a toplevel statement in an
+    input file, it causes this function to be called.
+
+    [loc] is the location in the input file.
+
+    [name] is the name of the job.
+
+    [expr] is the expression, as an OCaml abstract syntax tree.
+
+    [sh] is the shell script fragment (basically location + a big string). *)
+
+val add_every_job : Camlp4.PreCast.Loc.t -> string -> Whenutils.periodexpr -> Whenutils.shell_script -> unit
+(** When an 'every' macro appears as a toplevel statement in an
+    input file, it causes this function to be called.
+
+    [loc] is the location in the input file.
+
+    [name] is the name of the job.
+
+    [periodexpr] is the period, eg. 30 seconds.
+
+    [sh] is the shell script fragment. *)