mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
cleanup patch from Anthony Jones fix the headers to avoid in make scan
* SAX.c: cleanup patch from Anthony Jones * doc/Makefile.am: fix the headers to avoid in make scan * parserInternals.c xpath.c include/libxml/*.h: cleanup of the includes, * vs Ptr and general cleanup * parsedecl.py: first version of a script to extract the module interfaces, the goal will be to provide .decl or XML specification of the interfaces to build wrappers. Daniel
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Sun Jan 20 23:03:41 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* SAX.c: cleanup patch from Anthony Jones
|
||||||
|
* doc/Makefile.am: fix the headers to avoid in make scan
|
||||||
|
* parserInternals.c xpath.c include/libxml/*.h: cleanup of the
|
||||||
|
includes, * vs Ptr and general cleanup
|
||||||
|
* parsedecl.py: first version of a script to extract the
|
||||||
|
module interfaces, the goal will be to provide .decl or XML
|
||||||
|
specification of the interfaces to build wrappers.
|
||||||
|
|
||||||
Sun Jan 20 13:38:22 CET 2002 Daniel Veillard <daniel@veillard.com>
|
Sun Jan 20 13:38:22 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* doc/xmlcatalog_man.xml xmlcatalog.c: Fixed bug #68830, xmlcatalog
|
* doc/xmlcatalog_man.xml xmlcatalog.c: Fixed bug #68830, xmlcatalog
|
||||||
|
12
DOCBparser.c
12
DOCBparser.c
@ -847,18 +847,6 @@ static const char *docbStartClose[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* The list of SGML elements which are supposed not to have
|
|
||||||
* CDATA content and where a p element will be implied
|
|
||||||
*
|
|
||||||
* TODO: extend that list by reading the SGML SGML DTD on
|
|
||||||
* implied paragraph
|
|
||||||
*/
|
|
||||||
static char *docbNoContentElements[] = {
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const char** docbStartCloseIndex[100];
|
static const char** docbStartCloseIndex[100];
|
||||||
static int docbStartCloseIndexinitialized = 0;
|
static int docbStartCloseIndexinitialized = 0;
|
||||||
|
|
||||||
|
13
SAX.c
13
SAX.c
@ -1062,14 +1062,14 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
|||||||
((attr->prefix == NULL) &&
|
((attr->prefix == NULL) &&
|
||||||
(xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
|
(xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
|
||||||
(ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
|
(ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
|
||||||
xmlChar buffer[100];
|
xmlChar *fulln;
|
||||||
const xmlChar *fulln = attr->name;
|
|
||||||
|
|
||||||
if (attr->prefix != NULL) {
|
if (attr->prefix != NULL) {
|
||||||
snprintf((char *) buffer, 99, "%s:%s",
|
fulln = xmlStrdup(attr->prefix);
|
||||||
attr->prefix, attr->name);
|
fulln = xmlStrcat(fulln, BAD_CAST ":");
|
||||||
buffer[99] = 0;
|
fulln = xmlStrcat(fulln, attr->name);
|
||||||
fulln = buffer;
|
} else {
|
||||||
|
fulln = xmlStrdup(attr->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1089,6 +1089,7 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
|||||||
}
|
}
|
||||||
if (att == NULL)
|
if (att == NULL)
|
||||||
attribute(ctxt, fulln, attr->defaultValue);
|
attribute(ctxt, fulln, attr->defaultValue);
|
||||||
|
xmlFree(fulln);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attr = attr->nexth;
|
attr = attr->nexth;
|
||||||
|
@ -26,7 +26,7 @@ $(PAGES): xml.html site.xsl
|
|||||||
$(bindir)/xsltproc --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/xml.html > index.html ; fi );
|
$(bindir)/xsltproc --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/xml.html > index.html ; fi );
|
||||||
|
|
||||||
scan:
|
scan:
|
||||||
gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h xmlwin32version.h win32config.h trio.h strio.h triop.h"
|
gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h xmlwin32version.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h"
|
||||||
|
|
||||||
templates: scan
|
templates: scan
|
||||||
gtkdoc-mktmpl --module=libxml
|
gtkdoc-mktmpl --module=libxml
|
||||||
|
@ -30,9 +30,9 @@ typedef xmlNodePtr docbNodePtr;
|
|||||||
/*
|
/*
|
||||||
* There is only few public functions.
|
* There is only few public functions.
|
||||||
*/
|
*/
|
||||||
int docbEncodeEntities(unsigned char* out,
|
int docbEncodeEntities(unsigned char *out,
|
||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char *in,
|
||||||
int *inlen, int quoteChar);
|
int *inlen, int quoteChar);
|
||||||
|
|
||||||
docbDocPtr docbSAXParseDoc (xmlChar *cur,
|
docbDocPtr docbSAXParseDoc (xmlChar *cur,
|
||||||
|
@ -58,16 +58,16 @@ struct _htmlEntityDesc {
|
|||||||
/*
|
/*
|
||||||
* There is only few public functions.
|
* There is only few public functions.
|
||||||
*/
|
*/
|
||||||
const htmlElemDesc * htmlTagLookup (const xmlChar *tag);
|
const htmlElemDesc * htmlTagLookup (const xmlChar *tag);
|
||||||
const htmlEntityDesc * htmlEntityLookup(const xmlChar *name);
|
const htmlEntityDesc * htmlEntityLookup(const xmlChar *name);
|
||||||
const htmlEntityDesc * htmlEntityValueLookup(unsigned int value);
|
const htmlEntityDesc * htmlEntityValueLookup(unsigned int value);
|
||||||
|
|
||||||
int htmlIsAutoClosed(htmlDocPtr doc,
|
int htmlIsAutoClosed(htmlDocPtr doc,
|
||||||
htmlNodePtr elem);
|
htmlNodePtr elem);
|
||||||
int htmlAutoCloseTag(htmlDocPtr doc,
|
int htmlAutoCloseTag(htmlDocPtr doc,
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
htmlNodePtr elem);
|
htmlNodePtr elem);
|
||||||
const htmlEntityDesc * htmlParseEntityRef(htmlParserCtxtPtr ctxt,
|
const htmlEntityDesc * htmlParseEntityRef(htmlParserCtxtPtr ctxt,
|
||||||
xmlChar **str);
|
xmlChar **str);
|
||||||
int htmlParseCharRef(htmlParserCtxtPtr ctxt);
|
int htmlParseCharRef(htmlParserCtxtPtr ctxt);
|
||||||
void htmlParseElement(htmlParserCtxtPtr ctxt);
|
void htmlParseElement(htmlParserCtxtPtr ctxt);
|
||||||
@ -84,13 +84,13 @@ htmlDocPtr htmlSAXParseFile(const char *filename,
|
|||||||
void *userData);
|
void *userData);
|
||||||
htmlDocPtr htmlParseFile (const char *filename,
|
htmlDocPtr htmlParseFile (const char *filename,
|
||||||
const char *encoding);
|
const char *encoding);
|
||||||
int UTF8ToHtml (unsigned char* out,
|
int UTF8ToHtml (unsigned char *out,
|
||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char *in,
|
||||||
int *inlen);
|
int *inlen);
|
||||||
int htmlEncodeEntities(unsigned char* out,
|
int htmlEncodeEntities(unsigned char *out,
|
||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char *in,
|
||||||
int *inlen, int quoteChar);
|
int *inlen, int quoteChar);
|
||||||
int htmlIsScriptAttribute(const xmlChar *name);
|
int htmlIsScriptAttribute(const xmlChar *name);
|
||||||
int htmlHandleOmittedElem(int val);
|
int htmlHandleOmittedElem(int val);
|
||||||
|
@ -63,7 +63,7 @@ const xmlChar * htmlGetMetaEncoding (htmlDocPtr doc);
|
|||||||
int htmlSetMetaEncoding (htmlDocPtr doc,
|
int htmlSetMetaEncoding (htmlDocPtr doc,
|
||||||
const xmlChar *encoding);
|
const xmlChar *encoding);
|
||||||
void htmlDocDumpMemory (xmlDocPtr cur,
|
void htmlDocDumpMemory (xmlDocPtr cur,
|
||||||
xmlChar**mem,
|
xmlChar **mem,
|
||||||
int *size);
|
int *size);
|
||||||
int htmlDocDump (FILE *f,
|
int htmlDocDump (FILE *f,
|
||||||
xmlDocPtr cur);
|
xmlDocPtr cur);
|
||||||
|
@ -102,7 +102,8 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
|
|||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlNodePtr node2);
|
xmlNodePtr node2);
|
||||||
|
|
||||||
void xmlShellPrintXPathError (int errorType, const char* arg);
|
void xmlShellPrintXPathError (int errorType,
|
||||||
|
const char *arg);
|
||||||
void xmlShellPrintNode (xmlNodePtr node);
|
void xmlShellPrintNode (xmlNodePtr node);
|
||||||
void xmlShellPrintXPathResult(xmlXPathObjectPtr list);
|
void xmlShellPrintXPathResult(xmlXPathObjectPtr list);
|
||||||
int xmlShellList (xmlShellCtxtPtr ctxt,
|
int xmlShellList (xmlShellCtxtPtr ctxt,
|
||||||
|
@ -96,8 +96,8 @@ typedef enum {
|
|||||||
* as the return value is positive, else unpredictiable.
|
* as the return value is positive, else unpredictiable.
|
||||||
* The value of @outlen after return is the number of octets consumed.
|
* The value of @outlen after return is the number of octets consumed.
|
||||||
*/
|
*/
|
||||||
typedef int (* xmlCharEncodingInputFunc)(unsigned char* out, int *outlen,
|
typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
|
||||||
const unsigned char* in, int *inlen);
|
const unsigned char *in, int *inlen);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,8 +118,8 @@ typedef int (* xmlCharEncodingInputFunc)(unsigned char* out, int *outlen,
|
|||||||
* as the return value is positive, else unpredictiable.
|
* as the return value is positive, else unpredictiable.
|
||||||
* The value of @outlen after return is the number of ocetes consumed.
|
* The value of @outlen after return is the number of ocetes consumed.
|
||||||
*/
|
*/
|
||||||
typedef int (* xmlCharEncodingOutputFunc)(unsigned char* out, int *outlen,
|
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
|
||||||
const unsigned char* in, int *inlen);
|
const unsigned char *in, int *inlen);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -161,15 +161,15 @@ const char *
|
|||||||
xmlGetEncodingAlias (const char *alias);
|
xmlGetEncodingAlias (const char *alias);
|
||||||
void xmlCleanupEncodingAliases (void);
|
void xmlCleanupEncodingAliases (void);
|
||||||
xmlCharEncoding
|
xmlCharEncoding
|
||||||
xmlParseCharEncoding (const char* name);
|
xmlParseCharEncoding (const char *name);
|
||||||
const char*
|
const char *
|
||||||
xmlGetCharEncodingName (xmlCharEncoding enc);
|
xmlGetCharEncodingName (xmlCharEncoding enc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interfaces directly used by the parsers.
|
* Interfaces directly used by the parsers.
|
||||||
*/
|
*/
|
||||||
xmlCharEncoding
|
xmlCharEncoding
|
||||||
xmlDetectCharEncoding (const unsigned char* in,
|
xmlDetectCharEncoding (const unsigned char *in,
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
int xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
|
int xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
|
||||||
@ -187,13 +187,13 @@ int xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
|
|||||||
/*
|
/*
|
||||||
* Export a few useful functions
|
* Export a few useful functions
|
||||||
*/
|
*/
|
||||||
int UTF8Toisolat1 (unsigned char* out,
|
int UTF8Toisolat1 (unsigned char *out,
|
||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char *in,
|
||||||
int *inlen);
|
int *inlen);
|
||||||
int isolat1ToUTF8 (unsigned char* out,
|
int isolat1ToUTF8 (unsigned char *out,
|
||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char *in,
|
||||||
int *inlen);
|
int *inlen);
|
||||||
/*
|
/*
|
||||||
* exports additional "UTF-8 aware" string routines which are
|
* exports additional "UTF-8 aware" string routines which are
|
||||||
|
@ -39,7 +39,7 @@ extern "C" {
|
|||||||
* Note that only one of year and day:minute are specified
|
* Note that only one of year and day:minute are specified
|
||||||
*/
|
*/
|
||||||
typedef void (*ftpListCallback) (void *userData,
|
typedef void (*ftpListCallback) (void *userData,
|
||||||
const char *filename, const char* attrib,
|
const char *filename, const char *attrib,
|
||||||
const char *owner, const char *group,
|
const char *owner, const char *group,
|
||||||
unsigned long size, int links, int year,
|
unsigned long size, int links, int year,
|
||||||
const char *month, int day, int hour,
|
const char *month, int day, int hour,
|
||||||
@ -52,7 +52,9 @@ typedef void (*ftpListCallback) (void *userData,
|
|||||||
*
|
*
|
||||||
* A callback for the xmlNanoFTPGet command
|
* A callback for the xmlNanoFTPGet command
|
||||||
*/
|
*/
|
||||||
typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
|
typedef void (*ftpDataCallback) (void *userData,
|
||||||
|
const char *data,
|
||||||
|
int len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init
|
* Init
|
||||||
|
@ -502,7 +502,7 @@ void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
|
|||||||
void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
|
void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
|
||||||
void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
|
void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
|
||||||
const xmlChar* buffer,
|
const xmlChar* buffer,
|
||||||
const char* filename);
|
const char *filename);
|
||||||
xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
|
xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -550,14 +550,14 @@ xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
|
|||||||
* Node infos
|
* Node infos
|
||||||
*/
|
*/
|
||||||
const xmlParserNodeInfo*
|
const xmlParserNodeInfo*
|
||||||
xmlParserFindNodeInfo (const xmlParserCtxt* ctxt,
|
xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
|
||||||
const xmlNode* node);
|
const xmlNodePtr node);
|
||||||
void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
|
void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
|
||||||
void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
|
void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
|
||||||
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
|
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
|
||||||
const xmlNode* node);
|
const xmlNodePtr node);
|
||||||
void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
|
void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
|
||||||
const xmlParserNodeInfo* info);
|
const xmlParserNodeInfoPtr info);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* External entities handling actually implemented in xmlIO
|
* External entities handling actually implemented in xmlIO
|
||||||
|
@ -787,11 +787,11 @@ int xmlReconciliateNs (xmlDocPtr doc,
|
|||||||
* Saving
|
* Saving
|
||||||
*/
|
*/
|
||||||
void xmlDocDumpFormatMemory (xmlDocPtr cur,
|
void xmlDocDumpFormatMemory (xmlDocPtr cur,
|
||||||
xmlChar**mem,
|
xmlChar **mem,
|
||||||
int *size,
|
int *size,
|
||||||
int format);
|
int format);
|
||||||
void xmlDocDumpMemory (xmlDocPtr cur,
|
void xmlDocDumpMemory (xmlDocPtr cur,
|
||||||
xmlChar**mem,
|
xmlChar **mem,
|
||||||
int *size);
|
int *size);
|
||||||
void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
|
void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
|
||||||
xmlChar **doc_txt_ptr,
|
xmlChar **doc_txt_ptr,
|
||||||
|
@ -335,8 +335,7 @@ void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
|
|||||||
/*
|
/*
|
||||||
* Function Lookup forwarding
|
* Function Lookup forwarding
|
||||||
*/
|
*/
|
||||||
typedef xmlXPathFunction
|
typedef xmlXPathFunction xmlXPathFuncLookupFunc (void *ctxt,
|
||||||
(*xmlXPathFuncLookupFunc) (void *ctxt,
|
|
||||||
const xmlChar *name,
|
const xmlChar *name,
|
||||||
const xmlChar *ns_uri);
|
const xmlChar *ns_uri);
|
||||||
|
|
||||||
@ -448,7 +447,7 @@ int valuePush (xmlXPathParserContextPtr ctxt,
|
|||||||
xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val);
|
xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val);
|
||||||
xmlXPathObjectPtr xmlXPathNewCString (const char *val);
|
xmlXPathObjectPtr xmlXPathNewCString (const char *val);
|
||||||
xmlXPathObjectPtr xmlXPathWrapString (xmlChar *val);
|
xmlXPathObjectPtr xmlXPathWrapString (xmlChar *val);
|
||||||
xmlXPathObjectPtr xmlXPathWrapCString (char *val);
|
xmlXPathObjectPtr xmlXPathWrapCString (char * val);
|
||||||
xmlXPathObjectPtr xmlXPathNewFloat (double val);
|
xmlXPathObjectPtr xmlXPathNewFloat (double val);
|
||||||
xmlXPathObjectPtr xmlXPathNewBoolean (int val);
|
xmlXPathObjectPtr xmlXPathNewBoolean (int val);
|
||||||
xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
|
xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
|
||||||
|
185
parsedecl.py
Executable file
185
parsedecl.py
Executable file
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/python -u
|
||||||
|
#
|
||||||
|
# tries to parse the output of gtk-doc declaration files and make
|
||||||
|
# something usable from them
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import string
|
||||||
|
|
||||||
|
input = open('doc/libxml-decl.txt')
|
||||||
|
macros = []
|
||||||
|
structs = []
|
||||||
|
typedefs = []
|
||||||
|
enums = {}
|
||||||
|
functions = {}
|
||||||
|
private_functions = {}
|
||||||
|
types = {}
|
||||||
|
|
||||||
|
def extractTypes(raw, function):
|
||||||
|
global types
|
||||||
|
|
||||||
|
tokens = string.split(raw)
|
||||||
|
type = ''
|
||||||
|
for token in tokens:
|
||||||
|
if type != '':
|
||||||
|
type = type + ' ' + token
|
||||||
|
else:
|
||||||
|
type = token
|
||||||
|
if types.has_key(type):
|
||||||
|
types[type].append(function)
|
||||||
|
else:
|
||||||
|
types[type] = [function]
|
||||||
|
return type
|
||||||
|
|
||||||
|
def parseMacro():
|
||||||
|
global input
|
||||||
|
global macros
|
||||||
|
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
while line != "</MACRO>":
|
||||||
|
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
|
||||||
|
name = line[6:-7]
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
|
||||||
|
macros.append(name)
|
||||||
|
|
||||||
|
def parseStruct():
|
||||||
|
global input
|
||||||
|
global structs
|
||||||
|
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
while line != "</STRUCT>":
|
||||||
|
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
|
||||||
|
name = line[6:-7]
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
|
||||||
|
structs.append(name)
|
||||||
|
|
||||||
|
def parseTypedef():
|
||||||
|
global input
|
||||||
|
global typedefs
|
||||||
|
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
while line != "</TYPEDEF>":
|
||||||
|
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
|
||||||
|
name = line[6:-7]
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
|
||||||
|
typedefs.append(name)
|
||||||
|
|
||||||
|
def parseEnum():
|
||||||
|
global input
|
||||||
|
global enums
|
||||||
|
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
consts = []
|
||||||
|
while line != "</ENUM>":
|
||||||
|
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
|
||||||
|
name = line[6:-7]
|
||||||
|
elif string.find(line, 'enum') >= 0:
|
||||||
|
pass
|
||||||
|
elif string.find(line, '{') >= 0:
|
||||||
|
pass
|
||||||
|
elif string.find(line, '}') >= 0:
|
||||||
|
pass
|
||||||
|
elif string.find(line, ';') >= 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
comment = string.find(line, '/*')
|
||||||
|
if comment >= 0:
|
||||||
|
line = line[0:comment]
|
||||||
|
decls = string.split(line, ",")
|
||||||
|
for decl in decls:
|
||||||
|
val = string.split(decl, "=")[0]
|
||||||
|
tokens = string.split(val)
|
||||||
|
if len(tokens) >= 1:
|
||||||
|
token = tokens[0]
|
||||||
|
if string.find(string.letters, token[0]) >= 0:
|
||||||
|
consts.append(token)
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
|
||||||
|
enums[name] = consts
|
||||||
|
|
||||||
|
def parseStaticFunction():
|
||||||
|
global input
|
||||||
|
global private_functions
|
||||||
|
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
type = None
|
||||||
|
signature = None
|
||||||
|
while line != "</USER_FUNCTION>":
|
||||||
|
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
|
||||||
|
name = line[6:-7]
|
||||||
|
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
|
||||||
|
type = extractTypes(line[9:-10], name)
|
||||||
|
else:
|
||||||
|
signature = line
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
|
||||||
|
args = string.split(signature, ",")
|
||||||
|
sig = []
|
||||||
|
for arg in args:
|
||||||
|
l = string.split(arg)
|
||||||
|
sig.append(extractTypes(l[0], name))
|
||||||
|
|
||||||
|
private_functions[name] = (type , sig)
|
||||||
|
|
||||||
|
def parseFunction():
|
||||||
|
global input
|
||||||
|
global functions
|
||||||
|
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
type = None
|
||||||
|
signature = None
|
||||||
|
while line != "</FUNCTION>":
|
||||||
|
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
|
||||||
|
name = line[6:-7]
|
||||||
|
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
|
||||||
|
type = extractTypes(line[9:-10], name)
|
||||||
|
else:
|
||||||
|
signature = line
|
||||||
|
line = input.readline()[:-1]
|
||||||
|
|
||||||
|
args = string.split(signature, ",")
|
||||||
|
sig = []
|
||||||
|
for arg in args:
|
||||||
|
l = string.split(arg)
|
||||||
|
sig.append(extractTypes(l[0], name))
|
||||||
|
|
||||||
|
functions[name] = (type , sig)
|
||||||
|
|
||||||
|
while 1:
|
||||||
|
line = input.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
line = line[:-1]
|
||||||
|
if line == "<MACRO>":
|
||||||
|
parseMacro()
|
||||||
|
elif line == "<ENUM>":
|
||||||
|
parseEnum()
|
||||||
|
elif line == "<FUNCTION>":
|
||||||
|
parseFunction()
|
||||||
|
elif line == "<STRUCT>":
|
||||||
|
parseStruct()
|
||||||
|
elif line == "<TYPEDEF>":
|
||||||
|
parseTypedef()
|
||||||
|
elif line == "<USER_FUNCTION>":
|
||||||
|
parseStaticFunction()
|
||||||
|
elif len(line) >= 1 and line[0] == "<":
|
||||||
|
print "unhandled %s" % (line)
|
||||||
|
|
||||||
|
print "Parsed: %d macros. %d structs, %d typedefs, %d enums" % (
|
||||||
|
len(macros), len(structs), len(typedefs), len(enums))
|
||||||
|
c = 0
|
||||||
|
for enum in enums.keys():
|
||||||
|
consts = enums[enum]
|
||||||
|
c = c + len(consts)
|
||||||
|
print " %d constants, %d functions and %d private functions" % (
|
||||||
|
c, len(functions.keys()), len(private_functions.keys()))
|
||||||
|
print "The functions uses %d different types" % (len(types.keys()))
|
||||||
|
for type in types.keys():
|
||||||
|
if string.find(type, '*') >= 0 or (type[0:3] != 'xml' and
|
||||||
|
type[0:4] != 'html' and type[0:4] != 'docb'):
|
||||||
|
# print " %s : %s" % (type, types[type])
|
||||||
|
print " %s" % (type)
|
@ -2378,8 +2378,8 @@ xmlClearParserCtxt(xmlParserCtxtPtr ctxt)
|
|||||||
*
|
*
|
||||||
* Returns an xmlParserNodeInfo block pointer or NULL
|
* Returns an xmlParserNodeInfo block pointer or NULL
|
||||||
*/
|
*/
|
||||||
const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxt* ctx,
|
const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx,
|
||||||
const xmlNode* node)
|
const xmlNodePtr node)
|
||||||
{
|
{
|
||||||
unsigned long pos;
|
unsigned long pos;
|
||||||
|
|
||||||
@ -2433,8 +2433,8 @@ xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
|
|||||||
*
|
*
|
||||||
* Returns a long indicating the position of the record
|
* Returns a long indicating the position of the record
|
||||||
*/
|
*/
|
||||||
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
|
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
|
||||||
const xmlNode* node)
|
const xmlNodePtr node)
|
||||||
{
|
{
|
||||||
unsigned long upper, lower, middle;
|
unsigned long upper, lower, middle;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
@ -2470,13 +2470,14 @@ unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
|
xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
|
||||||
const xmlParserNodeInfo* info)
|
const xmlParserNodeInfoPtr info)
|
||||||
{
|
{
|
||||||
unsigned long pos;
|
unsigned long pos;
|
||||||
static unsigned int block_size = 5;
|
static unsigned int block_size = 5;
|
||||||
|
|
||||||
/* Find pos and check to see if node is already in the sequence */
|
/* Find pos and check to see if node is already in the sequence */
|
||||||
pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, info->node);
|
pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (const xmlNodePtr)
|
||||||
|
info->node);
|
||||||
if ( pos < ctxt->node_seq.length
|
if ( pos < ctxt->node_seq.length
|
||||||
&& ctxt->node_seq.buffer[pos].node == info->node ) {
|
&& ctxt->node_seq.buffer[pos].node == info->node ) {
|
||||||
ctxt->node_seq.buffer[pos] = *info;
|
ctxt->node_seq.buffer[pos] = *info;
|
||||||
|
10
xpath.c
10
xpath.c
@ -2291,9 +2291,10 @@ xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) {
|
|||||||
|
|
||||||
if (ctxt->funcLookupFunc != NULL) {
|
if (ctxt->funcLookupFunc != NULL) {
|
||||||
xmlXPathFunction ret;
|
xmlXPathFunction ret;
|
||||||
|
xmlXPathFuncLookupFunc *f;
|
||||||
|
|
||||||
ret = ((xmlXPathFuncLookupFunc) ctxt->funcLookupFunc)
|
f = (xmlXPathFuncLookupFunc *) ctxt->funcLookupFunc;
|
||||||
(ctxt->funcLookupData, name, NULL);
|
ret = f(ctxt->funcLookupData, name, NULL);
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@ -2321,9 +2322,10 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
|
|||||||
|
|
||||||
if (ctxt->funcLookupFunc != NULL) {
|
if (ctxt->funcLookupFunc != NULL) {
|
||||||
xmlXPathFunction ret;
|
xmlXPathFunction ret;
|
||||||
|
xmlXPathFuncLookupFunc *f;
|
||||||
|
|
||||||
ret = ((xmlXPathFuncLookupFunc) ctxt->funcLookupFunc)
|
f = (xmlXPathFuncLookupFunc *) ctxt->funcLookupFunc;
|
||||||
(ctxt->funcLookupData, name, ns_uri);
|
ret = f(ctxt->funcLookupData, name, ns_uri);
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user