whenjobs initial version.
[whenjobs.git] / lib / whenfile.mli
1 (* whenjobs
2  * Copyright (C) 2012 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *)
18
19 (** This module is used when compiling whenjobs input files. *)
20
21 val init : unit -> unit
22 (** "Initialize" the module.  Clear the list of jobs and other
23     internal variables so we are ready to parse a new file. *)
24
25 val get_jobs : unit -> Whenutils.job list
26 (** Get the jobs added since {!init} was called. *)
27
28 val add_when_job : Camlp4.PreCast.Loc.t -> string -> Camlp4.PreCast.Ast.expr -> Whenutils.shell_script -> unit
29 (** When a 'when' macro appears as a toplevel statement in an
30     input file, it causes this function to be called.
31
32     [loc] is the location in the input file.
33
34     [name] is the name of the job.
35
36     [expr] is the expression, as an OCaml abstract syntax tree.
37
38     [sh] is the shell script fragment (basically location + a big string). *)
39
40 val add_every_job : Camlp4.PreCast.Loc.t -> string -> Whenutils.periodexpr -> Whenutils.shell_script -> unit
41 (** When an 'every' macro appears as a toplevel statement in an
42     input file, it causes this function to be called.
43
44     [loc] is the location in the input file.
45
46     [name] is the name of the job.
47
48     [periodexpr] is the period, eg. 30 seconds.
49
50     [sh] is the shell script fragment. *)