3
* The program is made up of vmop_t's, one after another. When we support
4
* branching (or user-defined functions) at some time, well do this via
5
* special branch opcodes. They will then contain the actual memory
6
* address of a logical program entry that we shall branch to. Other than
7
* that, all execution is serial - that is one opcode is executed after
8
* the other. This class implements a logical program store, modelled
9
* after real main memory. A linked list of opcodes is used to implement it.
10
* In the future, we may use linked lists of array's to enhance performance,
11
* but for the time being we have taken the simplistic approach (which also
12
* reduces risk of bugs during initial development). The necessary pointers
13
* for this are already implemented in vmop. Though this is not the 100%
14
* correct place, we have opted this time in favor of performance, which
17
* Copyright 2008 Rainer Gerhards and Adiscon GmbH.
19
* This file is part of rsyslog.
21
* Rsyslog is free software: you can redistribute it and/or modify
22
* it under the terms of the GNU General Public License as published by
23
* the Free Software Foundation, either version 3 of the License, or
24
* (at your option) any later version.
26
* Rsyslog is distributed in the hope that it will be useful,
27
* but WITHOUT ANY WARRANTY; without even the implied warranty of
28
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
* GNU General Public License for more details.
31
* You should have received a copy of the GNU General Public License
32
* along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
34
* A copy of the GPL can be found in the file "COPYING" in this distribution.
36
#ifndef INCLUDED_VMPRG_H
37
#define INCLUDED_VMPRG_H
42
/* the vmprg object */
43
typedef struct vmprg_s {
44
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
45
vmop_t *vmopRoot; /* start of program */
46
vmop_t *vmopLast; /* last vmop of program (for adding new ones) */
51
BEGINinterface(vmprg) /* name must also be changed in ENDinterface macro! */
52
INTERFACEObjDebugPrint(vmprg);
53
rsRetVal (*Construct)(vmprg_t **ppThis);
54
rsRetVal (*ConstructFinalize)(vmprg_t __attribute__((unused)) *pThis);
55
rsRetVal (*Destruct)(vmprg_t **ppThis);
56
rsRetVal (*AddOperation)(vmprg_t *pThis, vmop_t *pOp);
57
rsRetVal (*AddVarOperation)(vmprg_t *pThis, opcode_t opcode, var_t *pVar);
59
#define vmprgCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
65
#endif /* #ifndef INCLUDED_VMPRG_H */