1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* AUTHOR
* N. Nielsen
*
* LICENSE
* This software is in the public domain.
*
* The software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties
* of merchantability, fitness for a particular purpose, and
* noninfringement. In no event shall the author(s) be liable for any
* claim, damages, or other liability, whether in an action of
* contract, tort, or otherwise, arising from, out of, or in connection
* with the software or the use or other dealings in the software.
*
* SUPPORT
* Send bug reports to: <nielsen@memberwebs.com>
*/
#ifndef __PRIV_H__
#define __PRIV_H__
/* Force use of win32 configuration if compiling there */
#ifdef _WIN32
#include "../config.win32.h"
#else
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#endif
#include PCRE_H
#include "execute.h"
/*
WARNING: There are two different sets of positions around.
One set is absolute. This is relative to the beginning of
the document. Relative positions are relative to the beginning
of the current buffer.
- Locks use absolute
- Registers use absolute
- match code uses relative
- Replacements use absolute
*/
#define REL_TO_ABS(v, s) ((v) + (s)->offset)
#define ABS_TO_REL(v, s) ((v) - (s)->offset)
/* Internal state of rlib */
struct internal_state
{
/* Set of replacements to be written out */
replacement* replaces;
/* Set of variables currently set */
variables vars;
/* Set of watermarks for each regex */
memory mem;
/* Data for compiled expressions fastmaps etc... */
data working;
/* Locks */
locks lcks;
/* Total amount read before this point */
size_t offset;
uint vmregs[NUM_REGISTERS];
/* Various options for library */
long options;
/* A translate table for mixed case */
char caseTranslate[256];
};
/* Scripting functions */
int compilerRun(r_script* script, const char* data);
int compilerOptimize(r_script* script);
void scriptSetError(r_script* script, const char* format, ...);
/* Stream management functions */
void opsIterate(vmop_t** ops);
int opsFree(vmop_t* ops, size_t len);
int opsDump(vmop_t* ops, FILE* f);
/* Execution functions */
int vmExecute(r_stream* stream, r_script* script);
bool vmInit(r_stream* stream);
void vmClean(r_stream* stream);
void vmFree(r_stream* stream);
#define kValidIdentifier "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
#define USE_STACK_VARS
#endif /* __PRIV_H__ */
|