X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=lib%2Fwhenfile.mli;fp=lib%2Fwhenfile.mli;h=345c75819d1288cb4ef465266f2a8addfeaeff6f;hb=61cad7bbaf63389b520b695eefdd735bc11a8aa6;hp=0000000000000000000000000000000000000000;hpb=21298f7a45ee536800be5e771438b01089a5cb2c;p=whenjobs.git diff --git a/lib/whenfile.mli b/lib/whenfile.mli new file mode 100644 index 0000000..345c758 --- /dev/null +++ b/lib/whenfile.mli @@ -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. *)