diff --git a/ChangeLog b/ChangeLog index ad9d47bf..a689c22e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Jan 21 18:29:19 CET 2002 Daniel Veillard + + * Makefile.am doc/Makefile.am doc/libxml2-api.xml doc/parsedecl.py: + added an XML description of the API, moved the script generating + it here. Added a "make api" target + Mon Jan 21 14:34:37 CET 2002 Daniel Veillard * tree.c: Adam Lounds pointed out a bug in xmlSearchNs() diff --git a/Makefile.am b/Makefile.am index 1b726b89..b604a337 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS=no-dependencies +#AUTOMAKE_OPTIONS=no-dependencies SUBDIRS = include . doc example diff --git a/doc/Makefile.am b/doc/Makefile.am index 4984d617..8c855a11 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.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 libxml.h" templates: scan gtkdoc-mktmpl --module=libxml @@ -34,6 +34,18 @@ templates: scan sgml: gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR) +xml: sgml + if test -d xml ; then rm xml/* ; else mkdir xml ; fi + -@(for s in sgml/*.sgml ; do name=`basename $$s .sgml` ; \ + echo ' ]>' > \ + xml/"$$name".xml ;\ + grep -v "^> xml/"$$name".xml ; done) + +libxml2-api.xml: xml parsedecl.py libxml-decl.txt libxml-decl-list.txt + -./parsedecl.py + +api: libxml2-api.xml + html: if test -n -d html ; then mkdir html ; fi -cd html && gtkdoc-mkhtml libxml ../$(DOC_MAIN_SGML_FILE) @@ -49,7 +61,7 @@ libxml-decl-list.txt : templates libxml-sections.txt : scan cp libxml-decl-list.txt libxml-sections.txt -rebuild: libxml-sections.txt templates sgml html +rebuild: libxml-sections.txt templates sgml html api install-data-local: $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) @@ -59,6 +71,6 @@ install-data-local: -(cd $(DESTDIR); gtkdoc-fixxref --module=libxml --html-dir=$(HTML_DIR)) dist-hook: - (cd $(srcdir) ; tar cvf - *.1 site.xsl *.html *.gif html/*.html html/*.sgml) | (cd $(distdir); tar xf -) + (cd $(srcdir) ; tar cvf - *.1 site.xsl *.html *.gif html/*.html html/*.sgml libxml2-api.xml parsedecl.py) | (cd $(distdir); tar xf -) .PHONY : html sgml templates scan diff --git a/doc/html/book1.html b/doc/html/book1.html index 7fbbcbcb..e69de29b 100644 --- a/doc/html/book1.html +++ b/doc/html/book1.html @@ -1,327 +0,0 @@ -Gnome XML Library Reference Manual

Gnome XML Library Reference Manual

Daniel Veillard

    daniel@veillard.com
-   

Copyright © 1999 by Daniel Veillard

This manual documents the interfaces of the libxml - library and has some short notes to help get you up to speed - with using the library.

Permission is granted to make and distribute verbatim - copies of this manual provided the copyright notice and this - permission notice are preserved on all copies.

Permission is granted to copy and distribute modified - versions of this manual under the conditions for verbatim - copying, provided also that the entire resulting derived work is - distributed under the terms of a permission notice identical to - this one.

Permission is granted to copy and distribute translations - of this manual into another language, under the above conditions - for modified versions.

Table of Contents
Libxml Programming Notes
Libxml Library Reference
parser
SAX
tree
entities
valid
uri
xmlerror
HTMLparser
HTMLtree
xpath
xpathInternals
xpointer
xinclude
nanohttp
nanoftp
xmlIO
catalog
threads
globals
DOCBparser
parserInternals
encoding
hash
debugXML
xmlmemory


   Next Page >>>
 Libxml Programming Notes
\ No newline at end of file diff --git a/doc/html/libxml-lib.html b/doc/html/libxml-lib.html index 14a87fc2..75ca1c32 100644 --- a/doc/html/libxml-lib.html +++ b/doc/html/libxml-lib.html @@ -166,184 +166,4 @@ HREF="libxml-htmltree.html" >xpath
xpathInternals
xpointer
xinclude
nanohttp
nanoftp
xmlIO
catalog
threads
globals
DOCBparser
parserInternals
encoding
hash
debugXML
xmlmemory

This section contains the API reference for libxml. All - the public interfaces are documented here. This reference guide is - build by extracting comments from the code sources.

_functions; -


