Fri, 05 Jun 2015 10:10:14 +0200
added missing keywords + fixed missing source text for boolean primaries
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2015 Olaf Wintermann. All rights reserved. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include <stdlib.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <string.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include <ucx/utils.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include "davqlexec.h" |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
35 | #include "utils.h" |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
36 | #include "methods.h" |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
37 | #include "session.h" |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
39 | DavResult* dav_statement_exec(DavSession *sn, DavQLStatement *st, ...) { |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | va_list ap; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | va_start(ap, st); |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
42 | DavResult *result = dav_statement_execv(sn, st, ap); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | va_end(ap); |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | return result; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
47 | DavResult* dav_statement_execv(DavSession *sn, DavQLStatement *st, va_list ap) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
48 | DavResult *result = dav_session_malloc(sn, sizeof(DavResult)); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | result->result = NULL; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | result->status = 1; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | // make sure the statement was successfully parsed |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | if(st->type == DAVQL_ERROR) { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | return result; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | // get path string |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | davqlerror_t error; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
59 | sstr_t path = dav_format_string(sn->mp->allocator, st->path, ap, &error); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | |
127
7072a2b4ae35
renamed GET to SELECT in davql syntax
Mike Becker <universe@uap-core.de>
parents:
126
diff
changeset
|
61 | if(st->type == DAVQL_SELECT) { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
62 | *result = dav_exec_select(sn, st, path.ptr, ap); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | } else { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | // TODO |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | return result; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
70 | sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, va_list ap, davqlerror_t *error) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
71 | UcxBuffer *buf = ucx_buffer_new(NULL, 128, UCX_BUFFER_AUTOEXTEND); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | int placeholder = 0; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
74 | for(int i=0;i<fstr.length;i++) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
75 | char c = fstr.ptr[i]; |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | if(placeholder) { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | if(c == '%') { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | // no placeholder, %% transposes to % |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
79 | ucx_buffer_putc(buf, c); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | } else { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | // detect placeholder type and insert arg |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | int err = 0; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | switch(c) { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | case 's': { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | char *arg = va_arg(ap, char*); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
86 | ucx_buffer_puts(buf, arg); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | break; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | case 'd': { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | int arg = va_arg(ap, int); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
91 | ucx_bprintf(buf, "%d", arg); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | break; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | case 'u': { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | unsigned int arg = va_arg(ap, unsigned int); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
96 | ucx_bprintf(buf, "%u", arg); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | break; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | case 't': { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
100 | // time arguments not supported for strings |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | err = 1; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | break; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | default: { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | *error = DAVQL_UNKNOWN_FORMATCHAR; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | err = 1; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | if(err) { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
110 | ucx_buffer_free(buf); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
111 | sstr_t n; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
112 | n.ptr = NULL; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
113 | n.length = 0; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
114 | return n; |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | placeholder = 0; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | } else { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | if(c == '%') { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | placeholder = 1; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | } else { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
122 | ucx_buffer_putc(buf, c); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | *error = DAVQL_OK; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
127 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
128 | return sstrdup_a(a, sstrn(buf->space, buf->size)); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
131 | /* |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
132 | * execute a davql select statement |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
133 | */ |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
134 | DavResult dav_exec_select(DavSession *sn, DavQLStatement *st, char* path, va_list ap) { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
135 | UcxMempool *mp = ucx_mempool_new(128); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | // TODO: get property list |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
138 | UcxBuffer *rqbuf = create_allprop_propfind_request(); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
140 | UcxBuffer *where = dav_compile_expr(sn->context, mp->allocator, st->where, ap); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
141 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
142 | DavResource *selroot = dav_resource_new(sn, path); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
143 | DavResult result; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
144 | result.result = selroot; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
145 | result.status = 0; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
146 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
147 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
148 | UcxList *stack = NULL; // stack with DavResource* elements |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
149 | // initialize the stack with the requested resource |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
150 | DavQLRes *r = ucx_mempool_malloc(mp, sizeof(DavQLRes)); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
151 | r->resource = selroot; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
152 | r->depth = 0; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
153 | stack = ucx_list_prepend(stack, r); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
154 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
155 | // reuseable response buffer |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
156 | UcxBuffer *rpbuf = ucx_buffer_new(NULL, 4096, UCX_BUFFER_AUTOEXTEND); |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
157 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
158 | // do a propfind request for each resource on the stack |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
159 | while(stack) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
160 | DavQLRes *sr = stack->data; // get first element from the stack |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
161 | stack = ucx_list_remove(stack, stack); // remove first element |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
162 | DavResource *root = sr->resource; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
163 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
164 | util_set_url(sn, dav_resource_get_href(sr->resource)); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
165 | CURLcode ret = do_propfind_request(sn->handle, rqbuf, rpbuf); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
166 | int http_status = 0; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
167 | curl_easy_getinfo (sn->handle, CURLINFO_RESPONSE_CODE, &http_status); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
168 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
169 | if(ret == CURLE_OK && http_status == 207) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
170 | // propfind request successful, now parse the response |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
171 | char *url = "http://url/"; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
172 | PropfindParser *parser = create_propfind_parser(rpbuf, url); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
173 | ResponseTag response; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
174 | int r; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
175 | while((r = get_propfind_response(parser, &response)) != 0) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
176 | if(r == -1) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
177 | // error |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
178 | result.status = -1; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
179 | // TODO: free resources |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
180 | break; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
181 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
182 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
183 | // the propfind multistatus response contains responses |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
184 | // for the requsted resource and all childs |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
185 | // determine if the response is a child or not |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
186 | if(hrefeq(sn, root->href, response.href)) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
187 | // response is the currently requested resource |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
188 | // and not a child |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
189 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
190 | // add properties |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
191 | add_properties(root, &response); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
192 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
193 | if(root == selroot) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
194 | // The current root is the root of the select query. |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
195 | // In this case we have to check the where clause. |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
196 | // If root is not selroot, the where clause was |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
197 | // already checked for the resource before it was |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
198 | // added to the stack. |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
199 | DavQLStackObj where_result; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
200 | if(!dav_exec_expr(where, root, &where_result)) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
201 | if(where_result.data.integer != 0) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
202 | continue; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
203 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
204 | } else { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
205 | result.status = -1; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
206 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
207 | dav_resource_free_all(selroot); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
208 | ucx_list_free(stack); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
209 | break; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
210 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
211 | } else { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
212 | DavResource *child = response2resource( |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
213 | sn, |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
214 | &response, |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
215 | root->path); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
216 | // check where clause |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
217 | DavQLStackObj where_result; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
218 | if(!dav_exec_expr(where, child, &where_result)) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
219 | if(where_result.data.integer != 0) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
220 | resource_add_child(root, child); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
221 | if(child->iscollection && |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
222 | (st->depth < 0 || st->depth > sr->depth+1)) |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
223 | { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
224 | DavQLRes *rs = ucx_mempool_malloc( |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
225 | mp, |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
226 | sizeof(DavQLRes)); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
227 | rs->resource = child; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
228 | rs->depth = sr->depth + 1; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
229 | stack = ucx_list_prepend(stack, rs); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
230 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
231 | } else { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
232 | dav_resource_free(child); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
233 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
234 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
235 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
236 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
237 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
238 | } else { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
239 | dav_session_set_error(sn, ret, http_status); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
240 | result.status = -1; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
241 | dav_resource_free_all(selroot); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
242 | break; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
243 | } |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
244 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
245 | // reset response buffer |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
246 | ucx_buffer_seek(rpbuf, SEEK_SET, 0); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
247 | } |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
248 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
249 | ucx_mempool_destroy(mp); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
250 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
251 | result.result = selroot; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
252 | return result; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
253 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
254 | |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
255 | static int count_func_args(DavQLExpression *expr) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
256 | int count = 0; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
257 | DavQLExpression *arg = expr->right; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
258 | while(arg) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
259 | count++; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
260 | if(arg->op == DAVQL_ARGLIST) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
261 | arg = arg->right; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
262 | } else { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
263 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
264 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
265 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
266 | return count; |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
267 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
268 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
269 | static int add_cmd(DavContext *ctx, UcxAllocator *a, UcxBuffer *bcode, DavQLExpression *expr, va_list ap) { |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
270 | if(!expr) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
271 | return 0; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
272 | } |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
273 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
274 | int numcmd = 1; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
275 | DavQLCmd cmd; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
276 | memset(&cmd, sizeof(DavQLCmd), 0); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
277 | davqlerror_t error; |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
278 | |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
279 | sstr_t src = expr->srctext; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
280 | switch(expr->type) { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
281 | case DAVQL_NUMBER: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
282 | cmd.type = DAVQL_CMD_INT; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
283 | if(src.ptr[0] == '%') { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
284 | cmd.data.integer = va_arg(ap, int); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
285 | } else if(util_strtoint(src.ptr, &cmd.data.integer)) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
286 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
287 | } else { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
288 | // error |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
289 | return -1; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
290 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
291 | |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
292 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
293 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
294 | case DAVQL_STRING: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
295 | cmd.type = DAVQL_CMD_STRING; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
296 | cmd.data.string = dav_format_string(a, src, ap, &error); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
297 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
298 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
299 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
300 | case DAVQL_TIMESTAMP: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
301 | if(src.ptr[0] == '%') { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
302 | cmd.data.timestamp = va_arg(ap, time_t); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
303 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
304 | } else { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
305 | // error |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
306 | return -1; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
307 | } |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
308 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
309 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
310 | case DAVQL_IDENTIFIER: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
311 | sstr_t propertyname = sstrchr(src, ':'); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
312 | cmd.type = DAVQL_CMD_RES_IDENTIFIER; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
313 | if(propertyname.length > 0) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
314 | cmd.type = DAVQL_CMD_PROP_IDENTIFIER; |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
315 | char *ns; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
316 | char *name; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
317 | dav_get_property_namespace( |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
318 | ctx, |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
319 | sstrdup_a(a, src).ptr, |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
320 | &ns, |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
321 | &name); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
322 | if(ns && name) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
323 | cmd.data.property.ns = ns; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
324 | cmd.data.property.name = name; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
325 | } else { |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
326 | // error |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
327 | return -1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
328 | } |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
329 | } else if(!sstrcmp(src, S("name"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
330 | cmd.data.resprop = DAVQL_RES_NAME; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
331 | } else if(!sstrcmp(src, S("path"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
332 | cmd.data.resprop = DAVQL_RES_PATH; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
333 | } else if(!sstrcmp(src, S("href"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
334 | cmd.data.resprop = DAVQL_RES_HREF; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
335 | } else if(!sstrcmp(src, S("contentlength"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
336 | cmd.data.resprop = DAVQL_RES_CONTENTLENGTH; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
337 | } else if(!sstrcmp(src, S("contenttype"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
338 | cmd.data.resprop = DAVQL_RES_CONTENTTYPE; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
339 | } else if(!sstrcmp(src, S("creationdate"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
340 | cmd.data.resprop = DAVQL_RES_CREATIONDATE; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
341 | } else if(!sstrcmp(src, S("lastmodified"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
342 | cmd.data.resprop = DAVQL_RES_LASTMODIFIED; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
343 | } else if(!sstrcmp(src, S("iscollection"))) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
344 | cmd.data.resprop = DAVQL_RES_ISCOLLECTION; |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
345 | } else if(!sstrcmp(src, S("true"))) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
346 | cmd.type = DAVQL_CMD_INT; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
347 | cmd.data.integer = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
348 | } else if(!sstrcmp(src, S("false"))) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
349 | cmd.type = DAVQL_CMD_INT; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
350 | cmd.data.integer = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
351 | } else { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
352 | // error, unknown identifier |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
353 | return -1; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
354 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
355 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
356 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
357 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
358 | case DAVQL_UNARY: { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
359 | numcmd += add_cmd(ctx, a, bcode, expr->left, ap); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
360 | switch(expr->op) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
361 | case DAVQL_ADD: { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
362 | // noop |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
363 | numcmd = 0; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
364 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
365 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
366 | case DAVQL_SUB: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
367 | cmd.type = DAVQL_CMD_OP_UNARY_SUB; |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
368 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
369 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
370 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
371 | case DAVQL_NEG: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
372 | cmd.type = DAVQL_CMD_OP_UNARY_NEG; |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
373 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
374 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
375 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
376 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
377 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
378 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
379 | case DAVQL_BINARY: { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
380 | numcmd += add_cmd(ctx, a, bcode, expr->left, ap); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
381 | numcmd += add_cmd(ctx, a, bcode, expr->right, ap); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
382 | switch(expr->op) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
383 | case DAVQL_ADD: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
384 | cmd.type = DAVQL_CMD_OP_BINARY_ADD; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
385 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
386 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
387 | case DAVQL_SUB: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
388 | cmd.type = DAVQL_CMD_OP_BINARY_SUB; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
389 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
390 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
391 | case DAVQL_MUL: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
392 | cmd.type = DAVQL_CMD_OP_BINARY_MUL; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
393 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
394 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
395 | case DAVQL_DIV: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
396 | cmd.type = DAVQL_CMD_OP_BINARY_DIV; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
397 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
398 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
399 | case DAVQL_AND: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
400 | cmd.type = DAVQL_CMD_OP_BINARY_AND; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
401 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
402 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
403 | case DAVQL_OR: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
404 | cmd.type = DAVQL_CMD_OP_BINARY_OR; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
405 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
406 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
407 | case DAVQL_XOR: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
408 | cmd.type = DAVQL_CMD_OP_BINARY_XOR; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
409 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
410 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
411 | } |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
412 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
413 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
414 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
415 | case DAVQL_LOGICAL: { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
416 | if(expr->left && expr->right && expr->op != DAVQL_LOR) { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
417 | numcmd += add_cmd(ctx, a, bcode, expr->left, ap); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
418 | numcmd += add_cmd(ctx, a, bcode, expr->right, ap); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
419 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
420 | |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
421 | switch(expr->op) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
422 | case DAVQL_NOT: { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
423 | numcmd += add_cmd(ctx, a, bcode, expr->left, ap); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
424 | cmd.type = DAVQL_CMD_OP_LOGICAL_NOT; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
425 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
426 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
427 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
428 | case DAVQL_LAND: { |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
429 | cmd.type = DAVQL_CMD_OP_LOGICAL_AND; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
430 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
431 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
432 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
433 | case DAVQL_LOR: { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
434 | int nleft = add_cmd(ctx, a, bcode, expr->left, ap); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
435 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
436 | cmd.type = DAVQL_CMD_OP_LOGICAL_OR_L; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
437 | DavQLCmd *or_l = (DavQLCmd*)(bcode->space + bcode->pos); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
438 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
439 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
440 | int nright = add_cmd(ctx, a, bcode, expr->right, ap); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
441 | or_l->data.integer = nright + 1; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
442 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
443 | cmd.type = DAVQL_CMD_OP_LOGICAL_OR; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
444 | cmd.data.integer = 0; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
445 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
446 | |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
447 | numcmd += nleft + nright; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
448 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
449 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
450 | case DAVQL_LXOR: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
451 | cmd.type = DAVQL_CMD_OP_LOGICAL_XOR; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
452 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
453 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
454 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
455 | case DAVQL_EQ: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
456 | cmd.type = DAVQL_CMD_OP_EQ; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
457 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
458 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
459 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
460 | case DAVQL_NEQ: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
461 | cmd.type = DAVQL_CMD_OP_NEQ; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
462 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
463 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
464 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
465 | case DAVQL_LT: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
466 | cmd.type = DAVQL_CMD_OP_LT; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
467 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
468 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
469 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
470 | case DAVQL_GT: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
471 | cmd.type = DAVQL_CMD_OP_GT; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
472 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
473 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
474 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
475 | case DAVQL_LE: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
476 | cmd.type = DAVQL_CMD_OP_LE; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
477 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
478 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
479 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
480 | case DAVQL_GE: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
481 | cmd.type = DAVQL_CMD_OP_GE; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
482 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
483 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
484 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
485 | case DAVQL_LIKE: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
486 | cmd.type = DAVQL_CMD_OP_LIKE; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
487 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
488 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
489 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
490 | case DAVQL_UNLIKE: { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
491 | cmd.type = DAVQL_CMD_OP_UNLIKE; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
492 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
493 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
494 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
495 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
496 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
497 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
498 | case DAVQL_FUNCCALL: { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
499 | switch(expr->op) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
500 | case DAVQL_CALL: { |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
501 | int nright = add_cmd(ctx, a, bcode, expr->right, ap); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
502 | // TODO: count args |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
503 | DavQLExpression *funcid = expr->left; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
504 | if(!funcid && funcid->type != DAVQL_IDENTIFIER) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
505 | // fail |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
506 | return -1; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
507 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
508 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
509 | // numargs |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
510 | cmd.type = DAVQL_CMD_INT; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
511 | cmd.data.integer = count_func_args(expr); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
512 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
513 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
514 | // TODO: resolve function name |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
515 | cmd.type = DAVQL_CMD_CALL; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
516 | cmd.data.func = NULL; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
517 | ucx_buffer_write(&cmd, sizeof(cmd), 1, bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
518 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
519 | numcmd = 2; |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
520 | numcmd += nright; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
521 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
522 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
523 | case DAVQL_ARGLIST: { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
524 | numcmd = 0; |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
525 | numcmd += add_cmd(ctx, a, bcode, expr->left, ap); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
526 | numcmd += add_cmd(ctx, a, bcode, expr->right, ap); |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
527 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
528 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
529 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
530 | break; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
531 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
532 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
533 | return numcmd; |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
534 | } |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
535 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
536 | UcxBuffer* dav_compile_expr(DavContext *ctx, UcxAllocator *a, DavQLExpression *lexpr, va_list ap) { |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
537 | UcxBuffer *bcode = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
538 | if(!bcode) { |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
539 | return NULL; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
540 | } |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
541 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
542 | if(add_cmd(ctx, a, bcode, lexpr, ap) <= 0) { |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
543 | ucx_buffer_free(bcode); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
544 | return NULL; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
545 | } |
123
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
546 | |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
547 | return bcode; |
806c4dccf2ae
added where clause compiler prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
104
diff
changeset
|
548 | } |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
549 | |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
550 | int dav_exec_expr(UcxBuffer *bcode, DavResource *res, DavQLStackObj *result) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
551 | size_t count = bcode->pos / sizeof(DavQLCmd); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
552 | DavQLCmd *cmds = (DavQLCmd*)bcode->space; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
553 | |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
554 | // create execution stack |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
555 | size_t stsize = 64; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
556 | size_t stpos = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
557 | DavQLStackObj *stack = calloc(stsize, sizeof(DavQLStackObj)); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
558 | #define DAVQL_PUSH(obj) \ |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
559 | if(stpos == stsize) { \ |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
560 | stsize += 64; \ |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
561 | stack = realloc(stack, stsize * sizeof(DavQLStackObj)); \ |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
562 | } \ |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
563 | stack[stpos++] = obj; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
564 | #define DAVQL_POP() stack[--stpos] |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
565 | |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
566 | DavQLStackObj obj; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
567 | for(size_t i=0;i<count;i++) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
568 | DavQLCmd cmd = cmds[i]; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
569 | switch(cmd.type) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
570 | case DAVQL_CMD_INT: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
571 | printf("int %lld\n", cmd.data.integer); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
572 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
573 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
574 | obj.data.integer = cmd.data.integer; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
575 | DAVQL_PUSH(obj); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
576 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
577 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
578 | case DAVQL_CMD_STRING: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
579 | printf("string \"%.*s\"\n", cmd.data.string.length, cmd.data.string.ptr); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
580 | obj.type = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
581 | obj.length = cmd.data.string.length; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
582 | obj.data.string = cmd.data.string.ptr; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
583 | DAVQL_PUSH(obj); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
584 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
585 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
586 | case DAVQL_CMD_TIMESTAMP: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
587 | printf("timestamp %d\n", cmd.data.timestamp); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
588 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
589 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
590 | obj.data.integer = cmd.data.timestamp; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
591 | DAVQL_PUSH(obj); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
592 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
593 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
594 | case DAVQL_CMD_RES_IDENTIFIER: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
595 | char *rid[8] = {"name", "path", "href", "contentlength", "contenttype", "creationdate", "lastmodified", "iscollection"}; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
596 | printf("resprop %s\n", rid[cmd.data.resprop]); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
597 | switch(cmd.data.resprop) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
598 | case DAVQL_RES_NAME: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
599 | obj.type = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
600 | obj.length = strlen(res->name); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
601 | obj.data.string = res->name; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
602 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
603 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
604 | case DAVQL_RES_PATH: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
605 | obj.type = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
606 | obj.length = strlen(res->path); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
607 | obj.data.string = res->path; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
608 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
609 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
610 | case DAVQL_RES_HREF: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
611 | obj.type = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
612 | obj.length = strlen(res->href); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
613 | obj.data.string = res->href; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
614 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
615 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
616 | case DAVQL_RES_CONTENTLENGTH: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
617 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
618 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
619 | obj.data.integer = res->contentlength; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
620 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
621 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
622 | case DAVQL_RES_CONTENTTYPE: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
623 | obj.type = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
624 | obj.length = strlen(res->contenttype); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
625 | obj.data.string = res->contenttype; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
626 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
627 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
628 | case DAVQL_RES_CREATIONDATE: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
629 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
630 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
631 | obj.data.integer = res->creationdate; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
632 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
633 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
634 | case DAVQL_RES_LASTMODIFIED: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
635 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
636 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
637 | obj.data.integer = res->lastmodified; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
638 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
639 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
640 | case DAVQL_RES_ISCOLLECTION: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
641 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
642 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
643 | obj.data.integer = res->iscollection; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
644 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
645 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
646 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
647 | DAVQL_PUSH(obj); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
648 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
649 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
650 | case DAVQL_CMD_PROP_IDENTIFIER: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
651 | printf("property %s:%s\n", cmd.data.property.ns, cmd.data.property.name); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
652 | char *value = dav_get_property_ns(res, cmd.data.property.ns, cmd.data.property.name); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
653 | obj.type = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
654 | obj.length = value ? strlen(value) : 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
655 | obj.data.string = value; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
656 | DAVQL_PUSH(obj); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
657 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
658 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
659 | case DAVQL_CMD_OP_UNARY_ADD: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
660 | printf("uadd\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
661 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
662 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
663 | case DAVQL_CMD_OP_UNARY_SUB: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
664 | printf("usub\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
665 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
666 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
667 | case DAVQL_CMD_OP_UNARY_NEG: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
668 | printf("uneg\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
669 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
670 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
671 | case DAVQL_CMD_OP_BINARY_ADD: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
672 | printf("add\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
673 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
674 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
675 | case DAVQL_CMD_OP_BINARY_SUB: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
676 | printf("sub\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
677 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
678 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
679 | case DAVQL_CMD_OP_BINARY_MUL: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
680 | printf("mul\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
681 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
682 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
683 | case DAVQL_CMD_OP_BINARY_DIV: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
684 | printf("div\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
685 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
686 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
687 | case DAVQL_CMD_OP_BINARY_AND: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
688 | printf("and\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
689 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
690 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
691 | case DAVQL_CMD_OP_BINARY_OR: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
692 | printf("or\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
693 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
694 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
695 | case DAVQL_CMD_OP_BINARY_XOR: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
696 | printf("xor\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
697 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
698 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
699 | case DAVQL_CMD_OP_LOGICAL_NOT: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
700 | printf("not\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
701 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
702 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
703 | case DAVQL_CMD_OP_LOGICAL_AND: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
704 | printf("land\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
705 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
706 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
707 | case DAVQL_CMD_OP_LOGICAL_OR_L: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
708 | printf("or_l %d\n", cmd.data.integer); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
709 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
710 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
711 | case DAVQL_CMD_OP_LOGICAL_OR: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
712 | printf("or\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
713 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
714 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
715 | case DAVQL_CMD_OP_LOGICAL_XOR: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
716 | printf("lxor\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
717 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
718 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
719 | case DAVQL_CMD_OP_EQ: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
720 | printf("eq\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
721 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
722 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
723 | case DAVQL_CMD_OP_NEQ: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
724 | printf("neq\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
725 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
726 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
727 | case DAVQL_CMD_OP_LT: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
728 | printf("lt\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
729 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
730 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
731 | case DAVQL_CMD_OP_GT: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
732 | printf("gt\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
733 | DavQLStackObj obj2 = DAVQL_POP(); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
734 | DavQLStackObj obj1 = DAVQL_POP(); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
735 | // result |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
736 | obj.type = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
737 | obj.length = 0; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
738 | |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
739 | int64_t int1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
740 | int64_t int2; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
741 | int isint = 1; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
742 | if(obj1.type == 0) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
743 | int1 = obj1.data.integer; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
744 | } else { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
745 | isint = util_strtoint(obj1.data.string, &int1); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
746 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
747 | if(isint) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
748 | if(obj2.type == 0) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
749 | int2 = obj2.data.integer; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
750 | } else { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
751 | isint = util_strtoint(obj2.data.string, &int2); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
752 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
753 | if(isint) { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
754 | obj.data.integer = int1 > int2; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
755 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
756 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
757 | |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
758 | // string compare |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
759 | // TODO |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
760 | DAVQL_PUSH(obj); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
761 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
762 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
763 | case DAVQL_CMD_OP_LE: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
764 | printf("le\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
765 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
766 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
767 | case DAVQL_CMD_OP_GE: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
768 | printf("ge\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
769 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
770 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
771 | case DAVQL_CMD_OP_LIKE: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
772 | printf("like\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
773 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
774 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
775 | case DAVQL_CMD_OP_UNLIKE: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
776 | printf("unlike\n"); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
777 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
778 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
779 | case DAVQL_CMD_CALL: { |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
780 | printf("call %x\n", cmd.data.func); |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
781 | break; |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
782 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
783 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
784 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
785 | |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
786 | int ret = 0; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
787 | if(stpos == 1) { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
788 | *result = stack[0]; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
789 | } else { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
790 | ret = -1; |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
791 | } |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
792 | free(stack); |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
793 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
794 | return ret; |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
795 | } |
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
796 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
797 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
798 | void print_bytecode(UcxBuffer *bcode) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
799 | bcode->pos = 0; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
800 | DavQLCmd cmd; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
801 | while(ucx_buffer_read(&cmd, sizeof(DavQLCmd), 1, bcode) == 1) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
802 | switch(cmd.type) { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
803 | case DAVQL_CMD_INT: { |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
804 | printf("int %lld\n", cmd.data.integer); |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
805 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
806 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
807 | case DAVQL_CMD_STRING: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
808 | printf("string \"%.*s\"\n", cmd.data.string.length, cmd.data.string.ptr); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
809 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
810 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
811 | case DAVQL_CMD_TIMESTAMP: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
812 | printf("timestamp %d\n", cmd.data.timestamp); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
813 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
814 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
815 | case DAVQL_CMD_RES_IDENTIFIER: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
816 | char *rid[8] = {"name", "path", "href", "contentlength", "contenttype", "creationdate", "lastmodified", "iscollection"}; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
817 | printf("resprop %s\n", rid[cmd.data.resprop]); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
818 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
819 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
820 | case DAVQL_CMD_PROP_IDENTIFIER: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
821 | printf("property %s:%s\n", cmd.data.property.ns, cmd.data.property.name); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
822 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
823 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
824 | case DAVQL_CMD_OP_UNARY_ADD: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
825 | printf("uadd\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
826 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
827 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
828 | case DAVQL_CMD_OP_UNARY_SUB: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
829 | printf("usub\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
830 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
831 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
832 | case DAVQL_CMD_OP_UNARY_NEG: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
833 | printf("uneg\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
834 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
835 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
836 | case DAVQL_CMD_OP_BINARY_ADD: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
837 | printf("add\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
838 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
839 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
840 | case DAVQL_CMD_OP_BINARY_SUB: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
841 | printf("sub\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
842 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
843 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
844 | case DAVQL_CMD_OP_BINARY_MUL: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
845 | printf("mul\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
846 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
847 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
848 | case DAVQL_CMD_OP_BINARY_DIV: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
849 | printf("div\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
850 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
851 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
852 | case DAVQL_CMD_OP_BINARY_AND: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
853 | printf("and\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
854 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
855 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
856 | case DAVQL_CMD_OP_BINARY_OR: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
857 | printf("or\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
858 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
859 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
860 | case DAVQL_CMD_OP_BINARY_XOR: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
861 | printf("xor\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
862 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
863 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
864 | case DAVQL_CMD_OP_LOGICAL_NOT: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
865 | printf("not\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
866 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
867 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
868 | case DAVQL_CMD_OP_LOGICAL_AND: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
869 | printf("land\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
870 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
871 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
872 | case DAVQL_CMD_OP_LOGICAL_OR_L: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
873 | printf("or_l %d\n", cmd.data.integer); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
874 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
875 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
876 | case DAVQL_CMD_OP_LOGICAL_OR: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
877 | printf("or\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
878 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
879 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
880 | case DAVQL_CMD_OP_LOGICAL_XOR: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
881 | printf("lxor\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
882 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
883 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
884 | case DAVQL_CMD_OP_EQ: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
885 | printf("eq\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
886 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
887 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
888 | case DAVQL_CMD_OP_NEQ: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
889 | printf("neq\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
890 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
891 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
892 | case DAVQL_CMD_OP_LT: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
893 | printf("lt\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
894 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
895 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
896 | case DAVQL_CMD_OP_GT: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
897 | printf("gt\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
898 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
899 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
900 | case DAVQL_CMD_OP_LE: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
901 | printf("le\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
902 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
903 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
904 | case DAVQL_CMD_OP_GE: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
905 | printf("ge\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
906 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
907 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
908 | case DAVQL_CMD_OP_LIKE: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
909 | printf("like\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
910 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
911 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
912 | case DAVQL_CMD_OP_UNLIKE: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
913 | printf("unlike\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
914 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
915 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
916 | case DAVQL_CMD_CALL: { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
917 | printf("call %x\n", cmd.data.func); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
918 | break; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
919 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
920 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
921 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
922 | printf("\n"); |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
923 | } |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
924 |