@@ -54,34 +54,6 @@ typedef enum JsQueryItemType {
54
54
jqiIn = 'I'
55
55
} JsQueryItemType ;
56
56
57
- typedef struct JsQueryItem JsQueryItem ;
58
-
59
- struct JsQueryItem {
60
- JsQueryItemType type ;
61
- JsQueryItem * next ; /* next in path */
62
-
63
- union {
64
- struct {
65
- JsQueryItem * left ;
66
- JsQueryItem * right ;
67
- } args ;
68
-
69
- JsQueryItem * arg ;
70
-
71
- Numeric numeric ;
72
- bool boolean ;
73
- struct {
74
- uint32 len ;
75
- char * val ; /* could not be not null-terminated */
76
- } string ;
77
-
78
- struct {
79
- int nelems ;
80
- JsQueryItem * * elems ;
81
- } array ;
82
- };
83
- };
84
-
85
57
typedef struct JsQueryItemR {
86
58
JsQueryItemType type ;
87
59
int32 nextPos ;
@@ -121,34 +93,49 @@ extern void jsqIterateInit(JsQueryItemR *v);
121
93
extern bool jsqIterateArray (JsQueryItemR * v , JsQueryItemR * e );
122
94
123
95
/*
124
- * support
96
+ * Parsing
125
97
*/
126
98
127
- extern JsQueryItem * parsejsquery ( const char * str , int len ) ;
99
+ typedef struct JsQueryItem JsQueryItem ;
128
100
129
- int32 readJsQueryHeader (char * base , int32 pos , JsQueryItemType * type , int32 * nextPos );
101
+ struct JsQueryItem {
102
+ JsQueryItemType type ;
103
+ JsQueryItem * next ; /* next in path */
130
104
131
- #define read_byte (v , b , p ) do { \
132
- (v) = *(int8*)((b) + (p)); \
133
- (p) += 1; \
134
- } while(0) \
105
+ union {
106
+ struct {
107
+ JsQueryItem * left ;
108
+ JsQueryItem * right ;
109
+ } args ;
135
110
136
- #define read_int32 (v , b , p ) do { \
137
- (v) = *(int32*)((b) + (p)); \
138
- (p) += sizeof(int32); \
139
- } while(0) \
111
+ JsQueryItem * arg ;
112
+
113
+ Numeric numeric ;
114
+ bool boolean ;
115
+ struct {
116
+ uint32 len ;
117
+ char * val ; /* could not be not null-terminated */
118
+ } string ;
119
+
120
+ struct {
121
+ int nelems ;
122
+ JsQueryItem * * elems ;
123
+ } array ;
124
+ };
125
+ };
126
+
127
+ extern JsQueryItem * parsejsquery (const char * str , int len );
140
128
141
129
void alignStringInfoInt (StringInfo buf );
142
- #endif
143
130
144
131
/* jsquery_extract.c */
145
132
146
133
typedef enum
147
134
{
148
- iAny = 1 ,
149
- iAnyArray ,
150
- iKey ,
151
- iAnyKey
135
+ iAny = jqiAny ,
136
+ iAnyArray = jqiAnyArray ,
137
+ iKey = jqiKey ,
138
+ iAnyKey = jqiAnyKey
152
139
} PathItemType ;
153
140
154
141
typedef struct PathItem PathItem ;
@@ -163,9 +150,9 @@ struct PathItem
163
150
typedef enum
164
151
{
165
152
eScalar = 1 ,
166
- eAnd ,
167
- eOr ,
168
- eNot
153
+ eAnd = jqiAnd ,
154
+ eOr = jqiOr ,
155
+ eNot = jqiNot
169
156
} ExtractedNodeType ;
170
157
171
158
typedef struct ExtractedNode ExtractedNode ;
@@ -199,3 +186,5 @@ typedef int (*MakeEntryHandler)(ExtractedNode *node, Pointer extra);
199
186
ExtractedNode * extractJsQuery (JsQuery * jq , MakeEntryHandler handler , Pointer extra );
200
187
bool execRecursive (ExtractedNode * node , bool * check );
201
188
bool execRecursiveTristate (ExtractedNode * node , GinTernaryValue * check );
189
+
190
+ #endif
0 commit comments