<<< Previous PageHome Next Page >>>
Libxml Programming Notesparser
\ No newline at end of file +> — \ No newline at end of file diff --git a/doc/html/libxml-parser.html b/doc/html/libxml-parser.html index a253838c..84186429 100644 --- a/doc/html/libxml-parser.html +++ b/doc/html/libxml-parser.html @@ -1167,13 +1167,13 @@ HREF="libxml-parser.html#XMLPARSERFINDNODEINFO" >xmlParserFindNodeInfo (const xmlParserCtxt *ctxt, +HREF="libxml-tree.html#XMLPARSERCTXTPTR" +>xmlParserCtxtPtr ctxt, const xmlNode *node); +HREF="libxml-tree.html#XMLNODEPTR" +>xmlNodePtr node); void xmlInitNodeInfoSeqxmlParserFindNodeInfoIndex (const xmlParserNodeInfoSeq *seq, +HREF="libxml-parser.html#XMLPARSERNODEINFOSEQPTR" +>xmlParserNodeInfoSeqPtr seq, const xmlNode *node); +HREF="libxml-tree.html#XMLNODEPTR" +>xmlNodePtr node); void xmlParserAddNodeInfoxmlParserCtxtPtr ctxt, const xmlParserNodeInfo *info); +HREF="libxml-parser.html#XMLPARSERNODEINFOPTR" +>xmlParserNodeInfoPtr info); void xmlSetExternalEntityLoaderXML_DEFAULT_VERSION>XML_DEFAULT_VERSIONxmlParserInputDeallocate ()>xmlParserInputDeallocate ()
struct xmlParserInput>struct xmlParserInput
struct xmlParserNodeInfo>struct xmlParserNodeInfo
xmlParserNodeInfoPtr>xmlParserNodeInfoPtr
struct xmlParserNodeInfoSeq>struct xmlParserNodeInfoSeq
xmlParserNodeInfoSeqPtr>xmlParserNodeInfoSeqPtr
enum xmlParserInputState>enum xmlParserInputState
XML_DETECT_IDS>XML_DETECT_IDS
XML_COMPLETE_ATTRS>XML_COMPLETE_ATTRS
struct xmlParserCtxt>struct xmlParserCtxt

The parser context. NOTE This doesn't completely defines the parser state, the (current ?) -design of the parser uses recursive function calls since this allow -and easy mapping from the production rules of the specification -to the actual code. The drawback is that the actual function call -also reflect the parser state. However most of the parsing routines -takes as the only argument the parser context pointer, so migrating -to a state based parser for progressive parsing shouldn't be too hard.

struct xmlSAXLocator>struct xmlSAXLocator
xmlSAXLocatorPtr>xmlSAXLocatorPtr
resolveEntitySAXFunc ()>resolveEntitySAXFunc ()
internalSubsetSAXFunc ()>internalSubsetSAXFunc ()
externalSubsetSAXFunc ()>externalSubsetSAXFunc ()
getEntitySAXFunc ()>getEntitySAXFunc ()
getParameterEntitySAXFunc ()>getParameterEntitySAXFunc ()
entityDeclSAXFunc ()>entityDeclSAXFunc ()
notationDeclSAXFunc ()>notationDeclSAXFunc ()
attributeDeclSAXFunc ()>attributeDeclSAXFunc ()
elementDeclSAXFunc ()>elementDeclSAXFunc ()
unparsedEntityDeclSAXFunc ()>unparsedEntityDeclSAXFunc ()
setDocumentLocatorSAXFunc ()>setDocumentLocatorSAXFunc ()
startDocumentSAXFunc ()>startDocumentSAXFunc ()
endDocumentSAXFunc ()>endDocumentSAXFunc ()
startElementSAXFunc ()>startElementSAXFunc ()
endElementSAXFunc ()>endElementSAXFunc ()
attributeSAXFunc ()>attributeSAXFunc ()
referenceSAXFunc ()>referenceSAXFunc ()
charactersSAXFunc ()>charactersSAXFunc ()
ignorableWhitespaceSAXFunc ()>ignorableWhitespaceSAXFunc ()
processingInstructionSAXFunc ()>processingInstructionSAXFunc ()
commentSAXFunc ()>commentSAXFunc ()
cdataBlockSAXFunc ()>cdataBlockSAXFunc ()
warningSAXFunc ()>warningSAXFunc ()
errorSAXFunc ()>errorSAXFunc ()
fatalErrorSAXFunc ()>fatalErrorSAXFunc ()
isStandaloneSAXFunc ()>isStandaloneSAXFunc ()
hasInternalSubsetSAXFunc ()>hasInternalSubsetSAXFunc ()
hasExternalSubsetSAXFunc ()>hasExternalSubsetSAXFunc ()
struct xmlSAXHandler>struct xmlSAXHandler
xmlSAXHandlerPtr>xmlSAXHandlerPtr
xmlExternalEntityLoader ()>xmlExternalEntityLoader ()
xmlSubstituteEntitiesDefaultValue>xmlSubstituteEntitiesDefaultValue
xmlInitParser ()>xmlInitParser ()
xmlCleanupParser ()>xmlCleanupParser ()
xmlParserInputRead ()>xmlParserInputRead ()
xmlParserInputGrow ()>xmlParserInputGrow ()
xmlStrdup ()>xmlStrdup ()
xmlStrndup ()>xmlStrndup ()
xmlCharStrndup ()>xmlCharStrndup ()
xmlCharStrdup ()>xmlCharStrdup ()
xmlStrsub ()>xmlStrsub ()
xmlStrchr ()>xmlStrchr ()
xmlStrstr ()>xmlStrstr ()
xmlStrcasestr ()>xmlStrcasestr ()
xmlStrcmp ()>xmlStrcmp ()
xmlStrncmp ()>xmlStrncmp ()
xmlStrcasecmp ()>xmlStrcasecmp ()
xmlStrncasecmp ()>xmlStrncasecmp ()
xmlStrEqual ()>xmlStrEqual ()
xmlStrlen ()>xmlStrlen ()
xmlStrcat ()>xmlStrcat ()
xmlStrncat ()>xmlStrncat ()
xmlParseDoc ()>xmlParseDoc ()
xmlParseMemory ()>xmlParseMemory ()
xmlParseFile ()>xmlParseFile ()
xmlSubstituteEntitiesDefault ()>xmlSubstituteEntitiesDefault ()
xmlKeepBlanksDefault ()>xmlKeepBlanksDefault ()
xmlStopParser ()>xmlStopParser ()
xmlPedanticParserDefault ()>xmlPedanticParserDefault ()
int         xmlPedanticParserDefault        (int val);

