49#if defined(_WIN32) || defined(_WIN64)
64#define NAME_EXT_SIZE 128
65#define ATTR_EXT_SIZE 4096
66#define DATA_EXT_SIZE 4096
67#define LINE_BUF_SIZE 8192
69#define xmlError(a, b) xmlErrmsg(a, b, FALSE, __FILE__, __LINE__)
124 ret = fprintf(stderr,
"%s(%d) Error in file %s line %d\n", file, line, ppos->
filename, ppos->
lineno);
127 ret = fprintf(stderr,
"%s", ppos->
buf);
130 if ( strchr(ppos->
buf,
'\n') ==
NULL )
134 retc = fputc(
'\n', stderr);
138 ret = fprintf(stderr,
"%*s\n", ppos->
pos,
"^");
141 ret = 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);
255 if ( ppos->
buf[ppos->
pos] ==
'\0' )
257#ifdef SCIP_DISABLED_CODE
262 size_t len = (size_t)
FREAD(ppos->
buf,
sizeof(ppos->
buf) - 1, ppos->
fp);
264 if( len == 0 || len >
sizeof(ppos->
buf) - 1 )
267 ppos->
buf[len] =
'\0';
271 return (
unsigned char)ppos->
buf[ppos->
pos++];
275#ifdef SPEC_LIKE_SPACE_HANDLING
299 if (((
c ==
'\n') && (ppos->
lastsym ==
'\r')) || ((
c ==
'\r') && (ppos->
lastsym ==
'\n')))
343 if ((
c ==
'\n') || (
c ==
'\r'))
345 }
while((
c ==
' ') && (ppos->
lastsym ==
c));
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 )
431 name[len++] = (char)
c;
474 if ( (
c !=
'"') && (
c !=
'\'') )
476 xmlError(ppos,
"Atribute value does not start with \" or \'");
501 if ( (
c == stop) || (
c == EOF) )
504 attr[len++] = (char)
c;
539 if ( (
c ==
'>') && (state >= 2) )
542 state = (
c ==
'-') ? state + 1 : 0;
546 xmlError(ppos,
"Unexpected EOF in comment");
580 if ( (
c ==
'>') && (state >= 2) )
601 data[len++] = (char)
c;
611 data[len - 2] =
'\0';
617 xmlError(ppos,
"Unexpected EOF in CDATA");
637 while ( (
c != EOF) && (
c !=
'>') );
643 xmlError(ppos,
"Unexpected EOF in PI");
667 typedef enum XmlSection 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 }
693 end = (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 !=
'>') )
716 assert(beg < (
int)(
sizeof(key) /
sizeof(*key)));
719 switch(key[beg].what)
732 xmlError(ppos,
"Can't create new node");
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");
811 xmlError(ppos,
"Missing name in tagstart");
819 xmlError(ppos,
"Can't create new node");
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");
978#ifndef SPEC_LIKE_SPACE_HANDLING
985 while ( (
c != EOF) && (
c !=
'<') )
987 if ( len + 1 >= size )
1003 data[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
1098 filenamelen = strlen(filename);
1103#ifdef SCIP_WITH_ZLIB
1104 if ( access(filename, R_OK) != 0 )
1106 strcat(myfilename,
".gz");
1111 if ( access(myfilename, R_OK) != 0 )
1112 (void)
SCIPstrncpy(myfilename, filename, (
int)filenamelen + 5);
1115 ppos.
fp =
FOPEN(myfilename,
"r");
1132 xmlError(&ppos,
"Can't create new node");
1138 xmlError(&ppos,
"Can't create new attribute");
1155 xmlErrmsg(&ppos,
"Parsing error, processing stopped",
TRUE, __FILE__, __LINE__);
1223 a->next = n->attrlist;
1236 child->parent = parent;
1237 child->prevsibl = parent->lastchild;
1238 child->nextsibl =
NULL;
1239 parent->lastchild = child;
1241 if ( child->prevsibl !=
NULL )
1242 child->prevsibl->nextsibl = child;
1244 if ( parent->firstchild ==
NULL )
1245 parent->firstchild = child;
1287 n = node->lastchild;
1298 if ( node->data !=
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 )
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);
1372 for (n = node; n !=
NULL; n = n->nextsibl)
1374 if ( ! strcmp(name, n->name) )
1405 if ( ! strcmp(name, node->name) )
1408 for (n = node->firstchild; n !=
NULL; n = n->nextsibl)
1432 if ( ! strcmp(name, node->name) )
1437 for (n = node->firstchild; n !=
NULL; n = n->nextsibl)
1455 return node->nextsibl;
1465 return node->prevsibl;
1475 return node->firstchild;
1485 return node->lastchild;
1505 return node->lineno;
1533 if ( ! strcmp(n->firstchild->name,
"#PCDATA") )
1534 return n->firstchild->data;
int SCIPstrncpy(char *t, const char *s, int size)
assert(minobj< SCIPgetCutoffbound(scip))
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)