亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pattern.c

?? xml開源解析代碼.版本為libxml2-2.6.29,可支持GB3212.網絡消息發送XML時很有用.
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * pattern.c: Implemetation of selectors for nodes * * Reference: *   http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/ *   to some extent  *   http://www.w3.org/TR/1999/REC-xml-19991116 * * See Copyright for the status of this software. * * daniel@veillard.com *//* * TODO: * - compilation flags to check for specific syntaxes *   using flags of xmlPatterncompile() * - making clear how pattern starting with / or . need to be handled, *   currently push(NULL, NULL) means a reset of the streaming context *   and indicating we are on / (the document node), probably need *   something similar for . * - get rid of the "compile" starting with lowercase * - DONE (2006-05-16): get rid of the Strdup/Strndup in case of dictionary */#define IN_LIBXML#include "libxml.h"#include <string.h>#include <libxml/xmlmemory.h>#include <libxml/tree.h>#include <libxml/hash.h>#include <libxml/dict.h>#include <libxml/xmlerror.h>#include <libxml/parserInternals.h>#include <libxml/pattern.h>#ifdef LIBXML_PATTERN_ENABLED/* #define DEBUG_STREAMING */#define ERROR(a, b, c, d)#define ERROR5(a, b, c, d, e)#define XML_STREAM_STEP_DESC	1#define XML_STREAM_STEP_FINAL	2#define XML_STREAM_STEP_ROOT	4#define XML_STREAM_STEP_ATTR	8#define XML_STREAM_STEP_NODE	16#define XML_STREAM_STEP_IN_SET	32/** NOTE: Those private flags (XML_STREAM_xxx) are used*   in _xmlStreamCtxt->flag. They extend the public*   xmlPatternFlags, so be carefull not to interfere with the*   reserved values for xmlPatternFlags. */#define XML_STREAM_FINAL_IS_ANY_NODE 1<<14#define XML_STREAM_FROM_ROOT 1<<15#define XML_STREAM_DESC 1<<16/** XML_STREAM_ANY_NODE is used for comparison against* xmlElementType enums, to indicate a node of any type.*/#define XML_STREAM_ANY_NODE 100#define XML_PATTERN_NOTPATTERN  (XML_PATTERN_XPATH | \				 XML_PATTERN_XSSEL | \				 XML_PATTERN_XSFIELD)#define XML_STREAM_XS_IDC(c) ((c)->flags & \    (XML_PATTERN_XSSEL | XML_PATTERN_XSFIELD))#define XML_STREAM_XS_IDC_SEL(c) ((c)->flags & XML_PATTERN_XSSEL)#define XML_STREAM_XS_IDC_FIELD(c) ((c)->flags & XML_PATTERN_XSFIELD)#define XML_PAT_COPY_NSNAME(c, r, nsname) \    if ((c)->comp->dict) \	r = (xmlChar *) xmlDictLookup((c)->comp->dict, BAD_CAST nsname, -1); \    else r = xmlStrdup(BAD_CAST nsname);#define XML_PAT_FREE_STRING(c, r) if ((c)->comp->dict == NULL) xmlFree(r);typedef struct _xmlStreamStep xmlStreamStep;typedef xmlStreamStep *xmlStreamStepPtr;struct _xmlStreamStep {    int flags;			/* properties of that step */    const xmlChar *name;	/* first string value if NULL accept all */    const xmlChar *ns;		/* second string value */    int nodeType;		/* type of node */};typedef struct _xmlStreamComp xmlStreamComp;typedef xmlStreamComp *xmlStreamCompPtr;struct _xmlStreamComp {    xmlDict *dict;		/* the dictionary if any */    int nbStep;			/* number of steps in the automata */    int maxStep;		/* allocated number of steps */    xmlStreamStepPtr steps;	/* the array of steps */    int flags;};struct _xmlStreamCtxt {    struct _xmlStreamCtxt *next;/* link to next sub pattern if | */    xmlStreamCompPtr comp;	/* the compiled stream */    int nbState;		/* number of states in the automata */    int maxState;		/* allocated number of states */    int level;			/* how deep are we ? */    int *states;		/* the array of step indexes */    int flags;			/* validation options */    int blockLevel;};static void xmlFreeStreamComp(xmlStreamCompPtr comp);/* * Types are private: */typedef enum {    XML_OP_END=0,    XML_OP_ROOT,    XML_OP_ELEM,    XML_OP_CHILD,    XML_OP_ATTR,    XML_OP_PARENT,    XML_OP_ANCESTOR,    XML_OP_NS,    XML_OP_ALL} xmlPatOp;typedef struct _xmlStepState xmlStepState;typedef xmlStepState *xmlStepStatePtr;struct _xmlStepState {    int step;    xmlNodePtr node;};typedef struct _xmlStepStates xmlStepStates;typedef xmlStepStates *xmlStepStatesPtr;struct _xmlStepStates {    int nbstates;    int maxstates;    xmlStepStatePtr states;};typedef struct _xmlStepOp xmlStepOp;typedef xmlStepOp *xmlStepOpPtr;struct _xmlStepOp {    xmlPatOp op;    const xmlChar *value;    const xmlChar *value2; /* The namespace name */};#define PAT_FROM_ROOT	(1<<8)#define PAT_FROM_CUR	(1<<9)struct _xmlPattern {    void *data;    		/* the associated template */    xmlDictPtr dict;		/* the optional dictionary */    struct _xmlPattern *next;	/* next pattern if | is used */    const xmlChar *pattern;	/* the pattern */    int flags;			/* flags */    int nbStep;    int maxStep;    xmlStepOpPtr steps;        /* ops for computation */    xmlStreamCompPtr stream;	/* the streaming data if any */};typedef struct _xmlPatParserContext xmlPatParserContext;typedef xmlPatParserContext *xmlPatParserContextPtr;struct _xmlPatParserContext {    const xmlChar *cur;			/* the current char being parsed */    const xmlChar *base;		/* the full expression */    int	           error;		/* error code */    xmlDictPtr     dict;		/* the dictionary if any */    xmlPatternPtr  comp;		/* the result */    xmlNodePtr     elem;		/* the current node if any */        const xmlChar **namespaces;		/* the namespaces definitions */    int   nb_namespaces;		/* the number of namespaces */};/************************************************************************ * 									* * 			Type functions 					* * 									* ************************************************************************//** * xmlNewPattern: * * Create a new XSLT Pattern * * Returns the newly allocated xmlPatternPtr or NULL in case of error */static xmlPatternPtrxmlNewPattern(void) {    xmlPatternPtr cur;    cur = (xmlPatternPtr) xmlMalloc(sizeof(xmlPattern));    if (cur == NULL) {	ERROR(NULL, NULL, NULL,		"xmlNewPattern : malloc failed\n");	return(NULL);    }    memset(cur, 0, sizeof(xmlPattern));    cur->maxStep = 10;    cur->steps = (xmlStepOpPtr) xmlMalloc(cur->maxStep * sizeof(xmlStepOp));    if (cur->steps == NULL) {        xmlFree(cur);	ERROR(NULL, NULL, NULL,		"xmlNewPattern : malloc failed\n");	return(NULL);    }    return(cur);}/** * xmlFreePattern: * @comp:  an XSLT comp * * Free up the memory allocated by @comp */voidxmlFreePattern(xmlPatternPtr comp) {    xmlStepOpPtr op;    int i;    if (comp == NULL)	return;    if (comp->next != NULL)        xmlFreePattern(comp->next);    if (comp->stream != NULL)        xmlFreeStreamComp(comp->stream);    if (comp->pattern != NULL)	xmlFree((xmlChar *)comp->pattern);    if (comp->steps != NULL) {        if (comp->dict == NULL) {	    for (i = 0;i < comp->nbStep;i++) {		op = &comp->steps[i];		if (op->value != NULL)		    xmlFree((xmlChar *) op->value);		if (op->value2 != NULL)		    xmlFree((xmlChar *) op->value2);	    }	}	xmlFree(comp->steps);    }    if (comp->dict != NULL)        xmlDictFree(comp->dict);    memset(comp, -1, sizeof(xmlPattern));    xmlFree(comp);}/** * xmlFreePatternList: * @comp:  an XSLT comp list * * Free up the memory allocated by all the elements of @comp */voidxmlFreePatternList(xmlPatternPtr comp) {    xmlPatternPtr cur;    while (comp != NULL) {	cur = comp;	comp = comp->next;	cur->next = NULL;	xmlFreePattern(cur);    }}/** * xmlNewPatParserContext: * @pattern:  the pattern context * @dict:  the inherited dictionary or NULL * @namespaces: the prefix definitions, array of [URI, prefix] terminated *              with [NULL, NULL] or NULL if no namespace is used * * Create a new XML pattern parser context * * Returns the newly allocated xmlPatParserContextPtr or NULL in case of error */static xmlPatParserContextPtrxmlNewPatParserContext(const xmlChar *pattern, xmlDictPtr dict,                       const xmlChar **namespaces) {    xmlPatParserContextPtr cur;    if (pattern == NULL)        return(NULL);    cur = (xmlPatParserContextPtr) xmlMalloc(sizeof(xmlPatParserContext));    if (cur == NULL) {	ERROR(NULL, NULL, NULL,		"xmlNewPatParserContext : malloc failed\n");	return(NULL);    }    memset(cur, 0, sizeof(xmlPatParserContext));    cur->dict = dict;    cur->cur = pattern;    cur->base = pattern;    if (namespaces != NULL) {        int i;	for (i = 0;namespaces[2 * i] != NULL;i++);        cur->nb_namespaces = i;    } else {        cur->nb_namespaces = 0;    }    cur->namespaces = namespaces;    return(cur);}/** * xmlFreePatParserContext: * @ctxt:  an XSLT parser context * * Free up the memory allocated by @ctxt */static voidxmlFreePatParserContext(xmlPatParserContextPtr ctxt) {    if (ctxt == NULL)	return;        memset(ctxt, -1, sizeof(xmlPatParserContext));    xmlFree(ctxt);}/** * xmlPatternAdd: * @comp:  the compiled match expression * @op:  an op * @value:  the first value * @value2:  the second value * * Add a step to an XSLT Compiled Match * * Returns -1 in case of failure, 0 otherwise. */static intxmlPatternAdd(xmlPatParserContextPtr ctxt ATTRIBUTE_UNUSED,                xmlPatternPtr comp,                xmlPatOp op, xmlChar * value, xmlChar * value2){    if (comp->nbStep >= comp->maxStep) {        xmlStepOpPtr temp;	temp = (xmlStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 *	                                 sizeof(xmlStepOp));        if (temp == NULL) {	    ERROR(ctxt, NULL, NULL,			     "xmlPatternAdd: realloc failed\n");	    return (-1);	}	comp->steps = temp;	comp->maxStep *= 2;    }    comp->steps[comp->nbStep].op = op;    comp->steps[comp->nbStep].value = value;    comp->steps[comp->nbStep].value2 = value2;    comp->nbStep++;    return (0);}#if 0/** * xsltSwapTopPattern: * @comp:  the compiled match expression * * reverse the two top steps. */static voidxsltSwapTopPattern(xmlPatternPtr comp) {    int i;    int j = comp->nbStep - 1;    if (j > 0) {	register const xmlChar *tmp;	register xmlPatOp op;	i = j - 1;	tmp = comp->steps[i].value;	comp->steps[i].value = comp->steps[j].value;	comp->steps[j].value = tmp;	tmp = comp->steps[i].value2;	comp->steps[i].value2 = comp->steps[j].value2;	comp->steps[j].value2 = tmp;	op = comp->steps[i].op;	comp->steps[i].op = comp->steps[j].op;	comp->steps[j].op = op;    }}#endif/** * xmlReversePattern: * @comp:  the compiled match expression * * reverse all the stack of expressions * * returns 0 in case of success and -1 in case of error. */static intxmlReversePattern(xmlPatternPtr comp) {    int i, j;    /*     * remove the leading // for //a or .//a     */    if ((comp->nbStep > 0) && (comp->steps[0].op == XML_OP_ANCESTOR)) {        for (i = 0, j = 1;j < comp->nbStep;i++,j++) {	    comp->steps[i].value = comp->steps[j].value;	    comp->steps[i].value2 = comp->steps[j].value2;	    comp->steps[i].op = comp->steps[j].op;	}	comp->nbStep--;    }    if (comp->nbStep >= comp->maxStep) {        xmlStepOpPtr temp;	temp = (xmlStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 *	                                 sizeof(xmlStepOp));        if (temp == NULL) {	    ERROR(ctxt, NULL, NULL,			     "xmlReversePattern: realloc failed\n");	    return (-1);	}	comp->steps = temp;	comp->maxStep *= 2;    }    i = 0;    j = comp->nbStep - 1;    while (j > i) {	register const xmlChar *tmp;	register xmlPatOp op;	tmp = comp->steps[i].value;	comp->steps[i].value = comp->steps[j].value;	comp->steps[j].value = tmp;	tmp = comp->steps[i].value2;	comp->steps[i].value2 = comp->steps[j].value2;	comp->steps[j].value2 = tmp;	op = comp->steps[i].op;	comp->steps[i].op = comp->steps[j].op;	comp->steps[j].op = op;	j--;	i++;    }    comp->steps[comp->nbStep].value = NULL;    comp->steps[comp->nbStep].value2 = NULL;    comp->steps[comp->nbStep++].op = XML_OP_END;    return(0);}/************************************************************************ * 									* * 		The interpreter for the precompiled patterns		* * 									* ************************************************************************/static intxmlPatPushState(xmlStepStates *states, int step, xmlNodePtr node) {    if ((states->states == NULL) || (states->maxstates <= 0)) {        states->maxstates = 4;	states->nbstates = 0;	states->states = xmlMalloc(4 * sizeof(xmlStepState));    }    else if (states->maxstates <= states->nbstates) {        xmlStepState *tmp;	tmp = (xmlStepStatePtr) xmlRealloc(states->states,			       2 * states->maxstates * sizeof(xmlStepState));	if (tmp == NULL)	    return(-1);	states->states = tmp;	states->maxstates *= 2;    }    states->states[states->nbstates].step = step;    states->states[states->nbstates++].node = node;#if 0    fprintf(stderr, "Push: %d, %s\n", step, node->name);#endif    return(0);}/** * xmlPatMatch: * @comp: the precompiled pattern * @node: a node * * Test whether the node matches the pattern * * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure */static intxmlPatMatch(xmlPatternPtr comp, xmlNodePtr node) {    int i;    xmlStepOpPtr step;    xmlStepStates states = {0, 0, NULL}; /* // may require backtrack */    if ((comp == NULL) || (node == NULL)) return(-1);    i = 0;restart:    for (;i < comp->nbStep;i++) {	step = &comp->steps[i];	switch (step->op) {            case XML_OP_END:		goto found;            case XML_OP_ROOT:		if (node->type == XML_NAMESPACE_DECL)		    goto rollback;		node = node->parent;		if ((node->type == XML_DOCUMENT_NODE) ||#ifdef LIBXML_DOCB_ENABLED		    (node->type == XML_DOCB_DOCUMENT_NODE) ||#endif		    (node->type == XML_HTML_DOCUMENT_NODE))		    continue;		goto rollback;            case XML_OP_ELEM:		if (node->type != XML_ELEMENT_NODE)		    goto rollback;		if (step->value == NULL)		    continue;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产夜色精品一区二区av| bt欧美亚洲午夜电影天堂| 国产一区久久久| av不卡免费在线观看| 欧美午夜电影在线播放| 日韩一级二级三级| 中文乱码免费一区二区| 亚洲天堂成人网| 亚洲成人先锋电影| 精品系列免费在线观看| 91亚洲男人天堂| 欧美一个色资源| 国产精品视频免费| 舔着乳尖日韩一区| 国产精品1区2区| 日本韩国欧美国产| 精品福利一区二区三区| 亚洲美女区一区| 极品美女销魂一区二区三区| 99亚偷拍自图区亚洲| 日韩欧美区一区二| 亚洲人一二三区| 激情小说亚洲一区| 一本久道久久综合中文字幕| 精品三级在线看| 亚洲一区二区欧美日韩| 国产精品系列在线播放| 欧美伦理视频网站| 自拍av一区二区三区| 紧缚奴在线一区二区三区| 91免费国产在线| 久久久久久久综合日本| 午夜伦理一区二区| 91美女片黄在线观看91美女| 久久久美女艺术照精彩视频福利播放| 亚洲综合久久av| 国产ts人妖一区二区| 91精品国产91久久久久久一区二区 | 欧美综合天天夜夜久久| 国产视频一区在线观看| 日本伊人午夜精品| 91国偷自产一区二区开放时间| 亚洲精品一线二线三线| 天天影视涩香欲综合网| 色综合一个色综合| 久久嫩草精品久久久精品一| 日本午夜一区二区| 欧美自拍丝袜亚洲| 亚洲色图一区二区三区| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 欧美日韩精品欧美日韩精品一综合| 欧美国产97人人爽人人喊| 精品一区二区三区在线观看国产| 欧美撒尿777hd撒尿| 亚洲日本一区二区三区| 成人在线综合网| 国产午夜精品在线观看| 久久aⅴ国产欧美74aaa| 制服视频三区第一页精品| 亚洲午夜私人影院| 色欧美88888久久久久久影院| 日本一区二区三区高清不卡| 极品少妇xxxx精品少妇偷拍| 日韩视频在线观看一区二区| 偷拍自拍另类欧美| 欧美日韩成人综合| 亚洲丶国产丶欧美一区二区三区| 97久久人人超碰| 亚洲免费色视频| 91原创在线视频| 亚洲久本草在线中文字幕| 99re成人精品视频| 亚洲黄色免费网站| 欧美在线免费观看亚洲| 夜夜爽夜夜爽精品视频| 在线观看一区二区精品视频| 一区二区在线观看视频在线观看| 色哟哟在线观看一区二区三区| 亚洲视频 欧洲视频| 色综合天天视频在线观看| 亚洲三级视频在线观看| 在线一区二区观看| 午夜欧美在线一二页| 欧美蜜桃一区二区三区| 日韩国产欧美在线视频| 欧美成人三级电影在线| 国产最新精品免费| 国产女人18水真多18精品一级做| 粉嫩13p一区二区三区| 一区二区中文视频| 欧美三区在线视频| 日本vs亚洲vs韩国一区三区二区| 欧美一级在线观看| 久久成人麻豆午夜电影| 久久久www免费人成精品| 成人黄色小视频在线观看| 国产精品电影一区二区三区| 在线观看视频一区二区| 日本不卡视频在线观看| 久久久久久久国产精品影院| 高清beeg欧美| 伊人色综合久久天天| 欧美一级午夜免费电影| 国产乱人伦偷精品视频免下载 | 91视频免费看| 香蕉久久一区二区不卡无毒影院| 欧美精品第1页| 国产精品主播直播| 亚洲欧美日韩国产一区二区三区| 欧美老女人第四色| 国产一区999| 亚洲精品日日夜夜| 日韩欧美在线网站| 成人亚洲一区二区一| 亚洲成人在线免费| 久久精品水蜜桃av综合天堂| 91高清视频免费看| 精品一区二区三区免费观看| 国产精品久久久久久久久久久免费看 | 日韩久久精品一区| 成人av集中营| 午夜免费久久看| 日本一区二区三区四区在线视频| 欧美亚洲一区三区| 国产在线一区二区| 亚洲激情成人在线| 久久午夜老司机| 欧美视频自拍偷拍| 懂色av中文字幕一区二区三区| 亚洲午夜精品在线| 国产拍揄自揄精品视频麻豆| 欧美精品久久天天躁| 不卡一卡二卡三乱码免费网站| 五月天视频一区| 国产精品免费视频观看| 欧美一区二区三区视频在线观看 | 中文字幕av免费专区久久| 欧美美女一区二区三区| 丁香激情综合五月| 日韩电影在线一区二区| 亚洲欧美电影院| 久久久久久久久免费| 欧美日韩国产综合草草| jlzzjlzz欧美大全| 精品一区二区三区在线观看| 亚洲一二三四在线观看| 国产精品久久久久久久第一福利| 欧美一二三区精品| 欧日韩精品视频| 99久久综合精品| 国产尤物一区二区在线| 日本成人在线不卡视频| 亚洲小说春色综合另类电影| 欧美国产一区视频在线观看| 欧美大胆人体bbbb| 欧美精品99久久久**| 91在线小视频| 粉嫩蜜臀av国产精品网站| 久久er99热精品一区二区| 午夜激情综合网| 一区二区三国产精华液| 国产精品美女久久久久久| 久久久另类综合| 欧美成人一区二区三区| 欧美日韩成人综合天天影院 | 亚洲尤物在线视频观看| 国产精品久久久久一区| 久久久久久夜精品精品免费| 日韩欧美一二三区| 在线不卡a资源高清| 欧美少妇一区二区| 91福利国产成人精品照片| 91免费看视频| 色综合久久综合网| 成人动漫一区二区三区| 国产成a人亚洲精品| 国产一区免费电影| 国产精品亚洲视频| 国产suv精品一区二区6| 国产在线国偷精品免费看| 国产一区二区在线看| 激情小说欧美图片| 国产一区二区三区精品视频| 国精产品一区一区三区mba视频| 裸体在线国模精品偷拍| 精品在线观看免费| 久久99久久久欧美国产| 久久成人羞羞网站| 国产精选一区二区三区| 国产老肥熟一区二区三区| 风流少妇一区二区| 成人夜色视频网站在线观看| a美女胸又www黄视频久久| 91网页版在线| 欧美三区在线观看| 欧美一区二区三区四区高清| 精品久久久久久最新网址| 久久精品亚洲乱码伦伦中文| 国产精品美日韩| 亚洲欧美区自拍先锋|