ITS
xer_support.c File Reference
#include <asn_system.h>
#include <xer_support.h>
Include dependency graph for xer_support.c:

Go to the source code of this file.

Macros

#define WHITESPACE(c)   (_charclass[(unsigned char)(c)] == 1)
 
#define ALNUM(c)   (_charclass[(unsigned char)(c)] >= 2)
 
#define ALPHA(c)   (_charclass[(unsigned char)(c)] == 3)
 
#define EXCLAM   0x21 /* '!' */
 
#define CQUOTE   0x22 /* '"' */
 
#define CDASH   0x2d /* '-' */
 
#define CSLASH   0x2f /* '/' */
 
#define LANGLE   0x3c /* '<' */
 
#define CEQUAL   0x3d /* '=' */
 
#define RANGLE   0x3e /* '>' */
 
#define CQUEST   0x3f /* '?' */
 
#define TOKEN_CB_CALL(type, _ns, _current_too, _final)
 
#define TOKEN_CB(_type, _ns, _current_too)   TOKEN_CB_CALL(_type, _ns, _current_too, 0)
 
#define TOKEN_CB_FINAL(_type, _ns, _current_too)   TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1)
 

Enumerations

enum  pstate_e {
  ST_TEXT, ST_TAG_START, ST_TAG_BODY, ST_TAG_QUOTE_WAIT,
  ST_TAG_QUOTED_STRING, ST_TAG_UNQUOTED_STRING, ST_COMMENT_WAIT_DASH1, ST_COMMENT_WAIT_DASH2,
  ST_COMMENT, ST_COMMENT_CLO_DASH2, ST_COMMENT_CLO_RT
}
 

Functions

ssize_t pxml_parse (int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key)
 

Variables

static pxml_chunk_type_e final_chunk_type []
 
static int _charclass [256]
 

Macro Definition Documentation

◆ ALNUM

#define ALNUM (   c)    (_charclass[(unsigned char)(c)] >= 2)

Definition at line 46 of file xer_support.c.

◆ ALPHA

#define ALPHA (   c)    (_charclass[(unsigned char)(c)] == 3)

Definition at line 47 of file xer_support.c.

Referenced by pxml_parse().

◆ CDASH

#define CDASH   0x2d /* '-' */

Definition at line 52 of file xer_support.c.

Referenced by pxml_parse().

◆ CEQUAL

#define CEQUAL   0x3d /* '=' */

Definition at line 55 of file xer_support.c.

Referenced by pxml_parse().

◆ CQUEST

#define CQUEST   0x3f /* '?' */

Definition at line 57 of file xer_support.c.

◆ CQUOTE

#define CQUOTE   0x22 /* '"' */

Definition at line 51 of file xer_support.c.

Referenced by pxml_parse().

◆ CSLASH

#define CSLASH   0x2f /* '/' */

Definition at line 53 of file xer_support.c.

Referenced by pxml_parse().

◆ EXCLAM

#define EXCLAM   0x21 /* '!' */

Definition at line 50 of file xer_support.c.

Referenced by pxml_parse().

◆ LANGLE

#define LANGLE   0x3c /* '<' */

Definition at line 54 of file xer_support.c.

Referenced by pxml_parse().

◆ RANGLE

#define RANGLE   0x3e /* '>' */

Definition at line 56 of file xer_support.c.

Referenced by pxml_parse().

◆ TOKEN_CB

#define TOKEN_CB (   _type,
  _ns,
  _current_too 
)    TOKEN_CB_CALL(_type, _ns, _current_too, 0)

Definition at line 79 of file xer_support.c.

Referenced by pxml_parse().

◆ TOKEN_CB_CALL

#define TOKEN_CB_CALL (   type,
  _ns,
  _current_too,
  _final 
)
Value:
do { \
int _ret; \
pstate_e ns = _ns; \
ssize_t _sz = (p - chunk_start) + _current_too; \
if (!_sz) { \
/* Shortcut */ \
state = _ns; \
break; \
} \
_ret = cb(type, chunk_start, _sz, key); \
if(_ret < _sz) { \
if(_current_too && _ret == -1) \
state = ns; \
goto finish; \
} \
chunk_start = p + _current_too; \
state = ns; \
} while(0)

Definition at line 60 of file xer_support.c.

◆ TOKEN_CB_FINAL

#define TOKEN_CB_FINAL (   _type,
  _ns,
  _current_too 
)    TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1)

Definition at line 82 of file xer_support.c.

Referenced by pxml_parse().

◆ WHITESPACE

#define WHITESPACE (   c)    (_charclass[(unsigned char)(c)] == 1)

Definition at line 45 of file xer_support.c.

Referenced by pxml_parse().

Enumeration Type Documentation

◆ pstate_e

enum pstate_e
Enumerator
ST_TEXT 
ST_TAG_START 
ST_TAG_BODY 
ST_TAG_QUOTE_WAIT 
ST_TAG_QUOTED_STRING 
ST_TAG_UNQUOTED_STRING 
ST_COMMENT_WAIT_DASH1 
ST_COMMENT_WAIT_DASH2 
ST_COMMENT 
ST_COMMENT_CLO_DASH2 
ST_COMMENT_CLO_RT 

Definition at line 11 of file xer_support.c.

Function Documentation

◆ pxml_parse()

ssize_t pxml_parse ( int *  stateContext,
const void *  xmlbuf,
size_t  size,
pxml_callback_f cb,
void *  key 
)

Definition at line 88 of file xer_support.c.

References ALPHA, CDASH, CEQUAL, CQUOTE, CSLASH, EXCLAM, LANGLE, PXML_COMMENT, PXML_TAG, PXML_TEXT, RANGLE, ST_COMMENT, ST_COMMENT_CLO_DASH2, ST_COMMENT_CLO_RT, ST_COMMENT_WAIT_DASH1, ST_COMMENT_WAIT_DASH2, ST_TAG_BODY, ST_TAG_QUOTE_WAIT, ST_TAG_QUOTED_STRING, ST_TAG_START, ST_TAG_UNQUOTED_STRING, ST_TEXT, TOKEN_CB, TOKEN_CB_FINAL, and WHITESPACE.

Referenced by xer_next_token().

Here is the caller graph for this function:

Variable Documentation

◆ _charclass

int _charclass[256]
static
Initial value:
= {
0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0,
0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0,
0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0
}

Definition at line 35 of file xer_support.c.

◆ final_chunk_type

pxml_chunk_type_e final_chunk_type[]
static