RPA Toolkit
Added RJS to the project. Reduced the size of the rparecord_t.
[rpatk.git] / rpa2 / rparecord.h
1 #ifndef _RPARECORD_H_
2 #define _RPARECORD_H_
3
4 #include "rtypes.h"
5 #include "rarray.h"
6 #include "rlist.h"
7 #include "rpavm.h"
8
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 #define RPA_RECORD_NONE (0)
15 #define RPA_RECORD_START (1 << 0)
16 #define RPA_RECORD_END (1 << 1)
17 #define RPA_RECORD_MATCH (1 << 2)
18 #define RPA_RECORD_HEAD (1 << 3)
19 #define RPA_RECORD_TAIL (1 << 4)
20
21 #define RPA_RECORD_INVALID_UID ((ruint32)-1)
22
23 typedef struct rparecord_s {
24         rlong next;
25         const rchar *rule;
26         const rchar *input;
27         rsize_t inputsiz;
28         ruint32 type;
29         ruint32 top;
30         ruint32 size;
31         ruint32 ruleuid;
32         ruint32 usertype;
33         rword userdata;
34 } rparecord_t;
35
36
37 typedef rlong (*rpa_recordtree_callback)(rarray_t *records, rlong rec, rpointer userdata);
38
39 rlong rpa_recordtree_walk(rarray_t *src, rlong rec, rlong level, rpa_recordtree_callback callaback, rpointer userdata);
40 rlong rpa_recordtree_get(rarray_t *records, rlong rec, rulong type);
41 rlong rpa_recordtree_firstchild(rarray_t *records, rlong rec, rulong type);
42 rlong rpa_recordtree_lastchild(rarray_t *records, rlong rec, rulong type);
43 rlong rpa_recordtree_next(rarray_t *records, rlong rec, rulong type);
44 rlong rpa_recordtree_prev(rarray_t *records, rlong rec, rulong type);
45 rlong rpa_recordtree_parent(rarray_t *records, rlong rec, rulong type);
46 rlong rpa_recordtree_rotatedown(rarray_t *records, rlong parent);                       /* Rotate children down, the last child becomes the first */
47 rlong rpa_recordtree_size(rarray_t *records, rlong rec);                                        /* Size of the tree */
48 rlong rpa_recordtree_copy(rarray_t *dst, rarray_t *src, rlong rec);
49 rparecord_t *rpa_record_get(rarray_t *records, rlong rec);
50
51 void rpa_record_dumpindented(rarray_t *records, rlong rec, rint level);
52 void rpa_record_dump(rarray_t *records, rlong rec);
53 void rpa_record_setusertype(rarray_t *records, rlong rec, ruint32 usertype, rvalset_t op);
54 rlong rpa_record_getusertype(rarray_t *records, rlong rec);
55 rint rpa_record_optchar(rparecord_t *prec, rint defc);
56 rint rpa_record_loopchar(rparecord_t *prec, rint defc);
57 #ifdef __cplusplus
58 }
59 #endif
60
61 #endif