Skip to content

4.9. Instructions

John edited this page Jun 2, 2018 · 2 revisions

Instructions are a new construct added in ebusd 2.1.0 and allow execution of certain actions while loading a configuration file that can also be used in combination with conditions.

An instruction is separated from a normal configuration line by starting it with an exlamation mark (behind optionally prefixed conditions), for example:

!INSTRUCTION,parameters...

Each instruction may have individual parameters as explained below.

Load and include instructions

The !load and !include instructions both need a single file name as parameter which has to be relative to the configuration file in which the instruction is placed.

The difference between !load and !include is that only the first applicable !load instruction in a configuration file is used (depending on prefixed conditions), whereas there is no limit on !include instructions.

Examples

Here is an example configuration file using instructions:

*[PROD],scan,id,,product
[PROD='0010002315']!load,bai.0010002315.inc
[PROD='0010003958']!load,bai.0010002465.inc
!load,bai.308523.inc
!include,errors.inc
!include,hcmode.inc

In this example, there are two include instruction, which will always be executed, i.e. the files "errors.inc" and "hcmode.inc" will always be included.

From three load instructions only the first applicable one will be used. This is determined by first resolving the conditions, and then checking which of the instructions to pick. If neither the first nor the second condition is true, the last load instruction (without a condition) will be executed instead.

The example is taken from the ebusd-configuration/bai.csv configuration file and it shows how one of the "*.inc" files is picked depending on the product code.