1
0
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:
Daniel Veillard
2002-01-20 22:08:18 +00:00
parent 0f5f162eeb
commit 963d2ae415
16 changed files with 254 additions and 65 deletions

View File

@ -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>
* doc/xmlcatalog_man.xml xmlcatalog.c: Fixed bug #68830, xmlcatalog

View File

@ -847,18 +847,6 @@ static const char *docbStartClose[] = {
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 int docbStartCloseIndexinitialized = 0;

13
SAX.c
View File

@ -1062,14 +1062,14 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
((attr->prefix == NULL) &&
(xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
(ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
xmlChar buffer[100];
const xmlChar *fulln = attr->name;
xmlChar *fulln;
if (attr->prefix != NULL) {
snprintf((char *) buffer, 99, "%s:%s",
attr->prefix, attr->name);
buffer[99] = 0;
fulln = buffer;
fulln = xmlStrdup(attr->prefix);
fulln = xmlStrcat(fulln, BAD_CAST ":");
fulln = xmlStrcat(fulln, attr->name);
} else {
fulln = xmlStrdup(attr->name);
}
/*
@ -1089,6 +1089,7 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
}
if (att == NULL)
attribute(ctxt, fulln, attr->defaultValue);
xmlFree(fulln);
}
}
attr = attr->nexth;

View File

@ -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 );
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
gtkdoc-mktmpl --module=libxml

View File

@ -102,7 +102,8 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
xmlNodePtr node,
xmlNodePtr node2);
void xmlShellPrintXPathError (int errorType, const char* arg);
void xmlShellPrintXPathError (int errorType,
const char *arg);
void xmlShellPrintNode (xmlNodePtr node);
void xmlShellPrintXPathResult(xmlXPathObjectPtr list);
int xmlShellList (xmlShellCtxtPtr ctxt,

View File

@ -52,7 +52,9 @@ typedef void (*ftpListCallback) (void *userData,
*
* 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

View File

@ -550,14 +550,14 @@ xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
* Node infos
*/
const xmlParserNodeInfo*
xmlParserFindNodeInfo (const xmlParserCtxt* ctxt,
const xmlNode* node);
xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
const xmlNodePtr node);
void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
const xmlNode* node);
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
const xmlNodePtr node);
void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
const xmlParserNodeInfo* info);
const xmlParserNodeInfoPtr info);
/*
* External entities handling actually implemented in xmlIO

View File

@ -335,8 +335,7 @@ void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
/*
* Function Lookup forwarding
*/
typedef xmlXPathFunction
(*xmlXPathFuncLookupFunc) (void *ctxt,
typedef xmlXPathFunction xmlXPathFuncLookupFunc (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);

185
parsedecl.py Executable file
View 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)

View File

@ -2378,8 +2378,8 @@ xmlClearParserCtxt(xmlParserCtxtPtr ctxt)
*
* Returns an xmlParserNodeInfo block pointer or NULL
*/
const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxt* ctx,
const xmlNode* node)
const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx,
const xmlNodePtr node)
{
unsigned long pos;
@ -2433,8 +2433,8 @@ xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
*
* Returns a long indicating the position of the record
*/
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
const xmlNode* node)
unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
const xmlNodePtr node)
{
unsigned long upper, lower, middle;
int found = 0;
@ -2470,13 +2470,14 @@ unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
*/
void
xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
const xmlParserNodeInfo* info)
const xmlParserNodeInfoPtr info)
{
unsigned long pos;
static unsigned int block_size = 5;
/* 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
&& ctxt->node_seq.buffer[pos].node == info->node ) {
ctxt->node_seq.buffer[pos] = *info;

10
xpath.c
View File

@ -2291,9 +2291,10 @@ xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) {
if (ctxt->funcLookupFunc != NULL) {
xmlXPathFunction ret;
xmlXPathFuncLookupFunc *f;
ret = ((xmlXPathFuncLookupFunc) ctxt->funcLookupFunc)
(ctxt->funcLookupData, name, NULL);
f = (xmlXPathFuncLookupFunc *) ctxt->funcLookupFunc;
ret = f(ctxt->funcLookupData, name, NULL);
if (ret != NULL)
return(ret);
}
@ -2321,9 +2322,10 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
if (ctxt->funcLookupFunc != NULL) {
xmlXPathFunction ret;
xmlXPathFuncLookupFunc *f;
ret = ((xmlXPathFuncLookupFunc) ctxt->funcLookupFunc)
(ctxt->funcLookupData, name, ns_uri);
f = (xmlXPathFuncLookupFunc *) ctxt->funcLookupFunc;
ret = f(ctxt->funcLookupData, name, ns_uri);
if (ret != NULL)
return(ret);
}