X-Git-Url: http://git.annexia.org/?p=whenjobs.git;a=blobdiff_plain;f=lib%2Fwhenfile.mli;h=5ca68d06822b9d06bea4ac20f4c6a36e4e720db9;hp=b754cbccd2aabc683557acdcb636d3c7107d2156;hb=0c9faf57f9239b0fe1c0b46353d222bb4cf5cd74;hpb=76e68068f22a67c788f14a7c9404db7f7514da49 diff --git a/lib/whenfile.mli b/lib/whenfile.mli index b754cbc..5ca68d0 100644 --- a/lib/whenfile.mli +++ b/lib/whenfile.mli @@ -18,14 +18,14 @@ (** 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 init : Whenstate.t -> unit +(** "Initialize" the module. Pass in the initial state, ready for + parsing a new file. *) -val get_jobs : unit -> Whenexpr.job list -(** Get the jobs added since {!init} was called. *) +val get_state : unit -> Whenstate.t +(** Return the updated state. Call this after parsing the file. *) -val add_when_job : Camlp4.PreCast.Loc.t -> string -> Camlp4.PreCast.Ast.expr -> Whenexpr.shell_script -> unit +val add_when_job : Camlp4.PreCast.Loc.t -> string -> Whenexpr.pre option -> Whenexpr.post option -> Camlp4.PreCast.Ast.expr -> Whenexpr.shell_script -> unit (** When a 'when' macro appears as a toplevel statement in an input file, it causes this function to be called. @@ -33,11 +33,13 @@ val add_when_job : Camlp4.PreCast.Loc.t -> string -> Camlp4.PreCast.Ast.expr -> [name] is the name of the job. + [pre] and [post] are the optional pre and post functions. + [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 -> Whenexpr.periodexpr -> Whenexpr.shell_script -> unit +val add_every_job : Camlp4.PreCast.Loc.t -> string -> Whenexpr.pre option -> Whenexpr.post option -> Whenexpr.periodexpr -> Whenexpr.shell_script -> unit (** When an 'every' macro appears as a toplevel statement in an input file, it causes this function to be called. @@ -45,6 +47,11 @@ val add_every_job : Camlp4.PreCast.Loc.t -> string -> Whenexpr.periodexpr -> Whe [name] is the name of the job. + [pre] and [post] are the optional pre and post functions. + [periodexpr] is the period, eg. 30 seconds. [sh] is the shell script fragment. *) + +val set_variable : string -> Whenexpr.variable -> unit +(** Set a variable during file load. *)