RPA Toolkit
8dd9ec3bb4b93957dac8937dfc9c549c365721d3
[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         rlist_t head;
25         rlink_t lnk;
26         rlong next;
27         rword loo;
28         const char *rule;
29         ruint32 ruleid;
30         ruint32 top;
31         ruint32 size;
32         ruint32 type;
33         const char *input;
34         rsize_t inputsiz;
35         ruint32 ruleuid;
36         ruint32 usertype;
37         rword userdata;
38 } rparecord_t;
39
40
41 rlong rpa_recordtree_get(rarray_t *records, rlong rec, rulong type);
42 rlong rpa_recordtree_firstchild(rarray_t *records, rlong rec, rulong type);
43 rlong rpa_recordtree_lastchild(rarray_t *records, rlong rec, rulong type);
44 rlong rpa_recordtree_next(rarray_t *records, rlong rec, rulong type);
45 rlong rpa_recordtree_prev(rarray_t *records, rlong rec, rulong type);
46 rlong rpa_recordtree_parent(rarray_t *records, rlong rec, rulong type);
47 rlong rpa_recordtree_rotatedown(rarray_t *records, rlong parent);                       /* Rotate children down, the last child becomes the first */
48 rlong rpa_recordtree_size(rarray_t *records, rlong rec);                                        /* Size of the tree */
49
50 void rpa_record_dumpindented(rarray_t *records, rlong rec, rint level);
51 void rpa_record_dump(rarray_t *records, rlong rec);
52 void rpa_record_setusertype(rarray_t *records, rlong rec, ruint32 usertype, rvalset_t op);
53 rlong rpa_record_getusertype(rarray_t *records, rlong rec);
54 rint rpa_record_optchar(rparecord_t *prec, rint defc);
55 rint rpa_record_loopchar(rparecord_t *prec, rint defc);
56 #ifdef __cplusplus
57 }
58 #endif
59
60 #endif