Set and return the previous value for enabling pedantic warnings.

val : int 0 or 1
Returns :the last value for 0 for no substitution, 1 for substitution.


xmlLineNumbersDefault ()

int         xmlLineNumbersDefault           (int val);

Set and return the previous value for enabling line numbers in elements -contents. This may break on old application and is turned off by default.

val : int 0 or 1
Returns :the last value for 0 for no substitution, 1 for substitution.


xmlRecoverDoc ()

xmlDocPtr   xmlRecoverDoc                   (xmlChar *cur);

parse an XML in-memory document and build a tree. -In the case the document is not Well Formed, a tree is built anyway

cur : a pointer to an array of xmlChar
Returns :the resulting document tree


xmlRecoverMemory ()

xmlDocPtr   xmlRecoverMemory                (const char *buffer,
-                                             int size);

parse an XML in-memory block and build a tree. -In the case the document is not Well Formed, a tree is built anyway

buffer : an pointer to a char array
size : the size of the array
Returns :the resulting document tree


xmlRecoverFile ()

xmlDocPtr   xmlRecoverFile                  (const char *filename);

parse an XML file and build a tree. Automatic support for ZLIB/Compress -compressed document is provided by default if found at compile-time. -In the case the document is not Well Formed, a tree is built anyway

filename : the filename
Returns :the resulting document tree


xmlParseDocument ()

int         xmlParseDocument                (xmlParserCtxtPtr ctxt);

parse an XML document (and build a tree if using the standard SAX -interface).

[1] document ::= prolog element Misc*

