Initialization and termination rules

You can write rules that perform initialization and termination functions for your program using the process-start and process-end rules.

When your program runs, all process-start rules are performed in the order in which they occur in the program, followed by all process rules, in the order in which they occur, followed by all process-end rules. (Naturally, find or markup rules invoked as a result of code in any of the process-start, process, or process-end rules will also fire, as appropriate, in this sequence.)

You can do anything in a process-start or process-end rule that you can do in a process rule, however, as a matter of practice, process-start and process-end rules are intended specifically for initialization and termination code. They are particularly useful in include files where you need to have code in the include file execute before the main program code executes.

OmniMark also supports two other pairs of initialization and termination rules, find-start and find-end, and document-start and document-end. These rules are supported for compatibility with older versions of OmniMark. In new code, you should use process-start and process-end rules for initialization and termination code.

The order of execution of these rules is: