Smrender
 All Data Structures Files Functions Variables Macros
Functions | Variables
smcore.c File Reference
#include <inttypes.h>
#include <signal.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include "smrender.h"
#include "smcore.h"
#include "smaction.h"
#include "rdata.h"
#include "lists.h"
Include dependency graph for smcore.c:

Functions

int apply_rule (osm_obj_t *o, smrule_t *r, int *ret)
 
int apply_smrules0 (osm_obj_t *o, smrule_t *r)
 
int call_fini (smrule_t *r)
 
int apply_smrules (smrule_t *r, long ver)
 
int execute_rules (bx_node_t *rules, int version)
 
int traverse (const bx_node_t *nt, int d, int idx, tree_func_t dhandler, void *p)
 
int get_rev_index (osm_obj_t **optr, const osm_obj_t *o)
 
int add_rev_ptr (bx_node_t **idx_root, int64_t id, int idx, osm_obj_t *o)
 
int rev_index_way_nodes (osm_way_t *w, bx_node_t **idx_root)
 
int rev_index_rel_nodes (osm_rel_t *r, bx_node_t **idx_root)
 

Variables

volatile sig_atomic_t int_
 
int render_all_nodes_
 

Detailed Description

This file contains the code of the main execution process.

Author
Bernhard R. Fischer

Function Documentation

int apply_rule ( osm_obj_t o,
smrule_t *  r,
int *  ret 
)

Match and apply ruleset to object if it is visible.

Parameters
oObject which should be rendered (to which to action is applied).
rRule.
retThis variable receives the return value of the rule's act_XXX_main() function. It may be set to NULL.
Returns
If the act_XXX_main() function was called 0 is returned and its return value will be stored to ret. If the rule's main function was not called, a positive integer is returned which defines the reason for act_XXX_main() not being called. These reasons are defined as cpp macros named ERULE_xxx.
int get_rev_index ( osm_obj_t **  optr,
const osm_obj_t o 
)

Find OSM object in object list and return index.

Parameters
optrPointer to NULL-terminated object list.
oPointer to object.
Returns
Index greater or equal 0 of object within list. If the list has no such object the index of the last element (which is a NULL pointer) is returned. If optr itself is a NULL pointer -1 is returned.
int traverse ( const bx_node_t nt,
int  d,
int  idx,
tree_func_t  dhandler,
void *  p 
)

Recursively traverse tree and call function dhandler for all leaf nodes which are not NULL.

Parameters
ntPointer to tree root.
dDepth of traversal. This should be 0 if called at the root of the tree.
idxThe tree actually allows to be an overlapped tree of several trees. idx is the index of the tree which should be traversed.
dhandlerThis is the function called at the leaf node.
pThis is a generic argument which is passed to dhandler upon call.
Returns
On success 0 is returned. If dhandler() returns a value != 0 traverse() will break the recursion and return the return value of dhandler().