[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?

ctxt : an XML parser context
Returns :0, -1 in case of error. the parser context is augmented -as a result of the parsing.


xmlParseExtParsedEnt ()

int         xmlParseExtParsedEnt            (xmlParserCtxtPtr ctxt);

parse a general parsed entity -An external general parsed entity is well-formed if it matches the -production labeled extParsedEnt.

[78] extParsedEnt ::= TextDecl? content

ctxt : an XML parser context
Returns :0, -1 in case of error. the parser context is augmented -as a result of the parsing.


xmlSAXParseDoc ()

xmlDocPtr   xmlSAXParseDoc                  (xmlSAXHandlerPtr sax,
-                                             xmlChar *cur,
-                                             int recovery);

parse an XML in-memory document and build a tree. -It use the given SAX function block to handle the parsing callback. -If sax is NULL, fallback to the default DOM tree building routines.

sax : the SAX handler block
cur : a pointer to an array of xmlChar
recovery : work in recovery mode, i.e. tries to read no Well Formed -documents
Returns :the resulting document tree


xmlSAXUserParseFile ()

int         xmlSAXUserParseFile             (xmlSAXHandlerPtr sax,
-                                             void *user_data,
-                                             const char *filename);

parse an XML file and call the given SAX handler routines. -Automatic support for ZLIB/Compress compressed document is provided

sax : a SAX handler
user_data : The user data returned on SAX callbacks
filename : a file name
Returns :0 in case of success or a error number otherwise


xmlSAXUserParseMemory ()

int         xmlSAXUserParseMemory           (xmlSAXHandlerPtr sax,
-                                             void *user_data,
-                                             const char *buffer,
-                                             int size);

A better SAX parsing routine. -parse an XML in-memory buffer and call the given SAX handler routines.

sax : a SAX handler
user_data : The user data returned on SAX callbacks
buffer : an in-memory XML document input
size : the length of the XML document in bytes
Returns :0 in case of success or a error number otherwise


xmlSAXParseMemory ()

xmlDocPtr   xmlSAXParseMemory               (xmlSAXHandlerPtr sax,
-                                             const char *buffer,
-                                             int size,
-                                             int recovery);

parse an XML in-memory block and use the given SAX function block -to handle the parsing callback. If sax is NULL, fallback to the default -DOM tree building routines.

sax : the SAX handler block
buffer : an pointer to a char array
size : the size of the array
recovery : work in recovery mode, i.e. tries to read not Well Formed -documents
Returns :the resulting document tree


xmlSAXParseFile ()

xmlDocPtr   xmlSAXParseFile                 (xmlSAXHandlerPtr sax,
-                                             const char *filename,
-                                             int recovery);

parse an XML file and build a tree. Automatic support for ZLIB/Compress -compressed document is provided by default if found at compile-time. -It use the given SAX function block to handle the parsing callback. -If sax is NULL, fallback to the default DOM tree building routines.

sax : the SAX handler block
filename : the filename
recovery : work in recovery mode, i.e. tries to read no Well Formed -documents
Returns :the resulting document tree


xmlSAXParseFileWithData ()

xmlDocPtr   xmlSAXParseFileWithData         (xmlSAXHandlerPtr sax,
-                                             const char *filename,
-                                             int recovery,
-                                             void *data);

parse an XML file and build a tree. Automatic support for ZLIB/Compress -compressed document is provided by default if found at compile-time. -It use the given SAX function block to handle the parsing callback. -If sax is NULL, fallback to the default DOM tree building routines.

User data (void *) is stored within the parser context, so it is -available nearly everywhere in libxml.

sax : the SAX handler block
filename : the filename
recovery : work in recovery mode, i.e. tries to read no Well Formed -documents
data : the userdata
Returns :the resulting document tree


xmlSAXParseEntity ()

xmlDocPtr   xmlSAXParseEntity               (xmlSAXHandlerPtr sax,
-                                             const char *filename);

parse an XML external entity out of context and build a tree. -It use the given SAX function block to handle the parsing callback. -If sax is NULL, fallback to the default DOM tree building routines.

[78] extParsedEnt ::= TextDecl? content

This correspond to a "Well Balanced" chunk

sax : the SAX handler block
filename : the filename
Returns :the resulting document tree


xmlParseEntity ()

xmlDocPtr   xmlParseEntity                  (const char *filename);

parse an XML external entity out of context and build a tree.

[78] extParsedEnt ::= TextDecl? content

This correspond to a "Well Balanced" chunk

filename : the filename
Returns :the resulting document tree


xmlParseDTD ()

xmlDtdPtr   xmlParseDTD                     (const xmlChar *ExternalID,
-                                             const xmlChar *SystemID);

Load and parse an external subset.

ExternalID : a NAME* containing the External ID of the DTD
SystemID : a NAME* containing the URL to the DTD
Returns :the resulting xmlDtdPtr or NULL in case of error.


xmlSAXParseDTD ()

xmlDtdPtr   xmlSAXParseDTD                  (xmlSAXHandlerPtr sax,
-                                             const xmlChar *ExternalID,
-                                             const xmlChar *SystemID);

Load and parse an external subset.

sax : the SAX handler block
ExternalID : a NAME* containing the External ID of the DTD
SystemID : a NAME* containing the URL to the DTD
Returns :the resulting xmlDtdPtr or NULL in case of error.


xmlIOParseDTD ()

xmlDtdPtr   xmlIOParseDTD                   (xmlSAXHandlerPtr sax,
-                                             xmlParserInputBufferPtr input,
-                                             xmlCharEncoding enc);

Load and parse a DTD

sax : the SAX handler block or NULL
input : an Input Buffer
enc : the charset encoding if known
Returns :the resulting xmlDtdPtr or NULL in case of error. -input will be freed at parsing end.


xmlParseBalancedChunkMemory ()

int         xmlParseBalancedChunkMemory     (xmlDocPtr doc,
-                                             xmlSAXHandlerPtr sax,
-                                             void *user_data,
-                                             int depth,
-                                             const xmlChar *string,
-                                             xmlNodePtr *lst);

Parse a well-balanced chunk of an XML document -called by the parser -The allowed sequence for the Well Balanced Chunk is the one defined by -the content production in the XML grammar:

[43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*

doc : the document the chunk pertains to
sax : the SAX handler bloc (possibly NULL)
user_data : The user data returned on SAX callbacks (possibly NULL)
depth : Used for loop detection, use 0
string : the input string in UTF8 or ISO-Latin (zero terminated)
lst : the return value for the set of parsed nodes
Returns :0 if the chunk is well balanced, -1 in case of args problem and -the parser error code otherwise


xmlParseExternalEntity ()

int         xmlParseExternalEntity          (xmlDocPtr doc,
-                                             xmlSAXHandlerPtr sax,
-                                             void *user_data,
-                                             int depth,
-                                             const xmlChar *URL,
-                                             const xmlChar *ID,
-                                             xmlNodePtr *lst);

Parse an external general entity -An external general parsed entity is well-formed if it matches the -production labeled extParsedEnt.

[78] extParsedEnt ::= TextDecl? content

doc : the document the chunk pertains to
sax : the SAX handler bloc (possibly NULL)
user_data : The user data returned on SAX callbacks (possibly NULL)
depth : Used for loop detection, use 0
URL : the URL for the entity to load
ID : the System ID for the entity to load
lst : the return value for the set of parsed nodes
Returns :0 if the entity is well formed, -1 in case of args problem and -the parser error code otherwise


xmlParseCtxtExternalEntity ()

int         xmlParseCtxtExternalEntity      (xmlParserCtxtPtr ctx,
-                                             const xmlChar *URL,
-                                             const xmlChar *ID,
-                                             xmlNodePtr *lst);

Parse an external general entity within an existing parsing context -An external general parsed entity is well-formed if it matches the -production labeled extParsedEnt.

[78] extParsedEnt ::= TextDecl? content

ctx : the existing parsing context
URL : the URL for the entity to load
ID : the System ID for the entity to load
lst : the return value for the set of parsed nodes
Returns :0 if the entity is well formed, -1 in case of args problem and -the parser error code otherwise


xmlDefaultSAXHandlerInit ()

void        xmlDefaultSAXHandlerInit        (void);

Initialize the default SAX handler


htmlDefaultSAXHandlerInit ()

void        htmlDefaultSAXHandlerInit       (void);

Initialize the default SAX handler


xmlInitParserCtxt ()

void        xmlInitParserCtxt               (xmlParserCtxtPtr ctxt);

Initialize a parser context

ctxt : an XML parser context


xmlClearParserCtxt ()

void        xmlClearParserCtxt              (xmlParserCtxtPtr ctxt);

Clear (release owned resources) and reinitialize a parser context

ctxt : an XML parser context


xmlFreeParserCtxt ()

void        xmlFreeParserCtxt               (xmlParserCtxtPtr ctxt);

Free all the memory used by a parser context. However the parsed -document in ctxt->myDoc is not freed.

ctxt : an XML parser context


xmlSetupParserForBuffer ()

void        xmlSetupParserForBuffer         (xmlParserCtxtPtr ctxt,
-                                             const xmlChar *buffer,
-                                             const char *filename);

Setup the parser context to parse a new buffer; Clears any prior -contents from the parser context. The buffer parameter must not be -NULL, but the filename parameter can be

ctxt : an XML parser context
buffer : a xmlChar * buffer
filename : a file name


xmlCreateDocParserCtxt ()

xmlParserCtxtPtr xmlCreateDocParserCtxt     (xmlChar *cur);

Creates a parser context for an XML in-memory document.

cur : a pointer to an array of xmlChar
Returns :the new parser context or NULL


xmlGetFeaturesList ()

int         xmlGetFeaturesList              (int *len,
-                                             const char **result);

Copy at most *len feature names into the result array

len : the length of the features name array (input/output)
result : an array of string to be filled with the features name.
Returns :-1 in case or error, or the total number of features, -len is updated with the number of strings copied, -strings must not be deallocated


xmlGetFeature ()

int         xmlGetFeature                   (xmlParserCtxtPtr ctxt,
-                                             const char *name,
-                                             void *result);

Read the current value of one feature of this parser instance

ctxt : an XML/HTML parser context
name : the feature name
result : location to store the result
Returns :-1 in case or error, 0 otherwise


xmlSetFeature ()

int         xmlSetFeature                   (xmlParserCtxtPtr ctxt,
-                                             const char *name,
-                                             void *value);

Change the current value of one feature of this parser instance

ctxt : an XML/HTML parser context
name : the feature name
value : pointer to the location of the new value
Returns :-1 in case or error, 0 otherwise


xmlCreatePushParserCtxt ()

xmlParserCtxtPtr xmlCreatePushParserCtxt    (xmlSAXHandlerPtr sax,
-                                             void *user_data,
-                                             const char *chunk,
-                                             int size,
-                                             const char *filename);

Create a parser context for using the XML parser in push mode -To allow content encoding detection, size should be >= 4 -The value of filename is used for fetching external entities -and error/warning reports.

sax : a SAX handler
user_data : The user data returned on SAX callbacks
chunk : a pointer to an array of chars
size : number of chars in the array
filename : an optional file name or URI
Returns :the new parser context or NULL


xmlParseChunk ()

int         xmlParseChunk                   (xmlParserCtxtPtr ctxt,
-                                             const char *chunk,
-                                             int size,
-                                             int terminate);

Parse a Chunk of memory

ctxt : an XML parser context
chunk : an char array
size : the size in byte of the chunk
terminate : last chunk indicator
Returns :zero if no error, the xmlParserErrors otherwise.


xmlCreateIOParserCtxt ()

xmlParserCtxtPtr xmlCreateIOParserCtxt      (xmlSAXHandlerPtr sax,
-                                             void *user_data,
-                                             xmlInputReadCallback ioread,
-                                             xmlInputCloseCallback ioclose,
-                                             void *ioctx,
-                                             xmlCharEncoding enc);

Create a parser context for using the XML parser with an existing -I/O stream

sax : a SAX handler
user_data : The user data returned on SAX callbacks
ioread : an I/O read function
ioclose : an I/O close function
ioctx : an I/O handler
enc : the charset encoding if known
Returns :the new parser context or NULL


xmlNewIOInputStream ()

xmlParserInputPtr xmlNewIOInputStream       (xmlParserCtxtPtr ctxt,
-                                             xmlParserInputBufferPtr input,
-                                             xmlCharEncoding enc);

Create a new input stream structure encapsulating the input into -a stream suitable for the parser.

ctxt : an XML parser context
input : an I/O Input
enc : the charset encoding if known
Returns :the new input stream or NULL


xmlParserFindNodeInfo ()

const xmlParserNodeInfo* xmlParserFindNodeInfo
-                                            (const xmlParserCtxt *ctxt,
-                                             const xmlNode *node);

Find the parser node info struct for a given node

ctxt : an XML parser context
node : an XML node within the tree
Returns :an xmlParserNodeInfo block pointer or NULL


xmlInitNodeInfoSeq ()

void        xmlInitNodeInfoSeq              (xmlParserNodeInfoSeqPtr seq);

-- Initialize (set to initial state) node info sequence

seq : a node info sequence pointer


xmlClearNodeInfoSeq ()

void        xmlClearNodeInfoSeq             (xmlParserNodeInfoSeqPtr seq);

-- Clear (release memory and reinitialize) node -info sequence

seq : a node info sequence pointer


xmlParserFindNodeInfoIndex ()

unsigned long xmlParserFindNodeInfoIndex    (const xmlParserNodeInfoSeq *seq,
-                                             const xmlNode *node);

xmlParserFindNodeInfoIndex : Find the index that the info record for -the given node is or should be at in a sorted sequence

seq : a node info sequence pointer
node : an XML node pointer
Returns :a long indicating the position of the record


xmlParserAddNodeInfo ()

void        xmlParserAddNodeInfo            (xmlParserCtxtPtr ctxt,
-                                             const xmlParserNodeInfo *info);

Insert node info record into the sorted sequence

ctxt : an XML parser context
info : a node info sequence pointer


xmlSetExternalEntityLoader ()

void        xmlSetExternalEntityLoader      (xmlExternalEntityLoader f);

Changes the defaultexternal entity resolver function for the application

f : the new entity resolver function


xmlGetExternalEntityLoader ()

xmlExternalEntityLoader xmlGetExternalEntityLoader
-                                            (void);

Get the default external entity resolver function for the application

Returns :the xmlExternalEntityLoader function pointer


xmlLoadExternalEntity ()

xmlParserInputPtr xmlLoadExternalEntity     (const char *URL,
-                                             const char *ID,
-                                             xmlParserCtxtPtr context);

Load an external entity, note that the use of this function for -unparsed entities may generate problems -TODO: a more generic External entity API must be designed

URL : the URL for the entity to load
ID : the Public ID for the entity to load
context : 
Returns :the xmlParserInputPtr or NULL



<<< Previous PageHomeUpNext Page >>>
Libxml Library ReferenceSAX
\ No newline at end of file +>int xmlPedanticParserD \ No newline at end of file diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml new file mode 100644 index 00000000..d9586b03 --- /dev/null +++ b/doc/libxml2-api.xml @@ -0,0 +1,6043 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/parsedecl.py b/doc/parsedecl.py new file mode 100755 index 00000000..02433478 --- /dev/null +++ b/doc/parsedecl.py @@ -0,0 +1,336 @@ +#!/usr/bin/python -u +# +# tries to parse the output of gtk-doc declaration files and make +# an XML reusable description from them +# +# TODO: try to extracts comments from the DocBook output of + +import sys +import string + +macros = [] +structs = [] +typedefs = [] +enums = {} +functions = {} +private_functions = {} +ret_types = {} +types = {} + +sections = [] +files = {} +identifiers_file = {} +identifiers_type = {} + +def mormalizeTypeSpaces(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 removeComments(raw): + while string.find(raw, '/*') > 0: + e = string.find(raw, '/*') + tmp = raw[0:e] + raw = raw[e:] + e = string.find(raw, '*/') + if e > 0: + raw = tmp + raw[e + 2:] + else: + raw = tmp + return raw + +def extractArgs(raw, function): + raw = removeComments(raw) + list = string.split(raw, ",") + ret = [] + for arg in list: + i = len(arg) + if i == 0: + continue + i = i - 1 + c = arg[i] + while string.find(string.letters, c) >= 0 or \ + string.find(string.digits, c) >= 0: + i = i - 1 + if i < 0: + break + c = arg[i] + name = arg[i+1:] + while string.find(string.whitespace, c) >= 0: + i = i - 1 + if i < 0: + break + c = arg[i] + type = mormalizeTypeSpaces(arg[0:i+1], function) +# print "list: %s -> %s, %s" % (list, type, name) + ret.append((type, name)) + return ret + +def extractTypes(raw, function): + global ret_types + + tokens = string.split(raw) + type = '' + for token in tokens: + if type != '': + type = type + ' ' + token + else: + type = token + if ret_types.has_key(type): + ret_types[type].append(function) + else: + ret_types[type] = [function] + return type + +def parseMacro(): + global input + global macros + + line = input.readline()[:-1] + while line != "": + if line[0:6] == "" and line[-7:] == "": + name = line[6:-7] + line = input.readline()[:-1] + + macros.append(name) + identifiers_type[name] = "macro" + +def parseStruct(): + global input + global structs + + line = input.readline()[:-1] + while line != "": + if line[0:6] == "" and line[-7:] == "": + name = line[6:-7] + line = input.readline()[:-1] + + structs.append(name) + identifiers_type[name] = "struct" + +def parseTypedef(): + global input + global typedefs + + line = input.readline()[:-1] + while line != "": + if line[0:6] == "" and line[-7:] == "": + name = line[6:-7] + line = input.readline()[:-1] + + typedefs.append(name) + identifiers_type[name] = "typedef" + +def parseEnum(): + global input + global enums + + line = input.readline()[:-1] + consts = [] + while line != "": + if line[0:6] == "" and line[-7:] == "": + 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) + identifiers_type[token] = "const" + line = input.readline()[:-1] + + enums[name] = consts + identifiers_type[name] = "enum" + +def parseStaticFunction(): + global input + global private_functions + + line = input.readline()[:-1] + type = None + signature = None + while line != "": + if line[0:6] == "" and line[-7:] == "": + name = line[6:-7] + elif line[0:9] == "" and line[-10:] == "": + type = extractTypes(line[9:-10], name) + else: + signature = line + line = input.readline()[:-1] + + args = extractArgs(signature, name) + private_functions[name] = (type , args) + identifiers_type[name] = "private_func" + +def parseFunction(): + global input + global functions + + line = input.readline()[:-1] + type = None + signature = None + while line != "": + if line[0:6] == "" and line[-7:] == "": + name = line[6:-7] + elif line[0:9] == "" and line[-10:] == "": + type = extractTypes(line[9:-10], name) + else: + signature = line + line = input.readline()[:-1] + + args = extractArgs(signature, name) + functions[name] = (type , args) + identifiers_type[name] = "function" + +def parseSection(): + global input + global sections + global files + global identifiers_file + + tokens = [] + line = input.readline()[:-1] + while line != "": + if line[0:6] == "" and line[-7:] == "": + name = line[6:-7] + elif len(line) > 0: + tokens.append(line) + line = input.readline()[:-1] + + sections.append(name) + files[name] = tokens + for token in tokens: + identifiers_file[token] = name + # + # Small transitivity for enum values + # + if enums.has_key(token): + for const in enums[token]: + identifiers_file[const] = name + +print "Parsing: libxml-decl.txt" +input = open('libxml-decl.txt') +while 1: + line = input.readline() + if not line: + break + line = line[:-1] + if line == "": + parseMacro() + elif line == "": + parseEnum() + elif line == "": + parseFunction() + elif line == "": + parseStruct() + elif line == "": + parseTypedef() + elif line == "": + 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 manipulates %d different types" % (len(types.keys())) +print "The functions returns %d different types" % (len(ret_types.keys())) + +print "Parsing: libxml-decl-list.txt" +input = open('libxml-decl-list.txt') +while 1: + line = input.readline() + if not line: + break + line = line[:-1] + if line == "
": + parseSection() + elif len(line) >= 1 and line[0] == "<": + print "unhandled %s" % (line) + +print "Parsed: %d files %d identifiers" % (len(files), len(identifiers_file.keys())) + +print "Saving XML description libxml2-api.xml" +output = open("libxml2-api.xml", "w") +output.write("\n") +output.write(" \n") +for file in files.keys(): + output.write(" \n" % file) + for symbol in files[file]: + output.write(" \n" % (symbol)) + output.write(" \n") +output.write(" \n") + +output.write(" \n") +symbols=macros +for i in structs: symbols.append(i) +for i in typedefs: symbols.append(i) +for i in enums.keys(): + symbols.append(i) + for j in enums[i]: + symbols.append(j) +for i in functions.keys(): symbols.append(i) +symbols.sort() +prev = None +for i in symbols: + if i == prev: +# print "Symbol %s redefined" % (i) + continue + else: + prev = i + if identifiers_type.has_key(i): + type = identifiers_type[i] + + if identifiers_file.has_key(i): + file = identifiers_file[i] + else: + file = None + + output.write(" <%s name='%s'" % (type, i)) + if file != None: + output.write(" file='%s'" % (file)) + if type == "function": + output.write(">\n"); + (ret, args) = functions[i] + output.write(" \n" % (ret)) + for arg in args: + output.write(" \n" % ( + arg[1], arg[0])) + output.write(" \n" % (type)); + else: + output.write("/>\n"); + else: + print "Symbol %s not found in identifiers list" % (i) +output.write(" \n") +output.write("\n") +print "generated XML for %d symbols" % (len(symbols)) diff --git a/parsedecl.py b/parsedecl.py deleted file mode 100755 index c97e51ad..00000000 --- a/parsedecl.py +++ /dev/null @@ -1,185 +0,0 @@ -#!/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 != "": - if line[0:6] == "" and line[-7:] == "": - name = line[6:-7] - line = input.readline()[:-1] - - macros.append(name) - -def parseStruct(): - global input - global structs - - line = input.readline()[:-1] - while line != "": - if line[0:6] == "" and line[-7:] == "": - name = line[6:-7] - line = input.readline()[:-1] - - structs.append(name) - -def parseTypedef(): - global input - global typedefs - - line = input.readline()[:-1] - while line != "": - if line[0:6] == "" and line[-7:] == "": - name = line[6:-7] - line = input.readline()[:-1] - - typedefs.append(name) - -def parseEnum(): - global input - global enums - - line = input.readline()[:-1] - consts = [] - while line != "": - if line[0:6] == "" and line[-7:] == "": - 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 != "": - if line[0:6] == "" and line[-7:] == "": - name = line[6:-7] - elif line[0:9] == "" and line[-10:] == "": - 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 != "": - if line[0:6] == "" and line[-7:] == "": - name = line[6:-7] - elif line[0:9] == "" and line[-10:] == "": - 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 == "": - parseMacro() - elif line == "": - parseEnum() - elif line == "": - parseFunction() - elif line == "": - parseStruct() - elif line == "": - parseTypedef() - elif line == "": - 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)