internal header for libroxml.so More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "roxml-defines.h"
#include "roxml-types.h"
#include "roxml.h"
Go to the source code of this file.
Defines | |
#define | ROXML_INT |
Functions | |
void ROXML_INT | roxml_free_node (node_t *n) |
internal function | |
node_t *ROXML_INT | roxml_create_node (int pos, void *src, int type) |
internal function | |
void ROXML_INT | roxml_del_tree (node_t *n) |
internal function | |
void ROXML_INT | roxml_close_node (node_t *n, node_t *close) |
internal function | |
node_t *ROXML_INT | roxml_load (node_t *current_node, FILE *file, char *buffer) |
generic load function | |
node_t *ROXML_INT | roxml_parent_node (node_t *parent, node_t *n) |
internal function | |
void ROXML_INT | roxml_parent_node_at (node_t *parent, node_t *n, int position) |
node relocate function | |
void *ROXML_INT | roxml_malloc (int size, int num, int type) |
alloc memory function | |
xpath_node_t *ROXML_INT | roxml_set_axes (xpath_node_t *node, char *axes, int *offset) |
axes setter function | |
int ROXML_INT | roxml_parse_xpath (char *path, xpath_node_t **xpath, int context) |
xpath parsing function | |
void ROXML_INT | roxml_free_xcond (xpath_cond_t *xcond) |
xpath condition free function | |
void ROXML_INT | roxml_free_xpath (xpath_node_t *xpath, int nb) |
xpath free function | |
int ROXML_INT | roxml_double_cmp (double a, double b, int op) |
double comparison function | |
double ROXML_INT | roxml_double_oper (double a, double b, int op) |
double operation function | |
int ROXML_INT | roxml_validate_predicat (xpath_node_t *xn, node_t *candidat) |
predicat validation function | |
int ROXML_INT | roxml_request_id (node_t *root) |
id reservation function | |
void ROXML_INT | roxml_release_id (node_t *root, node_t **pool, int pool_len, int req_id) |
release id function | |
int ROXML_INT | roxml_add_to_pool (node_t *root, node_t *n, int req_id) |
add a token top node function | |
int ROXML_INT | roxml_validate_axes (node_t *root, node_t *candidat, node_t ***ans, int *nb, int *max, xpath_node_t *xn, int req_id) |
axe validation function | |
void ROXML_INT | roxml_check_node (xpath_node_t *xp, node_t *root, node_t *context, node_t ***ans, int *nb, int *max, int ignore, int req_id) |
real xpath validation function | |
void ROXML_INT | roxml_print_space (FILE *f, char **buf, int *offset, int *len, int lvl) |
space printing function | |
void ROXML_INT | roxml_write_string (char **buf, FILE *f, char *str, int *offset, int *len) |
string writter function | |
void ROXML_INT | roxml_write_node (node_t *n, FILE *f, char *buf, int human, int lvl, int *offset, int *len) |
tree write function | |
void ROXML_INT | roxml_del_arg_node (node_t *n) |
attribute node deletion function | |
void ROXML_INT | roxml_del_txt_node (node_t *n) |
text node deletion function | |
void ROXML_INT | roxml_del_std_node (node_t *n) |
node deletion function | |
void ROXML_INT | roxml_set_type (node_t *n, int type) |
node type setter function | |
int ROXML_INT | roxml_get_node_internal_position (node_t *n) |
node absolute position get | |
void ROXML_INT | roxml_compute_and (node_t *root, node_t **node_set, int *count, int cur_req_id, int prev_req_id) |
node set and function | |
void ROXML_INT | roxml_compute_or (node_t *root, node_t **node_set, int *count, int req_id, int glob_id) |
node set or function | |
void ROXML_INT | roxml_del_from_pool (node_t *root, node_t *n, int req_id) |
pool node delete function | |
int ROXML_INT | roxml_in_pool (node_t *root, node_t *n, int req_id) |
node pool presence tester function | |
node_t **ROXML_INT | roxml_exec_xpath (node_t *root, node_t *n, xpath_node_t *xpath, int index, int *count) |
real xpath execution | |
void ROXML_INT | roxml_process_begin_node (roxml_load_ctx_t *context, int position) |
node creation during parsing | |
Variables | |
memory_cell_t | head_cell |
head of memory manager |
internal header for libroxml.so
This is the header file used by roxml.c
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file roxml-internal.h.
#define ROXML_INT |
internal function: not part of the API
Definition at line 31 of file roxml-internal.h.
add a token top node function
this function add a token to target node. This token is used to garanty unicity in xpath results
root | the root node | |
n | the node to mark | |
req_id | the id to use |
Definition at line 638 of file roxml-internal.c.
roxml_check_node | ( | xpath_node_t * | xp, | |
node_t * | root, | |||
node_t * | context, | |||
node_t *** | ans, | |||
int * | nb, | |||
int * | max, | |||
int | ignore, | |||
int | req_id | |||
) |
real xpath validation function
this function perform the xpath test on a tree
xp | the xpath nodes to test | |
root | the root node | |
context | the current context node | |
ans | the pointer to answers pool | |
nb | the number of answers in pool | |
max | the current size of the pool | |
ignore | a flag for some axes that are going thru all document | |
req_id | the pool id |
Definition at line 772 of file roxml-internal.c.
internal function
This function close the node (add the end offset) and parent the node
n | is the node to close | |
close | is the node that close node n |
Definition at line 65 of file roxml-internal.c.
roxml_compute_and | ( | node_t * | root, | |
node_t ** | node_set, | |||
int * | count, | |||
int | cur_req_id, | |||
int | prev_req_id | |||
) |
node set and function
this function computes the AND of two node pools. The resulting pool will have the same ID as cur_req_id.
root | the root of the tree | |
node_set | the node set containing the 2 pools | |
count | number of node in the node set | |
cur_req_id | the id of the first group | |
prev_req_id | the id of the second group |
Definition at line 1220 of file roxml-internal.c.
node set or function
this function computes the OR of two node pools. The resulting pool will have the same ID as glob_id.
root | the root of the tree | |
node_set | the node set containing the 2 pools | |
count | number of node in the node set | |
req_id | the id of the first group | |
glob_id | the id of the second group |
Definition at line 1235 of file roxml-internal.c.
node_t *ROXML_INT roxml_create_node | ( | int | pos, | |
void * | src, | |||
int | type | |||
) |
internal function
This function allocate a new node
pos | is the beginning offset of the node in the file | |
src | is the pointer to the buffer or file | |
type | is the type of node between arg and val |
Definition at line 54 of file roxml-internal.c.
roxml_del_arg_node | ( | node_t * | n | ) |
attribute node deletion function
this function delete an attribute node
n | the node to delete |
Definition at line 1139 of file roxml-internal.c.
pool node delete function
this function remove one node from a pool
root | the root of the tree | |
n | the node to remove | |
req_id | the pool id |
Definition at line 613 of file roxml-internal.c.
roxml_del_std_node | ( | node_t * | n | ) |
node deletion function
this function delete a standard node
n | the node to delete |
Definition at line 1166 of file roxml-internal.c.
void ROXML_INT roxml_del_tree | ( | node_t * | n | ) |
internal function
This function delete a tree recursively
n | is one node of the tree |
Definition at line 104 of file roxml-internal.c.
roxml_del_txt_node | ( | node_t * | n | ) |
text node deletion function
this function delete a text node
n | the node to delete |
Definition at line 1153 of file roxml-internal.c.
roxml_double_cmp | ( | double | a, | |
double | b, | |||
int | op | |||
) |
double comparison function
this function compare two doubles using one defined operator
a | first operand | |
b | second operand | |
op | the operator to use |
Definition at line 419 of file roxml-internal.c.
roxml_double_oper | ( | double | a, | |
double | b, | |||
int | op | |||
) |
double operation function
this function compare two doubles using one defined operator
a | first operand | |
b | second operand | |
op | the operator to use |
Definition at line 405 of file roxml-internal.c.
roxml_exec_xpath | ( | node_t * | root, | |
node_t * | n, | |||
xpath_node_t * | xpath, | |||
int | index, | |||
int * | count | |||
) |
real xpath execution
this function exec a decoded xpath strcuture
root | the root of the tree | |
n | the context node | |
xpath | the xpath structure | |
index | the number of xpath condition in string | |
count | the pointer to a variable that is filled with the resulting node number |
Definition at line 1247 of file roxml-internal.c.
void ROXML_INT roxml_free_node | ( | node_t * | n | ) |
internal function
This function delete a node
n | is one node of the tree |
Definition at line 81 of file roxml-internal.c.
roxml_free_xcond | ( | xpath_cond_t * | xcond | ) |
xpath condition free function
this function frees an xpath_cond_t cell
xcond | the xcond to free |
Definition at line 379 of file roxml-internal.c.
roxml_free_xpath | ( | xpath_node_t * | xpath, | |
int | nb | |||
) |
xpath free function
this function frees the parsed xpath structure
xpath | the xpath to free | |
nb | the number of xpath structures in the table |
Definition at line 390 of file roxml-internal.c.
roxml_get_node_internal_position | ( | node_t * | n | ) |
node absolute position get
this function returns the absolute position of the node between siblings
n | the node |
Definition at line 296 of file roxml-internal.c.
node pool presence tester function
this function test is a node is in a pool
root | the root of the tree | |
n | the node to test | |
req_id | the pool id |
Definition at line 578 of file roxml-internal.c.
generic load function
This function load a document and all the corresponding nodes file and buffer params are exclusive. You usualy want to load either a file OR a buffer
current_node | the XML root | |
file | file descriptor of document | |
buffer | address of buffer that contains xml |
Definition at line 132 of file roxml-internal.c.
roxml_malloc | ( | int | size, | |
int | num, | |||
int | type | |||
) |
alloc memory function
this function allocate some memory that will be reachable at any time by libroxml memory manager
size | the size of memory to allocate for each elem | |
num | the number of element | |
type | the kind of pointer |
Definition at line 37 of file roxml-internal.c.
internal function
This function give a node to its parent and the parent to the node
parent | is the parent node | |
n | is one orphan node of the tree |
Definition at line 1182 of file roxml-internal.c.
node relocate function
this function change the position of a node in its parent list
parent | the parent node | |
n | the node to parent | |
position | the position, 0 means or > nb children means at the end |
Definition at line 933 of file roxml-internal.c.
roxml_parse_xpath | ( | char * | path, | |
xpath_node_t ** | xpath, | |||
int | context | |||
) |
xpath parsing function
this function convert an xpath string to a table of list of xpath_node_t
path | the xpath string | |
xpath | the parsed xpath | |
context | 0 for a real xpath, 1 for a xpath in predicat |
Definition at line 317 of file roxml-internal.c.
roxml_print_space | ( | FILE * | f, | |
char ** | buf, | |||
int * | offset, | |||
int * | len, | |||
int | lvl | |||
) |
space printing function
this function add some space to output when committing change in human format
f | the file pointer if any | |
buf | the pointer to string if any | |
offset | the current offset in stream | |
len | the total len of buffer if any | |
lvl | the level in the tree |
Definition at line 998 of file roxml-internal.c.
roxml_process_begin_node | ( | roxml_load_ctx_t * | context, | |
int | position | |||
) |
node creation during parsing
this function create a new node upon finding new opening sign. It closes previous node if necessary
context | the parsing context | |
position | the position in the file |
Definition at line 114 of file roxml-internal.c.
release id function
this function release a previously required id and remove all id token from the pool
root | the root of the tree that was used for id request | |
pool | the result from xpath search using this id | |
pool_len | the number of node in pool | |
req_id | the id to release |
Definition at line 601 of file roxml-internal.c.
roxml_request_id | ( | node_t * | root | ) |
id reservation function
this function request an available id for a new xpath search on the tree
root | the root of the tree where id table is stored |
Definition at line 554 of file roxml-internal.c.
roxml_set_axes | ( | xpath_node_t * | node, | |
char * | axes, | |||
int * | offset | |||
) |
axes setter function
this function set the axe to a xpath node from xpath string
node | the xpath node to fill | |
axes | the string where axe is extracted from | |
offset | the detected offset in axe string |
Definition at line 195 of file roxml-internal.c.
roxml_set_type | ( | node_t * | n, | |
int | type | |||
) |
node type setter function
this function change the type of a node
n | the node to modify | |
type | the new type to set |
Definition at line 189 of file roxml-internal.c.
roxml_validate_axes | ( | node_t * | root, | |
node_t * | candidat, | |||
node_t *** | ans, | |||
int * | nb, | |||
int * | max, | |||
xpath_node_t * | xn, | |||
int | req_id | |||
) |
axe validation function
this function validate if an axe is matching the current node
root | the root node | |
candidat | the node to test | |
ans | the pointer to answers pool | |
nb | the number of answers in pool | |
max | the current size of the pool | |
xn | the xpath node to test | |
req_id | the pool id |
Definition at line 672 of file roxml-internal.c.
roxml_validate_predicat | ( | xpath_node_t * | xn, | |
node_t * | candidat | |||
) |
predicat validation function
this function check for predicat validity. predicat is part between brackets
xn | the xpath node containing the predicat to test | |
candidat | the node to test |
Definition at line 437 of file roxml-internal.c.
roxml_write_node | ( | node_t * | n, | |
FILE * | f, | |||
char * | buf, | |||
int | human, | |||
int | lvl, | |||
int * | offset, | |||
int * | len | |||
) |
tree write function
this function write each node of the tree to output
n | the node to write | |
f | the file pointer if any | |
buf | the pointer to string if any | |
human | 1 to use the human format else 0 | |
lvl | the current level in tree | |
offset | the current offset in stream | |
len | the total len of buffer if any |
Definition at line 1025 of file roxml-internal.c.
roxml_write_string | ( | char ** | buf, | |
FILE * | f, | |||
char * | str, | |||
int * | offset, | |||
int * | len | |||
) |
string writter function
this function write a string to output when committing change
f | the file pointer if any | |
buf | the pointer to string if any | |
str | the string to write | |
offset | the current offset in stream | |
len | the total len of buffer if any |
Definition at line 1016 of file roxml-internal.c.