Smrender
 All Data Structures Files Functions Variables Macros
smrender.h
1 /* Copyright 2011 Bernhard R. Fischer, 2048R/5C5FFD47 <bf@abenteuerland.at>
2  *
3  * This file is part of smrender.
4  *
5  * Smfilter is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, version 3 of the License.
8  *
9  * Smfilter is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with smrender. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SMRENDER_H
19 #define SMRENDER_H
20 
21 #include <stdint.h>
22 #include <syslog.h>
23 
24 #include "osm_inplace.h"
25 #include "bxtree.h"
26 #include "smaction.h"
27 
28 #if __STDC_VERSION__ < 199901L
29 #if __GNUC__ >= 2
30 #define __func__ __FUNCTION__
31 #else
32 #define __func__ "<unknown>"
33 #endif
34 #endif
35 
36 #define LOG_WARN LOG_WARNING
37 #define log_debug(fmt, x...) log_msg(LOG_DEBUG, "%s() " fmt, __func__, ## x)
38 #define log_warn(x...) log_msg(LOG_WARN, ## x)
39 
40 #define DEG2RAD(x) ((x) * M_PI / 180.0)
41 #define RAD2DEG(x) ((x) * 180.0 / M_PI)
42 
43 #define LAT_CHAR 0
44 #define LON_CHAR 1
45 #define LAT_DEG 2
46 #define LON_DEG 3
47 
48 #ifdef UNUSED
49 #elif defined(__GNUC__)
50 # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
51 #elif defined(__LCLINT__)
52 # define UNUSED(x) /*@unused@*/ x
53 #else
54 # define UNUSED(x) x
55 #endif
56 
57 
58 typedef struct smrule smrule_t;
59 
60 struct coord
61 {
62  double lat, lon;
63 };
64 
65 struct smrule
66 {
67  osm_obj_t *oo;
68  void *data; // arbitrary data
69  action_t *act;
70 };
71 
72 /* smutil.c */
73 int put_object(osm_obj_t*);
74 void *get_object(int, int64_t);
75 int64_t unique_node_id(void);
76 int64_t unique_way_id(void);
77 void set_const_tag(struct otag*, char*, char*);
78 int bs_match_attr(const osm_obj_t*, const struct otag *, const struct stag*);
79 int bs_match(const bstring_t *, const bstring_t *, const struct specialTag *);
80 int match_attr(const osm_obj_t*, const char *, const char *);
81 char *get_param_err(const char *, double *, const action_t *, int *);
82 char *get_param(const char*, double*, const action_t*);
83 char *get_parami(const char*, int*, const action_t*);
84 int get_param_bool(const char*, const action_t*);
85 //void set_static_obj_tree(bx_node_t **);
86 //struct rdata *get_rdata(void);
87 bx_node_t **get_objtree(void);
88 int coord_str(double , int , char *, int );
89 int func_name(char *, int , void *);
90 int put_object0(bx_node_t**, int64_t, void*, int);
91 void *get_object0(bx_node_t*, int64_t, int);
92 int coord_str(double, int, char*, int);
93 int strcnt(const char*, int);
94 int realloc_tags(osm_obj_t *, int );
95 const char *safe_null_str(const char *);
96 
97 /* smlog.c */
98 int log_msg(int, const char*, ...) __attribute__((format (printf, 2, 3)));
99 int log_errno(int , const char *);
100 
101 /* smthread.c */
102 void sm_threaded(smrule_t*);
103 int sm_thread_id(void);
104 
105 #endif
106 
Definition: smaction.h:58
Definition: osm_inplace.h:48
Definition: bxtree.h:28
Definition: smaction.h:68
Definition: smrender.h:65
Definition: osm_inplace.h:43
Definition: bstring.h:28
Definition: smrender.h:60