Wed, 04 Dec 2019 11:47:51 +0100
replace openssl on windows with cng/bcrypt
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 | * |
365
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
4 | * Copyright 2018 Olaf Wintermann. All rights reserved. |
104
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 | #ifndef DAVQLEXEC_H |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #define DAVQLEXEC_H |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <stdarg.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "davqlparser.h" |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "webdav.h" |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include <ucx/buffer.h> |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #ifdef __cplusplus |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | extern "C" { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | #endif |
344
72791e299d64
removes openssl dependencies for base64
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
40 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
41 | typedef struct DavQLCmd DavQLCmd; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
42 | typedef struct DavQLStackObj DavQLStackObj; |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
126
diff
changeset
|
43 | typedef struct DavQLRes DavQLRes; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
44 | |
365
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
45 | typedef struct DavQLArg DavQLArg; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
46 | typedef struct DavQLArgList DavQLArgList; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
47 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
48 | typedef void*(*davql_func)(); // TODO: interface? |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | |
365
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
50 | struct DavQLArg { |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
51 | int type; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
52 | union DavQLArgValue{ |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
53 | int d; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
54 | unsigned int u; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
55 | char *s; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
56 | time_t t; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
57 | } value; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
58 | DavQLArg *next; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
59 | }; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
60 | |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
61 | struct DavQLArgList { |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
62 | DavQLArg *first; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
63 | DavQLArg *current; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
64 | }; |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
65 | |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | typedef enum { |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | DAVQL_OK = 0, |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | DAVQL_UNSUPPORTED_FORMATCHAR, |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | DAVQL_UNKNOWN_FORMATCHAR |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | } davqlerror_t; |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
72 | typedef enum { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
73 | DAVQL_CMD_INT = 0, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
74 | DAVQL_CMD_STRING, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
75 | DAVQL_CMD_TIMESTAMP, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
76 | DAVQL_CMD_RES_IDENTIFIER, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
77 | DAVQL_CMD_PROP_IDENTIFIER, |
139
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
78 | //DAVQL_CMD_OP_UNARY_ADD, |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
79 | DAVQL_CMD_OP_UNARY_SUB, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
80 | DAVQL_CMD_OP_UNARY_NEG, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
81 | DAVQL_CMD_OP_BINARY_ADD, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
82 | DAVQL_CMD_OP_BINARY_SUB, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
83 | DAVQL_CMD_OP_BINARY_MUL, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
84 | DAVQL_CMD_OP_BINARY_DIV, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
85 | DAVQL_CMD_OP_BINARY_AND, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
86 | DAVQL_CMD_OP_BINARY_OR, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
87 | DAVQL_CMD_OP_BINARY_XOR, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
88 | DAVQL_CMD_OP_LOGICAL_NOT, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
89 | DAVQL_CMD_OP_LOGICAL_AND, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
90 | DAVQL_CMD_OP_LOGICAL_OR_L, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
91 | DAVQL_CMD_OP_LOGICAL_OR, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
92 | DAVQL_CMD_OP_LOGICAL_XOR, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
93 | DAVQL_CMD_OP_EQ, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
94 | DAVQL_CMD_OP_NEQ, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
95 | DAVQL_CMD_OP_LT, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
96 | DAVQL_CMD_OP_GT, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
97 | DAVQL_CMD_OP_LE, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
98 | DAVQL_CMD_OP_GE, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
99 | DAVQL_CMD_OP_LIKE, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
100 | DAVQL_CMD_OP_UNLIKE, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
101 | DAVQL_CMD_CALL |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
102 | } davqlcmdtype_t; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
103 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
104 | typedef enum { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
105 | DAVQL_RES_NAME = 0, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
106 | DAVQL_RES_PATH, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
107 | DAVQL_RES_HREF, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
108 | DAVQL_RES_CONTENTLENGTH, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
109 | DAVQL_RES_CONTENTTYPE, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
110 | DAVQL_RES_CREATIONDATE, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
111 | DAVQL_RES_LASTMODIFIED, |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
112 | DAVQL_RES_ISCOLLECTION |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
113 | } davqlresprop_t; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
114 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
115 | struct DavQLCmd { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
116 | davqlcmdtype_t type; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
117 | union DavQLCmdData { |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
118 | int64_t integer; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
119 | sstr_t string; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
120 | time_t timestamp; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
121 | davqlresprop_t resprop; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
122 | DavPropName property; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
123 | davql_func func; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
124 | } data; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
125 | }; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
126 | |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
127 | struct DavQLStackObj { |
348
b79fb94f9e0a
davqlexec handles xml properties now (not really, but it doesn't destroy everything)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
128 | int32_t type; // 0: int, 1: string, 2: xml |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
129 | uint32_t length; |
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
130 | union DavQLStackData { |
348
b79fb94f9e0a
davqlexec handles xml properties now (not really, but it doesn't destroy everything)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
131 | int64_t integer; |
b79fb94f9e0a
davqlexec handles xml properties now (not really, but it doesn't destroy everything)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
132 | char *string; |
b79fb94f9e0a
davqlexec handles xml properties now (not really, but it doesn't destroy everything)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
133 | DavXmlNode *node; |
124
41939c8f3f9c
expression compiler generates byte code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
123
diff
changeset
|
134 | } data; |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | }; |
128
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
126
diff
changeset
|
136 | |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
126
diff
changeset
|
137 | struct DavQLRes { |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
126
diff
changeset
|
138 | DavResource *resource; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
126
diff
changeset
|
139 | int depth; |
649eb328674a
implemented minimal executor features and added missing ucx files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
126
diff
changeset
|
140 | }; |
134
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
141 | |
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
142 | typedef struct DavCompiledField { |
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
143 | char *ns; |
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
144 | char *name; |
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
145 | UcxBuffer *code; |
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
146 | } DavCompiledField; |
139
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
147 | |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
148 | typedef struct DavOrderCriterion { |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
149 | int type; // 0: resprop, 1: property |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
150 | union DavQLColumn { |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
151 | davqlresprop_t resprop; |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
152 | UcxKey property; |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
153 | } column; |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
154 | _Bool descending; |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
155 | } DavOrderCriterion; |
365
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
156 | |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
157 | DavQLArgList* dav_ql_get_args(DavQLStatement *st, va_list ap); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
158 | void dav_ql_free_arglist(DavQLArgList *args); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
159 | |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
160 | int dav_ql_getarg_int(DavQLArgList *args); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
161 | unsigned int dav_ql_getarg_uint(DavQLArgList *args); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
162 | char* dav_ql_getarg_str(DavQLArgList *args); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
163 | time_t dav_ql_getarg_time(DavQLArgList *args); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
164 | |
135
664aeaec8d25
replaced old davql (still buggy)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
134
diff
changeset
|
165 | DavResult dav_statement_exec(DavSession *sn, DavQLStatement *st, ...); |
664aeaec8d25
replaced old davql (still buggy)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
134
diff
changeset
|
166 | DavResult dav_statement_execv(DavSession *sn, DavQLStatement *st, va_list ap); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | |
365
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
168 | UcxBuffer* dav_path_string(sstr_t src, DavQLArgList *args, davqlerror_t *error); |
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
169 | sstr_t dav_format_string(UcxAllocator *a, sstr_t fstr, DavQLArgList *ap, davqlerror_t *error); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
170 | |
135
664aeaec8d25
replaced old davql (still buggy)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
134
diff
changeset
|
171 | DavResult dav_exec_select(DavSession *sn, DavQLStatement *st, va_list ap); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172 | |
139
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
173 | int dav_identifier2resprop(sstr_t src, davqlresprop_t *prop); |
c6424aebcf5e
implemented davql order by
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
135
diff
changeset
|
174 | |
365
f04ab0420512
fixes misuse of vaarg on all platforms
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
348
diff
changeset
|
175 | UcxBuffer* dav_compile_expr(DavContext *ctx, UcxAllocator *a, DavQLExpression *lexpr, DavQLArgList *ap); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176 | |
126
b156cae29e65
added expression executor prototype
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
124
diff
changeset
|
177 | int dav_exec_expr(UcxBuffer *bcode, DavResource *res, DavQLStackObj *result); |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178 | |
134
4bccc18820e8
implemented execution of field list expressions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
128
diff
changeset
|
179 | |
104
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
180 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
181 | #ifdef __cplusplus |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
182 | } |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
183 | #endif |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
184 | |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
185 | #endif /* DAVQLEXEC_H */ |
6fb4d24d9df9
added davqlexec source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
186 |