Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
util_expr_private.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __AP_EXPR_PRIVATE_H__
18 #define __AP_EXPR_PRIVATE_H__
19 
20 #include "httpd.h"
21 #include "apr_strings.h"
22 #include "apr_tables.h"
23 #include "ap_expr.h"
24 
25 #ifndef YY_NULL
26 #define YY_NULL 0
27 #endif
28 
29 #ifndef MIN
30 #define MIN(a,b) (((a)<(b))?(a):(b))
31 #endif
32 
33 #if !APR_HAVE_UNISTD_H
34 #define YY_NO_UNISTD_H
35 #endif
36 
37 #ifdef _MSC_VER
38 /* Avoid some warnings with Visual Studio (likely due to a bug in bison) */
39 #define YYMALLOC malloc
40 #define YYFREE free
41 #endif
42 
43 #ifndef YYDEBUG
44 #define YYDEBUG 0
45 #endif
46 
48 typedef enum {
60  /*
61  * call external functions/operators.
62  * The info node contains the function pointer and some function specific
63  * info.
64  * For Binary operators, the Call node links to the Info node and the
65  * Args node, which in turn links to the left and right operand.
66  * For all other variants, the Call node links to the Info node and the
67  * argument.
68  */
74 
76 struct ap_expr_node {
78  const void *node_arg1;
79  const void *node_arg2;
80 };
81 
83 typedef struct {
84  /* internal state of the scanner */
85  const char *inputbuf;
86  int inputlen;
87  const char *inputptr;
88  void *scanner;
89  char *scan_ptr;
90  char scan_buf[MAX_STRING_LEN];
91  char scan_del;
92  int at_start;
93 
94  /* pools for result and temporary usage */
97 
98  /* The created parse tree */
100 
101  const char *error;
102  const char *error2;
103  unsigned flags;
104 
105  /*
106  * The function to use to lookup provider functions for variables
107  * and funtctions
108  */
111 
112 /* flex/bison functions */
114 void ap_expr_yyerror(ap_expr_parse_ctx_t *context, const char *err);
115 int ap_expr_yylex_init(void **scanner);
116 int ap_expr_yylex_destroy(void *scanner);
117 void ap_expr_yyset_extra(ap_expr_parse_ctx_t *context, void *scanner);
118 
119 /* create a parse tree node */
120 ap_expr_t *ap_expr_make(ap_expr_node_op_e op, const void *arg1,
121  const void *arg2, ap_expr_parse_ctx_t *ctx);
122 /* create parse tree node for the string-returning function 'name' */
123 ap_expr_t *ap_expr_str_func_make(const char *name, const ap_expr_t *arg,
124  ap_expr_parse_ctx_t *ctx);
125 /* create parse tree node for the list-returning function 'name' */
126 ap_expr_t *ap_expr_list_func_make(const char *name, const ap_expr_t *arg,
127  ap_expr_parse_ctx_t *ctx);
128 /* create parse tree node for the variable 'name' */
130 /* create parse tree node for the unary operator 'name' */
131 ap_expr_t *ap_expr_unary_op_make(const char *name, const ap_expr_t *arg,
132  ap_expr_parse_ctx_t *ctx);
133 /* create parse tree node for the binary operator 'name' */
134 ap_expr_t *ap_expr_binary_op_make(const char *name, const ap_expr_t *arg1,
135  const ap_expr_t *arg2,
136  ap_expr_parse_ctx_t *ctx);
137 
138 
139 #endif /* __AP_EXPR_PRIVATE_H__ */
140 
Definition: util_expr_private.h:69
ap_expr_node_op_e node_op
Definition: util_expr_private.h:77
ap_expr_node_op_e
Definition: util_expr_private.h:48
Definition: util_expr_private.h:51
Definition: util_expr_private.h:55
Definition: util_expr_private.h:53
ap_expr_lookup_fn_t * lookup_fn
Definition: util_expr_private.h:109
Definition: util_expr_private.h:53
Definition: util_expr_private.h:55
void ap_expr_yyset_extra(ap_expr_parse_ctx_t *context, void *scanner)
int inputlen
Definition: util_expr_private.h:86
int ap_expr_yylex_init(void **scanner)
Definition: util_expr_private.h:58
apr_pool_t * ptemp
Definition: util_expr_private.h:96
Definition: util_expr_private.h:51
Definition: util_expr_private.h:59
int ap_expr_yylex_destroy(void *scanner)
const void * node_arg1
Definition: util_expr_private.h:78
ap_expr_t * ap_expr_var_make(const char *name, ap_expr_parse_ctx_t *ctx)
int( ap_expr_lookup_fn_t)(ap_expr_lookup_parms *parms)
Definition: ap_expr.h:303
Definition: util_expr_private.h:53
const char * error
Definition: util_expr_private.h:101
Definition: util_expr_private.h:57
Definition: util_expr_private.h:54
Definition: util_expr_private.h:83
void ap_expr_yyerror(ap_expr_parse_ctx_t *context, const char *err)
const char * error2
Definition: util_expr_private.h:102
Definition: util_expr_private.h:55
Definition: util_expr_private.h:51
ap_expr_t * ap_expr_unary_op_make(const char *name, const ap_expr_t *arg, ap_expr_parse_ctx_t *ctx)
Expression parser.
HTTP Daemon routines.
const char * inputptr
Definition: util_expr_private.h:87
#define MAX_STRING_LEN
Definition: httpd.h:300
int ap_expr_yyparse(ap_expr_parse_ctx_t *context)
dav_error * err
Definition: mod_dav.h:203
Definition: util_expr_private.h:71
Definition: util_expr_private.h:55
Definition: util_expr_private.h:52
APR Table library.
Definition: util_expr_private.h:55
Definition: util_expr_private.h:70
Definition: util_expr_private.h:76
const void * node_arg2
Definition: util_expr_private.h:79
Definition: util_expr_private.h:70
ap_expr_t * expr
Definition: util_expr_private.h:99
int at_start
Definition: util_expr_private.h:92
Definition: util_expr_private.h:50
Definition: util_expr_private.h:56
char scan_del
Definition: util_expr_private.h:91
Definition: util_expr_private.h:53
Definition: util_expr_private.h:70
Definition: util_expr_private.h:71
const char * inputbuf
Definition: util_expr_private.h:85
ap_expr_t * ap_expr_make(ap_expr_node_op_e op, const void *arg1, const void *arg2, ap_expr_parse_ctx_t *ctx)
APR Strings library.
Definition: util_expr_private.h:49
unsigned flags
Definition: util_expr_private.h:103
Definition: util_expr_private.h:53
Definition: util_expr_private.h:57
Definition: util_expr_private.h:57
const char * name
Definition: mod_dav.h:730
Definition: util_expr_private.h:57
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
char * scan_ptr
Definition: util_expr_private.h:89
apr_pool_t * pool
Definition: util_expr_private.h:95
Definition: util_expr_private.h:69
Definition: util_expr_private.h:53
Definition: util_expr_private.h:54
Definition: util_expr_private.h:72
ap_expr_t * ap_expr_str_func_make(const char *name, const ap_expr_t *arg, ap_expr_parse_ctx_t *ctx)
Definition: util_expr_private.h:72
ap_expr_t * ap_expr_list_func_make(const char *name, const ap_expr_t *arg, ap_expr_parse_ctx_t *ctx)
ap_expr_t * ap_expr_binary_op_make(const char *name, const ap_expr_t *arg1, const ap_expr_t *arg2, ap_expr_parse_ctx_t *ctx)
Definition: util_expr_private.h:50
Definition: util_expr_private.h:55
void * scanner
Definition: util_expr_private.h:88
Definition: util_expr_private.h:53