52 return result; |
52 return result; |
53 } |
53 } |
54 |
54 |
55 // get path string |
55 // get path string |
56 davqlerror_t error; |
56 davqlerror_t error; |
57 UcxBuffer *path = dav_path_string(st->path, ap, &error); |
57 sstr_t path = dav_format_string(sn->mp->allocator, st->path, ap, &error); |
58 |
58 |
59 if(st->type == DAVQL_GET) { |
59 if(st->type == DAVQL_GET) { |
60 dav_exec_get(sn, st, path->space, ap); |
60 dav_exec_get(sn, st, path.ptr, ap); |
61 } else { |
61 } else { |
62 // TODO |
62 // TODO |
63 } |
63 } |
64 |
64 |
65 return result; |
65 return result; |
66 } |
66 } |
67 |
67 |
68 UcxBuffer* dav_path_string(sstr_t pathfmt, va_list ap, davqlerror_t *error) { |
68 sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list ap, davqlerror_t *error) { |
69 UcxBuffer *path = ucx_buffer_new(NULL, 128, UCX_BUFFER_AUTOEXTEND); |
69 UcxBuffer *buf = ucx_buffer_new(NULL, 128, UCX_BUFFER_AUTOEXTEND); |
70 |
70 |
71 int placeholder = 0; |
71 int placeholder = 0; |
72 for(int i=0;i<pathfmt.length;i++) { |
72 for(int i=0;i<fstr.length;i++) { |
73 char c = pathfmt.ptr[i]; |
73 char c = fstr.ptr[i]; |
74 if(placeholder) { |
74 if(placeholder) { |
75 if(c == '%') { |
75 if(c == '%') { |
76 // no placeholder, %% transposes to % |
76 // no placeholder, %% transposes to % |
77 ucx_buffer_putc(path, c); |
77 ucx_buffer_putc(buf, c); |
78 } else { |
78 } else { |
79 // detect placeholder type and insert arg |
79 // detect placeholder type and insert arg |
80 int err = 0; |
80 int err = 0; |
81 switch(c) { |
81 switch(c) { |
82 case 's': { |
82 case 's': { |
83 char *arg = va_arg(ap, char*); |
83 char *arg = va_arg(ap, char*); |
84 ucx_buffer_puts(path, arg); |
84 ucx_buffer_puts(buf, arg); |
85 break; |
85 break; |
86 } |
86 } |
87 case 'd': { |
87 case 'd': { |
88 int arg = va_arg(ap, int); |
88 int arg = va_arg(ap, int); |
89 ucx_bprintf(path, "%d", arg); |
89 ucx_bprintf(buf, "%d", arg); |
90 break; |
90 break; |
91 } |
91 } |
92 case 'u': { |
92 case 'u': { |
93 unsigned int arg = va_arg(ap, unsigned int); |
93 unsigned int arg = va_arg(ap, unsigned int); |
94 ucx_bprintf(path, "%u", arg); |
94 ucx_bprintf(buf, "%u", arg); |
95 break; |
95 break; |
96 } |
96 } |
97 case 't': { |
97 case 't': { |
98 // time arguments doesn't make any sense in a path |
98 // time arguments not supported for strings |
99 *error = DAVQL_UNSUPPORTED_FORMATCHAR; |
|
100 err = 1; |
99 err = 1; |
101 break; |
100 break; |
102 } |
101 } |
103 default: { |
102 default: { |
104 *error = DAVQL_UNKNOWN_FORMATCHAR; |
103 *error = DAVQL_UNKNOWN_FORMATCHAR; |
105 err = 1; |
104 err = 1; |
106 } |
105 } |
107 } |
106 } |
108 if(err) { |
107 if(err) { |
109 ucx_buffer_free(path); |
108 ucx_buffer_free(buf); |
110 return NULL; |
109 sstr_t n; |
|
110 n.ptr = NULL; |
|
111 n.length = 0; |
|
112 return n; |
111 } |
113 } |
112 } |
114 } |
113 placeholder = 0; |
115 placeholder = 0; |
114 } else { |
116 } else { |
115 if(c == '%') { |
117 if(c == '%') { |
116 placeholder = 1; |
118 placeholder = 1; |
117 } else { |
119 } else { |
118 ucx_buffer_putc(path, c); |
120 ucx_buffer_putc(buf, c); |
119 } |
121 } |
120 } |
122 } |
121 } |
123 } |
122 ucx_buffer_putc(path, '\0'); |
|
123 *error = DAVQL_OK; |
124 *error = DAVQL_OK; |
124 return path; |
125 |
|
126 return sstrdup_a(a, sstrn(buf->space, buf->size)); |
125 } |
127 } |
126 |
128 |
127 void dav_exec_get(DavSession *sn, DavQLStatement *st, char* path, va_list ap) { |
129 void dav_exec_get(DavSession *sn, DavQLStatement *st, char* path, va_list ap) { |
128 // execute a davql get statement |
130 // execute a davql get statement |
|
131 UcxMempool *mp = ucx_mempool_new(128); |
129 |
132 |
130 // TODO: get property list |
133 // TODO: get property list |
131 |
134 |
132 UcxBuffer *bcode = dav_compile_lexpr(st->where); |
135 UcxBuffer *bcode = dav_compile_expr(mp->allocator, st->where, ap); |
133 printf("bcode: %.*s\n", bcode->size, bcode->space); |
136 |
|
137 print_bytecode(bcode); |
134 } |
138 } |
135 |
139 |
136 static int count_func_args(DavQLExpression *expr) { |
140 static int count_func_args(DavQLExpression *expr) { |
137 int count = 0; |
141 int count = 0; |
138 DavQLExpression *arg = expr->right; |
142 DavQLExpression *arg = expr->right; |
145 } |
149 } |
146 } |
150 } |
147 return count; |
151 return count; |
148 } |
152 } |
149 |
153 |
150 static int add_cmd(UcxBuffer *bcode, DavQLExpression *expr) { |
154 static int add_cmd(UcxAllocator *a, UcxBuffer *bcode, DavQLExpression *expr, va_list ap) { |
151 if(!expr) { |
155 if(!expr) { |
152 return 0; |
156 return 0; |
153 } |
157 } |
154 |
158 |
155 int numcmd = 1; |
159 int numcmd = 1; |
|
160 DavQLCmd cmd; |
|
161 memset(&cmd, sizeof(DavQLCmd), 0); |
|
162 davqlerror_t error; |
|
163 |
156 sstr_t src = expr->srctext; |
164 sstr_t src = expr->srctext; |
157 switch(expr->type) { |
165 switch(expr->type) { |
158 case DAVQL_NUMBER: { |
166 case DAVQL_NUMBER: { |
159 ucx_bprintf(bcode, "number(%.*s) ", src.length, src.ptr); |
167 cmd.type = DAVQL_CMD_INT; |
|
168 if(src.ptr[0] == '%') { |
|
169 cmd.data.integer = va_arg(ap, int); |
|
170 } else if(util_strtoint(src.ptr, &cmd.data.integer)) { |
|
171 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
|
172 } else { |
|
173 // error |
|
174 return -1; |
|
175 } |
|
176 |
160 break; |
177 break; |
161 } |
178 } |
162 case DAVQL_STRING: { |
179 case DAVQL_STRING: { |
163 // TODO: check format specifier |
180 cmd.type = DAVQL_CMD_STRING; |
164 ucx_bprintf(bcode, "string(%.*s) ", src.length, src.ptr); |
181 cmd.data.string = dav_format_string(a, src, ap, &error); |
|
182 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
165 break; |
183 break; |
166 } |
184 } |
167 case DAVQL_TIMESTAMP: { |
185 case DAVQL_TIMESTAMP: { |
168 ucx_bprintf(bcode, "timestamp(%.*s) ", src.length, src.ptr); |
186 if(src.ptr[0] == '%') { |
|
187 cmd.data.timestamp = va_arg(ap, time_t); |
|
188 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
|
189 } else { |
|
190 // error |
|
191 return -1; |
|
192 } |
169 break; |
193 break; |
170 } |
194 } |
171 case DAVQL_IDENTIFIER: { |
195 case DAVQL_IDENTIFIER: { |
172 // TODO: check identifier type |
196 sstr_t propertyname = sstrchr(src, ':'); |
173 ucx_bprintf(bcode, "identifier(%.*s) ", src.length, src.ptr); |
197 cmd.type = DAVQL_CMD_RES_IDENTIFIER; |
|
198 if(propertyname.length > 0) { |
|
199 cmd.type = DAVQL_CMD_PROP_IDENTIFIER; |
|
200 |
|
201 // TODO |
|
202 } else if(!sstrcmp(src, S("name"))) { |
|
203 cmd.data.resprop = DAVQL_RES_NAME; |
|
204 } else if(!sstrcmp(src, S("path"))) { |
|
205 cmd.data.resprop = DAVQL_RES_PATH; |
|
206 } else if(!sstrcmp(src, S("href"))) { |
|
207 cmd.data.resprop = DAVQL_RES_HREF; |
|
208 } else if(!sstrcmp(src, S("contentlength"))) { |
|
209 cmd.data.resprop = DAVQL_RES_CONTENTLENGTH; |
|
210 } else if(!sstrcmp(src, S("contenttype"))) { |
|
211 cmd.data.resprop = DAVQL_RES_CONTENTTYPE; |
|
212 } else if(!sstrcmp(src, S("creationdate"))) { |
|
213 cmd.data.resprop = DAVQL_RES_CREATIONDATE; |
|
214 } else if(!sstrcmp(src, S("lastmodified"))) { |
|
215 cmd.data.resprop = DAVQL_RES_LASTMODIFIED; |
|
216 } else if(!sstrcmp(src, S("iscollection"))) { |
|
217 cmd.data.resprop = DAVQL_RES_ISCOLLECTION; |
|
218 } |
|
219 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
174 break; |
220 break; |
175 } |
221 } |
176 case DAVQL_UNARY: { |
222 case DAVQL_UNARY: { |
177 numcmd += add_cmd(bcode, expr->left); |
223 numcmd += add_cmd(a, bcode, expr->left, ap); |
178 switch(expr->op) { |
224 switch(expr->op) { |
179 case DAVQL_ADD: { |
225 case DAVQL_ADD: { |
180 ucx_bprintf(bcode, "unop_add "); |
226 cmd.type = DAVQL_CMD_OP_UNARY_ADD; |
181 break; |
227 break; |
182 } |
228 } |
183 case DAVQL_SUB: { |
229 case DAVQL_SUB: { |
184 ucx_bprintf(bcode, "unop_sub "); |
230 cmd.type = DAVQL_CMD_OP_UNARY_SUB; |
185 break; |
231 break; |
186 } |
232 } |
187 case DAVQL_NEG: { |
233 case DAVQL_NEG: { |
188 ucx_bprintf(bcode, "unop_neg "); |
234 cmd.type = DAVQL_CMD_OP_UNARY_NEG; |
189 break; |
235 break; |
190 } |
236 } |
191 } |
237 } |
|
238 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
192 break; |
239 break; |
193 } |
240 } |
194 case DAVQL_BINARY: { |
241 case DAVQL_BINARY: { |
195 numcmd += add_cmd(bcode, expr->left); |
242 numcmd += add_cmd(a, bcode, expr->left, ap); |
196 numcmd += add_cmd(bcode, expr->right); |
243 numcmd += add_cmd(a, bcode, expr->right, ap); |
197 switch(expr->op) { |
244 switch(expr->op) { |
198 case DAVQL_ADD: { |
245 case DAVQL_ADD: { |
199 ucx_bprintf(bcode, "binop_add "); |
246 cmd.type = DAVQL_CMD_OP_BINARY_ADD; |
200 break; |
247 break; |
201 } |
248 } |
202 case DAVQL_SUB: { |
249 case DAVQL_SUB: { |
203 ucx_bprintf(bcode, "binop_sub "); |
250 cmd.type = DAVQL_CMD_OP_BINARY_SUB; |
204 break; |
251 break; |
205 } |
252 } |
206 case DAVQL_MUL: { |
253 case DAVQL_MUL: { |
207 ucx_bprintf(bcode, "binop_sub "); |
254 cmd.type = DAVQL_CMD_OP_BINARY_MUL; |
208 break; |
255 break; |
209 } |
256 } |
210 case DAVQL_DIV: { |
257 case DAVQL_DIV: { |
211 ucx_bprintf(bcode, "binop_sub "); |
258 cmd.type = DAVQL_CMD_OP_BINARY_DIV; |
212 break; |
259 break; |
213 } |
260 } |
214 case DAVQL_AND: { |
261 case DAVQL_AND: { |
215 ucx_bprintf(bcode, "binop_sub "); |
262 cmd.type = DAVQL_CMD_OP_BINARY_AND; |
216 break; |
263 break; |
217 } |
264 } |
218 case DAVQL_OR: { |
265 case DAVQL_OR: { |
219 ucx_bprintf(bcode, "binop_sub "); |
266 cmd.type = DAVQL_CMD_OP_BINARY_OR; |
220 break; |
267 break; |
221 } |
268 } |
222 case DAVQL_XOR: { |
269 case DAVQL_XOR: { |
223 ucx_bprintf(bcode, "binop_sub "); |
270 cmd.type = DAVQL_CMD_OP_BINARY_XOR; |
224 break; |
271 break; |
225 } |
272 } |
226 } |
273 } |
|
274 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
227 break; |
275 break; |
228 } |
276 } |
229 case DAVQL_LOGICAL: { |
277 case DAVQL_LOGICAL: { |
230 if(expr->left && expr->right && expr->op != DAVQL_LOR) { |
278 if(expr->left && expr->right && expr->op != DAVQL_LOR) { |
231 numcmd += add_cmd(bcode, expr->left); |
279 numcmd += add_cmd(a, bcode, expr->left, ap); |
232 numcmd += add_cmd(bcode, expr->right); |
280 numcmd += add_cmd(a, bcode, expr->right, ap); |
233 } |
281 } |
234 |
282 |
235 switch(expr->op) { |
283 switch(expr->op) { |
236 case DAVQL_NOOP: { |
|
237 break; |
|
238 } |
|
239 case DAVQL_NOT: { |
284 case DAVQL_NOT: { |
240 numcmd += add_cmd(bcode, expr->left); |
285 numcmd += add_cmd(a, bcode, expr->left, ap); |
241 ucx_bprintf(bcode, "op_not "); |
286 cmd.type = DAVQL_CMD_OP_LOGICAL_NOT; |
|
287 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
242 break; |
288 break; |
243 } |
289 } |
244 case DAVQL_LAND: { |
290 case DAVQL_LAND: { |
245 ucx_bprintf(bcode, "op_land "); |
291 cmd.type = DAVQL_CMD_OP_LOGICAL_NOT; |
|
292 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
246 break; |
293 break; |
247 } |
294 } |
248 case DAVQL_LOR: { |
295 case DAVQL_LOR: { |
249 int nleft = add_cmd(bcode, expr->left); |
296 int nleft = add_cmd(a, bcode, expr->left, ap); |
250 ucx_bprintf(bcode, "op_lor_left( ) "); |
297 |
251 char *bcode_pos = bcode->space + bcode->size - 6; |
298 cmd.type = DAVQL_CMD_OP_LOGICAL_OR_L; |
252 int nright = add_cmd(bcode, expr->right); |
299 DavQLCmd *or_l = (DavQLCmd*)(bcode->space + bcode->pos); |
253 char buf[5]; |
300 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
254 ssize_t n = snprintf(buf, 4, "%d", nright); |
301 |
255 memcpy(bcode_pos, buf, n); |
302 int nright = add_cmd(a, bcode, expr->right, ap); |
256 ucx_bprintf(bcode, "op_lor "); |
303 or_l->data.integer = nright + 1; |
|
304 |
|
305 cmd.type = DAVQL_CMD_OP_LOGICAL_OR; |
|
306 cmd.data.integer = 0; |
|
307 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
|
308 |
257 numcmd += nleft + nright; |
309 numcmd += nleft + nright; |
258 break; |
310 break; |
259 } |
311 } |
260 case DAVQL_LXOR: { |
312 case DAVQL_LXOR: { |
261 ucx_bprintf(bcode, "op_lxor "); |
313 cmd.type = DAVQL_CMD_OP_LOGICAL_XOR; |
|
314 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
262 break; |
315 break; |
263 } |
316 } |
264 case DAVQL_EQ: { |
317 case DAVQL_EQ: { |
265 ucx_bprintf(bcode, "op_eq "); |
318 cmd.type = DAVQL_CMD_OP_EQ; |
|
319 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
266 break; |
320 break; |
267 } |
321 } |
268 case DAVQL_NEQ: { |
322 case DAVQL_NEQ: { |
269 ucx_bprintf(bcode, "op_neq "); |
323 cmd.type = DAVQL_CMD_OP_NEQ; |
|
324 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
270 break; |
325 break; |
271 } |
326 } |
272 case DAVQL_LT: { |
327 case DAVQL_LT: { |
273 ucx_bprintf(bcode, "op_lt "); |
328 cmd.type = DAVQL_CMD_OP_LT; |
|
329 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
274 break; |
330 break; |
275 } |
331 } |
276 case DAVQL_GT: { |
332 case DAVQL_GT: { |
277 ucx_bprintf(bcode, "op_gt "); |
333 cmd.type = DAVQL_CMD_OP_GT; |
|
334 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
278 break; |
335 break; |
279 } |
336 } |
280 case DAVQL_LE: { |
337 case DAVQL_LE: { |
281 ucx_bprintf(bcode, "op_le "); |
338 cmd.type = DAVQL_CMD_OP_LE; |
|
339 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
282 break; |
340 break; |
283 } |
341 } |
284 case DAVQL_GE: { |
342 case DAVQL_GE: { |
285 ucx_bprintf(bcode, "op_ge "); |
343 cmd.type = DAVQL_CMD_OP_GE; |
|
344 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
286 break; |
345 break; |
287 } |
346 } |
288 case DAVQL_LIKE: { |
347 case DAVQL_LIKE: { |
289 ucx_bprintf(bcode, "op_like "); |
348 cmd.type = DAVQL_CMD_OP_LIKE; |
|
349 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
290 break; |
350 break; |
291 } |
351 } |
292 case DAVQL_UNLIKE: { |
352 case DAVQL_UNLIKE: { |
293 ucx_bprintf(bcode, "op_unlike "); |
353 cmd.type = DAVQL_CMD_OP_UNLIKE; |
|
354 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
294 break; |
355 break; |
295 } |
356 } |
296 } |
357 } |
297 break; |
358 break; |
298 } |
359 } |
299 case DAVQL_FUNCCALL: { |
360 case DAVQL_FUNCCALL: { |
300 switch(expr->op) { |
361 switch(expr->op) { |
301 case DAVQL_CALL: { |
362 case DAVQL_CALL: { |
302 int nright = add_cmd(bcode, expr->right); |
363 int nright = add_cmd(a, bcode, expr->right, ap); |
303 // TODO: count args |
364 // TODO: count args |
304 DavQLExpression *funcid = expr->left; |
365 DavQLExpression *funcid = expr->left; |
305 if(!funcid && funcid->type != DAVQL_IDENTIFIER) { |
366 if(!funcid && funcid->type != DAVQL_IDENTIFIER) { |
306 // fail |
367 // fail |
307 return -1; |
368 return -1; |
308 } |
369 } |
309 |
370 |
310 ucx_bprintf(bcode, "funcname(%.*s) numargs(%d) call ", funcid->srctext.length, funcid->srctext.ptr, count_func_args(expr)); |
371 // numargs |
311 numcmd = 3; |
372 cmd.type = DAVQL_CMD_INT; |
|
373 cmd.data.integer = count_func_args(expr); |
|
374 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
|
375 |
|
376 // TODO: resolve function name |
|
377 cmd.type = DAVQL_CMD_CALL; |
|
378 cmd.data.func = NULL; |
|
379 ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
|
380 |
|
381 numcmd = 2; |
312 numcmd += nright; |
382 numcmd += nright; |
313 break; |
383 break; |
314 } |
384 } |
315 case DAVQL_ARGLIST: { |
385 case DAVQL_ARGLIST: { |
316 numcmd = 0; |
386 numcmd = 0; |
317 numcmd += add_cmd(bcode, expr->left); |
387 numcmd += add_cmd(a, bcode, expr->left, ap); |
318 numcmd += add_cmd(bcode, expr->right); |
388 numcmd += add_cmd(a, bcode, expr->right, ap); |
319 break; |
389 break; |
320 } |
390 } |
321 } |
391 } |
322 break; |
392 break; |
323 } |
393 } |
324 } |
394 } |
325 return numcmd; |
395 return numcmd; |
326 } |
396 } |
327 |
397 |
328 UcxBuffer* dav_compile_lexpr(DavQLExpression *lexpr) { |
398 UcxBuffer* dav_compile_expr(UcxAllocator *a, DavQLExpression *lexpr, va_list ap) { |
329 UcxBuffer *bcode = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); |
399 UcxBuffer *bcode = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); |
330 if(!bcode) { |
400 if(!bcode) { |
331 return NULL; |
401 return NULL; |
332 } |
402 } |
333 |
403 |
334 int numcmd = add_cmd(bcode, lexpr); |
404 if(add_cmd(a, bcode, lexpr, ap) <= 0) { |
|
405 ucx_buffer_free(bcode); |
|
406 return NULL; |
|
407 } |
335 |
408 |
336 return bcode; |
409 return bcode; |
337 } |
410 } |
|
411 |
|
412 |
|
413 void print_bytecode(UcxBuffer *bcode) { |
|
414 bcode->pos = 0; |
|
415 DavQLCmd cmd; |
|
416 while(ucx_buffer_read(&cmd, sizeof(DavQLCmd), 1, bcode) == 1) { |
|
417 switch(cmd.type) { |
|
418 case DAVQL_CMD_INT: { |
|
419 printf("int %ll\n", cmd.data.integer); |
|
420 break; |
|
421 } |
|
422 case DAVQL_CMD_STRING: { |
|
423 printf("string \"%.*s\"\n", cmd.data.string.length, cmd.data.string.ptr); |
|
424 break; |
|
425 } |
|
426 case DAVQL_CMD_TIMESTAMP: { |
|
427 printf("timestamp %d\n", cmd.data.timestamp); |
|
428 break; |
|
429 } |
|
430 case DAVQL_CMD_RES_IDENTIFIER: { |
|
431 char *rid[8] = {"name", "path", "href", "contentlength", "contenttype", "creationdate", "lastmodified", "iscollection"}; |
|
432 printf("resprop %s\n", rid[cmd.data.resprop]); |
|
433 break; |
|
434 } |
|
435 case DAVQL_CMD_PROP_IDENTIFIER: { |
|
436 printf("property %s:%s\n", cmd.data.property.ns, cmd.data.property.name); |
|
437 break; |
|
438 } |
|
439 case DAVQL_CMD_OP_UNARY_ADD: { |
|
440 printf("uadd\n"); |
|
441 break; |
|
442 } |
|
443 case DAVQL_CMD_OP_UNARY_SUB: { |
|
444 printf("usub\n"); |
|
445 break; |
|
446 } |
|
447 case DAVQL_CMD_OP_UNARY_NEG: { |
|
448 printf("uneg\n"); |
|
449 break; |
|
450 } |
|
451 case DAVQL_CMD_OP_BINARY_ADD: { |
|
452 printf("add\n"); |
|
453 break; |
|
454 } |
|
455 case DAVQL_CMD_OP_BINARY_SUB: { |
|
456 printf("sub\n"); |
|
457 break; |
|
458 } |
|
459 case DAVQL_CMD_OP_BINARY_MUL: { |
|
460 printf("mul\n"); |
|
461 break; |
|
462 } |
|
463 case DAVQL_CMD_OP_BINARY_DIV: { |
|
464 printf("div\n"); |
|
465 break; |
|
466 } |
|
467 case DAVQL_CMD_OP_BINARY_AND: { |
|
468 printf("and\n"); |
|
469 break; |
|
470 } |
|
471 case DAVQL_CMD_OP_BINARY_OR: { |
|
472 printf("or\n"); |
|
473 break; |
|
474 } |
|
475 case DAVQL_CMD_OP_BINARY_XOR: { |
|
476 printf("xor\n"); |
|
477 break; |
|
478 } |
|
479 case DAVQL_CMD_OP_LOGICAL_NOT: { |
|
480 printf("not\n"); |
|
481 break; |
|
482 } |
|
483 case DAVQL_CMD_OP_LOGICAL_AND: { |
|
484 printf("land\n"); |
|
485 break; |
|
486 } |
|
487 case DAVQL_CMD_OP_LOGICAL_OR_L: { |
|
488 printf("or_l %d\n", cmd.data.integer); |
|
489 break; |
|
490 } |
|
491 case DAVQL_CMD_OP_LOGICAL_OR: { |
|
492 printf("or\n"); |
|
493 break; |
|
494 } |
|
495 case DAVQL_CMD_OP_LOGICAL_XOR: { |
|
496 printf("lxor\n"); |
|
497 break; |
|
498 } |
|
499 case DAVQL_CMD_OP_EQ: { |
|
500 printf("eq\n"); |
|
501 break; |
|
502 } |
|
503 case DAVQL_CMD_OP_NEQ: { |
|
504 printf("neq\n"); |
|
505 break; |
|
506 } |
|
507 case DAVQL_CMD_OP_LT: { |
|
508 printf("lt\n"); |
|
509 break; |
|
510 } |
|
511 case DAVQL_CMD_OP_GT: { |
|
512 printf("gt\n"); |
|
513 break; |
|
514 } |
|
515 case DAVQL_CMD_OP_LE: { |
|
516 printf("le\n"); |
|
517 break; |
|
518 } |
|
519 case DAVQL_CMD_OP_GE: { |
|
520 printf("ge\n"); |
|
521 break; |
|
522 } |
|
523 case DAVQL_CMD_OP_LIKE: { |
|
524 printf("like\n"); |
|
525 break; |
|
526 } |
|
527 case DAVQL_CMD_OP_UNLIKE: { |
|
528 printf("unlike\n"); |
|
529 break; |
|
530 } |
|
531 case DAVQL_CMD_CALL: { |
|
532 printf("call %x\n", cmd.data.func); |
|
533 break; |
|
534 } |
|
535 } |
|
536 } |
|
537 printf("\n"); |
|
538 } |
|
539 |