<libroxml  version="3.0.2" />
contact: tristan.lelong@libroxml.net
Macros | Functions
roxml_parser.c File Reference

Parsing engine. More...

#include <stdlib.h>
#include <string.h>
#include "roxml_parser.h"

Go to the source code of this file.

Macros

#define ROXML_PARSER_NCELLS   256
 
#define ROXML_PARSER_NCELLS_MAX   512
 
#define ROXML_PARSER_ITEM(parser, item)   (parser + item)
 

Functions

ROXML_INT int roxml_parser_multiple (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT roxml_parser_item_troxml_append_parser_item (roxml_parser_item_t *parser, char *key, roxml_parse_func func)
 parser item creation function
 
ROXML_INT roxml_parser_item_troxml_parser_allocate (void)
 parser table allocation
 
ROXML_INT void roxml_parser_free (roxml_parser_item_t *parser)
 parser table deletion
 
ROXML_INT roxml_parser_item_troxml_parser_prepare (roxml_parser_item_t *parser)
 parser preparation function
 
ROXML_INT int roxml_parse_line (roxml_parser_item_t *parser, char *line, int len, void *ctx)
 line parsing function
 

Detailed Description

Parsing engine.

(C) Copyright 2014 Tristan Lelong trist.nosp@m.an.l.nosp@m.elong.nosp@m.@lib.nosp@m.roxml.nosp@m..net

SPDX-Licence-Identifier: LGPL-2.1+ The author added a static linking exception, see License.txt.

Definition in file roxml_parser.c.

Macro Definition Documentation

◆ ROXML_PARSER_ITEM

#define ROXML_PARSER_ITEM (   parser,
  item 
)    (parser + item)

Definition at line 20 of file roxml_parser.c.

◆ ROXML_PARSER_NCELLS

#define ROXML_PARSER_NCELLS   256

Definition at line 17 of file roxml_parser.c.

◆ ROXML_PARSER_NCELLS_MAX

#define ROXML_PARSER_NCELLS_MAX   512

Definition at line 18 of file roxml_parser.c.

Function Documentation

◆ roxml_append_parser_item()

roxml_append_parser_item ( roxml_parser_item_t parser,
char *  key,
roxml_parse_func  func 
)

parser item creation function

this function create a new parser item and append it to the parser list.

Parameters
parserthe parser parser list or NULL for first item
keythe char to trigger callback for
functhe function to call on match
Returns
the parser item

Definition at line 41 of file roxml_parser.c.

◆ roxml_parse_line()

roxml_parse_line ( roxml_parser_item_t parser,
char *  line,
int  len,
void *  ctx 
)

line parsing function

this function parse a line : it calls parsing functions when key matches

Parameters
parserthe parser object
linethe string to parse
lenthe len of string or 0 if auto calculate len (using \0)
ctxuser data passed to the callbacks
Returns
the number of bytes processed

Definition at line 149 of file roxml_parser.c.

◆ roxml_parser_allocate()

roxml_parser_allocate ( void  )

parser table allocation

this function allocate an empty parser object

Returns
the allocated parser

Definition at line 88 of file roxml_parser.c.

◆ roxml_parser_free()

roxml_parser_free ( roxml_parser_item_t parser)

parser table deletion

this function delete a prepared parser object

Parameters
parserthe parser object
Returns

Definition at line 100 of file roxml_parser.c.

◆ roxml_parser_multiple()

ROXML_INT int roxml_parser_multiple ( roxml_parser_item_t parser,
char *  chunk,
void *  data 
)

Definition at line 22 of file roxml_parser.c.

◆ roxml_parser_prepare()

roxml_parser_prepare ( roxml_parser_item_t parser)

parser preparation function

this function compile a parser list into a table and calculate count variables for parsing optim

Parameters
parserthe parser object
Returns

Definition at line 105 of file roxml_parser.c.