assert( ppos !=
NULL);
124ret = fprintf(stderr,
"%s(%d) Error in file %s line %d\n", file, line, ppos->
filename, ppos->
lineno);
127ret = fprintf(stderr,
"%s", ppos->
buf);
130 if( strchr(ppos->
buf,
'\n') ==
NULL)
134retc = fputc(
'\n', stderr);
138ret = fprintf(stderr,
"%*s\n", ppos->
pos,
"^");
141ret = fprintf(stderr,
"%s\n\n", msg);
148(void) fprintf(stderr,
"%s(%d) Error in file %s line %d\n", file, line, ppos->
filename, ppos->
lineno);
150(void) fprintf(stderr,
"%s", ppos->
buf);
152 if( strchr(ppos->
buf,
'\n') ==
NULL)
154(void) fputc(
'\n', stderr);
157(void) fprintf(stderr,
"%*s\n", ppos->
pos,
"^");
159(void) fprintf(stderr,
"%s\n\n", msg);
176assert(ppos !=
NULL);
177assert(node !=
NULL);
196assert(ppos !=
NULL);
214assert(ppos !=
NULL);
218 xmlError(ppos,
"Stack underflow");
239assert(ppos !=
NULL);
251assert(ppos !=
NULL);
252assert(ppos->
fp!=
NULL);
255 if( ppos->
buf[ppos->
pos] ==
'\0')
257#ifdef SCIP_DISABLED_CODE 262 size_tlen = (size_t)
FREAD(ppos->
buf,
sizeof(ppos->
buf) - 1, ppos->
fp);
264 if( len == 0 || len >
sizeof(ppos->
buf) - 1 )
267ppos->
buf[len] =
'\0';
271 return(
unsigned char)ppos->
buf[ppos->
pos++];
275#ifdef SPEC_LIKE_SPACE_HANDLING 288assert(ppos !=
NULL);
299 if(((c ==
'\n') && (ppos->
lastsym==
'\r')) || ((c ==
'\r') && (ppos->
lastsym==
'\n')))
327assert(ppos !=
NULL);
343 if((c ==
'\n') || (c ==
'\r'))
345}
while((c ==
' ') && (ppos->
lastsym== c));
362assert(ppos !=
NULL);
376assert(ppos !=
NULL);
402assert(ppos !=
NULL);
406 if( ! isalpha(c) && (c !=
'_') && (c !=
':') )
408 xmlError(ppos,
"Name starting with illegal charater");
413 while( isalnum(c) || (c ==
'_') || (c ==
':') || (c ==
'.') || (c ==
'-') )
415 if( len + 1 >= size )
428assert(name !=
NULL);
431name[len++] = (char)c;
438assert(name !=
NULL);
468assert(ppos !=
NULL);
474 if( (c !=
'"') && (c !=
'\'') )
476 xmlError(ppos,
"Atribute value does not start with \" or \'");
496assert(attr !=
NULL);
501 if( (c == stop) || (c == EOF) )
504attr[len++] = (char)c;
530assert(ppos !=
NULL);
539 if( (c ==
'>') && (state >= 2) )
542state = (c ==
'-') ? state + 1 : 0;
546 xmlError(ppos,
"Unexpected EOF in comment");
568assert(ppos !=
NULL);
580 if( (c ==
'>') && (state >= 2) )
598assert(data !=
NULL);
601data[len++] = (char)c;
603assert(data !=
NULL);
609assert(data !=
NULL);
611data[len - 2] =
'\0';
617 xmlError(ppos,
"Unexpected EOF in CDATA");
630assert(ppos !=
NULL);
637 while( (c != EOF) && (c !=
'>') );
643 xmlError(ppos,
"Unexpected EOF in PI");
667 typedef enumXmlSection XMLSECTION;
675{
"--", IS_COMMENT },
676{
"ATTLIST", IS_ATTLIST },
677{
"DOCTYPE", IS_DOCTYPE },
678{
"ELEMENT", IS_ELEMENT },
679{
"ENTITY", IS_ENTITY },
680{
"NOTATION", IS_NOTATION },
681{
"[CDATA[", IS_CDATA }
690assert(ppos !=
NULL);
693end = (int) (
sizeof(key) /
sizeof(key[0])) - 1;
698 for(; (beg <= end) && (c != key[beg].name[k]); beg++)
700 for(; (end >= beg) && (c != key[end].name[k]); end--)
708 xmlError(ppos,
"Unknown declaration");
710 while( (c != EOF) && (c !=
'>') )
716assert(beg < (
int)(
sizeof(key) /
sizeof(*key)));
719 switch(key[beg].what)
732 xmlError(ppos,
"Can't create new node");
764assert(ppos !=
NULL);
767 xmlError(ppos,
"Missing name in endtag");
774 xmlError(ppos,
"Missing '>' in endtag");
779 if( strcmp(name,
topPstack(ppos)->name) )
781 xmlError(ppos,
"Name of endtag does not match starttag");
806assert(ppos !=
NULL);
811 xmlError(ppos,
"Missing name in tagstart");
819 xmlError(ppos,
"Can't create new node");
843assert(ppos !=
NULL);
892assert(ppos !=
NULL);
897 if( (c ==
'/') || (c ==
'>') || (c == EOF) )
907 xmlError(ppos,
"Unexpected EOF while in a tag");
920 xmlError(ppos,
"Expected tag end marker '>'");
931 xmlError(ppos,
"No name for attribute");
940 xmlError(ppos,
"Missing attribute value");
949 xmlError(ppos,
"Can't create new attribute");
975assert(ppos !=
NULL);
978#ifndef SPEC_LIKE_SPACE_HANDLING 985 while( (c != EOF) && (c !=
'<') )
987 if( len + 1 >= size )
1000assert(data !=
NULL);
1001assert(size > len + 1);
1003data[len++] = (char)c;
1032 xmlError(ppos,
"Can't create new node");
1059 switch(ppos->
state)
1077 xmlError(ppos,
"Internal Error, illegal state");
1086 const char* filename
1097assert( filename !=
NULL);
1098filenamelen = strlen(filename);
1103#ifdef SCIP_WITH_ZLIB 1104 if( access(filename, R_OK) != 0 )
1106strcat(myfilename,
".gz");
1111 if( access(myfilename, R_OK) != 0 )
1112(void)
SCIPstrncpy(myfilename, filename, (
int)filenamelen + 5);
1115ppos.
fp=
FOPEN(myfilename,
"r");
1121ppos.
buf[0] =
'\0';
1132 xmlError(&ppos,
"Can't create new node");
1136attr =
xmlNewAttr(
"filename", myfilename);
1138 xmlError(&ppos,
"Can't create new attribute");
1153 if( ! result && (node !=
NULL) )
1155 xmlErrmsg(&ppos,
"Parsing error, processing stopped",
TRUE, __FILE__, __LINE__);
1183assert(name !=
NULL);
1202assert(name !=
NULL);
1203assert(value !=
NULL);
1221assert(
a!=
NULL);
1223 a->next = n->attrlist;
1233assert(parent !=
NULL);
1234assert(child !=
NULL);
1236child->parent = parent;
1237child->prevsibl = parent->lastchild;
1238child->nextsibl =
NULL;
1239parent->lastchild = child;
1241 if( child->prevsibl !=
NULL)
1242child->prevsibl->nextsibl = child;
1244 if( parent->firstchild ==
NULL)
1245parent->firstchild = child;
1265assert(
a->value !=
NULL);
1287n = node->lastchild;
1298 if( node->data !=
NULL)
1302assert(node->name !=
NULL);
1316assert(root !=
NULL);
1318 for(n = root; n !=
NULL; n = n->nextsibl)
1324 for(
a= n->attrlist;
a!=
NULL;
a=
a->next)
1327 if( n->firstchild !=
NULL)
1344assert(node !=
NULL);
1345assert(name !=
NULL);
1347 for(
a= node->attrlist;
a!=
NULL;
a=
a->next)
1349 if( ! strcmp(name,
a->
name) )
1355 infoMessage(
"Error: Attribute %s in TAG <%s> not found\n", name, node->name);
1369assert(node !=
NULL);
1370assert(name !=
NULL);
1372 for(n = node; n !=
NULL; n = n->nextsibl)
1374 if( ! strcmp(name, n->name) )
1387assert(node !=
NULL);
1388assert(name !=
NULL);
1402assert(node !=
NULL);
1403assert(name !=
NULL);
1405 if( ! strcmp(name, node->name) )
1408 for(n = node->firstchild; n !=
NULL; n = n->nextsibl)
1429assert(node !=
NULL);
1430assert(name !=
NULL);
1432 if( ! strcmp(name, node->name) )
1435 if( depth < maxdepth )
1437 for(n = node->firstchild; n !=
NULL; n = n->nextsibl)
1453assert(node !=
NULL);
1455 returnnode->nextsibl;
1463assert(node !=
NULL);
1465 returnnode->prevsibl;
1473assert(node !=
NULL);
1475 returnnode->firstchild;
1483assert(node !=
NULL);
1485 returnnode->lastchild;
1493assert(node !=
NULL);
1503assert(node !=
NULL);
1505 returnnode->lineno;
1513assert(node !=
NULL);
1526assert(node !=
NULL);
1527assert(name !=
NULL);
1533 if( ! strcmp(n->firstchild->name,
"#PCDATA") )
1534 returnn->firstchild->data;
int SCIPstrncpy(char *t, const char *s, int size)
memory allocation routines
#define BMSfreeMemory(ptr)
#define BMSreallocMemoryArray(ptr, num)
#define BMSduplicateMemoryArray(ptr, source, num)
#define BMSclearMemory(ptr)
#define BMSallocMemoryArray(ptr, num)
#define BMSfreeMemoryArray(ptr)
#define BMScopyMemoryArray(ptr, source, num)
#define BMSallocMemory(ptr)
internal miscellaneous methods
declarations for XML parsing
struct XML_ATTR_struct XML_ATTR
struct XML_NODE_struct XML_NODE
definitions for XML parsing
#define FGETS(buf, len, fp)
#define FOPEN(file, mode)
#define FREAD(buf, len, fp)
static void ungetsymbol(PPOS *ppos, int c)
static XML_Bool pushPstack(PPOS *ppos, XML_NODE *node)
const XML_NODE * xmlFirstChild(const XML_NODE *node)
const XML_NODE * xmlFindNodeMaxdepth(const XML_NODE *node, const char *name, int depth, int maxdepth)
void xmlAddAttr(XML_NODE *n, XML_ATTR *a)
const XML_NODE * xmlFirstNode(const XML_NODE *node, const char *name)
static XML_Bool xmlParse(PPOS *ppos)
static void handlePi(PPOS *ppos)
const XML_NODE * xmlNextNode(const XML_NODE *node, const char *name)
const XML_NODE * xmlPrevSibl(const XML_NODE *node)
static int mygetc(PPOS *ppos)
void xmlAppendChild(XML_NODE *parent, XML_NODE *child)
static XML_Bool doComment(PPOS *ppos)
XML_NODE * xmlNewNode(const char *name, int lineno)
const char * xmlGetName(const XML_NODE *node)
XML_ATTR * xmlNewAttr(const char *name, const char *value)
const XML_NODE * xmlLastChild(const XML_NODE *node)
static void xmlErrmsg(PPOS *ppos, const char *msg, XML_Bool msg_only, const char *file, int line)
static char * doCdata(PPOS *ppos)
const XML_NODE * xmlFindNode(const XML_NODE *node, const char *name)
const char * xmlGetAttrval(const XML_NODE *node, const char *name)
static int getsymbol(PPOS *ppos)
static XML_Bool popPstack(PPOS *ppos)
static void handleStarttag(PPOS *ppos)
static void procPcdata(PPOS *ppos)
static void handleDecl(PPOS *ppos)
enum parse_state_enum PSTATE
static int skipSpace(PPOS *ppos)
void xmlShowNode(const XML_NODE *root)
static void clearPstack(PPOS *ppos)
const char * xmlFindPcdata(const XML_NODE *node, const char *name)
const XML_NODE * xmlNextSibl(const XML_NODE *node)
static char * getName(PPOS *ppos)
static void xmlFreeAttr(XML_ATTR *attr)
static void handleEndtag(PPOS *ppos)
XML_NODE * xmlProcess(const char *filename)
const char * xmlGetData(const XML_NODE *node)
static XML_NODE * topPstack(const PPOS *ppos)
static void procInTag(PPOS *ppos)
static char * getAttrval(PPOS *ppos)
int xmlGetLine(const XML_NODE *node)
void xmlFreeNode(XML_NODE *node)
static void procBefore(PPOS *ppos)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4