diff options
author | Stef Walter <stef@thewalter.net> | 2003-09-20 07:12:49 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2003-09-20 07:12:49 +0000 |
commit | b49d8ebefe9b10c53a6a09ad564e22111b7b25c6 (patch) | |
tree | 1d5dd4abc38170a7bc106dabbc59b915017222f0 /lib/priv.h | |
parent | 1cda9ebbd62916c7c2136722597a86c583e1ecf6 (diff) |
Initial Import
Diffstat (limited to 'lib/priv.h')
-rw-r--r-- | lib/priv.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/lib/priv.h b/lib/priv.h new file mode 100644 index 0000000..dce25fe --- /dev/null +++ b/lib/priv.h @@ -0,0 +1,95 @@ +/* + * 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__ + +#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); + +static const char* kValidIdentifier = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"; + + +#define USE_STACK_VARS + +#endif /* __PRIV_H__ */ |