/* * 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: */ #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__ */