diff --git a/doc/apibuild.py b/doc/apibuild.py index 72df6fbf6c3e83f8024736ccd3c1785a9619f141_ZG9jL2FwaWJ1aWxkLnB5..0ba4b4a846fb0042f32a9a1941227971ccd8343d_ZG9jL2FwaWJ1aWxkLnB5 100755 --- a/doc/apibuild.py +++ b/doc/apibuild.py @@ -330,7 +330,19 @@ # else: # print "Function %s from %s is not declared in headers" % ( # id, idx.functions[id].module) - # TODO: do the same for variables. + + for id in list(idx.variables.keys()): + if id in self.variables: + # check that variable condition agrees with header + # TODO: produces many false positives + #if idx.variables[id].conditionals != \ + # self.variables[id].conditionals: + # print("Header condition differs from Variable for %s:" \ + # % id) + # print(" H: %s" % self.variables[id].conditionals) + # print(" C: %s" % idx.variables[id].conditionals) + up = idx.variables[id] + self.variables[id].update(None, up.module, up.type, up.info, up.extra) def analyze_dict(self, type, dict): count = 0 @@ -679,5 +691,5 @@ return token # - # Parse a comment block associate to a typedef + # Parse a simple comment block for typedefs or global variables # @@ -683,5 +695,5 @@ # - def parseTypeComment(self, name, quiet = 0): + def parseSimpleComment(self, name, quiet = False): if name[0:2] == '__': quiet = 1 @@ -690,7 +702,7 @@ if self.comment == None: if not quiet: - self.warning("Missing comment for type %s" % (name)) - return((args, desc)) + self.warning("Missing comment for %s" % (name)) + return(None) if self.comment[0] != '*': if not quiet: @@ -695,9 +707,9 @@ if self.comment[0] != '*': if not quiet: - self.warning("Missing * in type comment for %s" % (name)) - return((args, desc)) + self.warning("Missing * in comment for %s" % (name)) + return(None) lines = self.comment.split('\n') if lines[0] == '*': del lines[0] if lines[0] != "* %s:" % (name): if not quiet: @@ -699,7 +711,7 @@ lines = self.comment.split('\n') if lines[0] == '*': del lines[0] if lines[0] != "* %s:" % (name): if not quiet: - self.warning("Misformatted type comment for %s" % (name)) + self.warning("Misformatted comment for %s" % (name)) self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0])) @@ -705,5 +717,5 @@ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0])) - return((args, desc)) + return(None) del lines[0] while len(lines) > 0 and lines[0] == '*': del lines[0] @@ -720,7 +732,7 @@ if quiet == 0: if desc == "": - self.warning("Type comment for %s lack description of the macro" % (name)) + self.warning("Comment for %s lacks description" % (name)) return(desc) # @@ -1070,7 +1082,7 @@ base_type = "struct " + name else: # TODO report missing or misformatted comments - info = self.parseTypeComment(name, 1) + info = self.parseSimpleComment(name, True) self.index_add(name, self.filename, not self.is_header, "typedef", type, info) token = self.token() @@ -1520,7 +1532,6 @@ token = self.token() token = self.parseBlock(token) else: - self.comment = None while token != None and (token[0] != "sep" or \ (token[1] != ';' and token[1] != ',')): token = self.token() @@ -1524,10 +1535,9 @@ while token != None and (token[0] != "sep" or \ (token[1] != ';' and token[1] != ',')): token = self.token() - self.comment = None if token == None or token[0] != "sep" or (token[1] != ';' and token[1] != ','): self.error("missing ';' or ',' after value") if token != None and token[0] == "sep": if token[1] == ";": @@ -1528,12 +1538,10 @@ if token == None or token[0] != "sep" or (token[1] != ';' and token[1] != ','): self.error("missing ';' or ',' after value") if token != None and token[0] == "sep": if token[1] == ";": - self.comment = None - token = self.token() if type == "struct": self.index_add(self.name, self.filename, not self.is_header, "struct", self.struct_fields) else: @@ -1536,5 +1544,6 @@ if type == "struct": self.index_add(self.name, self.filename, not self.is_header, "struct", self.struct_fields) else: + info = self.parseSimpleComment(self.name, True) self.index_add(self.name, self.filename, @@ -1540,5 +1549,7 @@ self.index_add(self.name, self.filename, - not self.is_header, "variable", type) + not self.is_header, "variable", type, info) + self.comment = None + token = self.token() break elif token[1] == "(": token = self.token() @@ -1559,7 +1570,6 @@ token = self.token() token = self.parseBlock(token); elif token[1] == ',': - self.comment = None self.index_add(self.name, self.filename, static, "variable", type) type = type_orig @@ -1570,6 +1580,7 @@ if token != None and token[0] == "name": self.name = token[1] token = self.token() + self.comment = None else: break @@ -1734,6 +1745,6 @@ def serialize_variable(self, output, name): id = self.idx.variables[name] if id.info != None: - output.write(" <variable name='%s' file='%s' type='%s'/>\n" % ( + output.write(" <variable name='%s' file='%s' type='%s'" % ( name, self.modulename_file(id.header), id.info)) else: @@ -1738,4 +1749,4 @@ name, self.modulename_file(id.header), id.info)) else: - output.write(" <variable name='%s' file='%s'/>\n" % ( + output.write(" <variable name='%s' file='%s'" % ( name, self.modulename_file(id.header))) @@ -1741,4 +1752,10 @@ name, self.modulename_file(id.header))) + desc = id.extra + if desc != None and desc != "": + output.write(">\n <info>%s</info>\n" % (escape(desc))) + output.write(" </variable>\n") + else: + output.write("/>\n") def serialize_function(self, output, name): id = self.idx.functions[name] diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 72df6fbf6c3e83f8024736ccd3c1785a9619f141_ZG9jL2xpYnhtbDItYXBpLnhtbA==..0ba4b4a846fb0042f32a9a1941227971ccd8343d_ZG9jL2xpYnhtbDItYXBpLnhtbA== 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -6952,9 +6952,15 @@ <variable name='emptyExp' file='xmlregexp' type='xmlExpNodePtr'/> <variable name='forbiddenExp' file='xmlregexp' type='xmlExpNodePtr'/> <variable name='htmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'/> - <variable name='oldXMLWDcompatibility' file='globals' type='int'/> - <variable name='xmlBufferAllocScheme' file='globals' type='xmlBufferAllocationScheme'/> - <variable name='xmlDefaultBufferSize' file='globals' type='int'/> + <variable name='oldXMLWDcompatibility' file='globals' type='int'> + <info>Global setting, DEPRECATED.</info> + </variable> + <variable name='xmlBufferAllocScheme' file='globals' type='xmlBufferAllocationScheme'> + <info>DEPRECATED: Don't use. Global setting, default allocation policy for buffers, default is XML_BUFFER_ALLOC_EXACT</info> + </variable> + <variable name='xmlDefaultBufferSize' file='globals' type='int'> + <info>DEPRECATED: Don't use. Global setting, default buffer size. Default value is BASE_BUFFER_SIZE</info> + </variable> <variable name='xmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'/> <variable name='xmlDefaultSAXLocator' file='globals' type='xmlSAXLocator'/> <variable name='xmlDeregisterNodeDefaultValue' file='globals' type='xmlDeregisterNodeFunc'/> @@ -6958,12 +6964,24 @@ <variable name='xmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'/> <variable name='xmlDefaultSAXLocator' file='globals' type='xmlSAXLocator'/> <variable name='xmlDeregisterNodeDefaultValue' file='globals' type='xmlDeregisterNodeFunc'/> - <variable name='xmlDoValidityCheckingDefaultValue' file='globals' type='int'/> - <variable name='xmlFree' file='globals' type='xmlFreeFunc'/> - <variable name='xmlGenericError' file='globals' type='xmlGenericErrorFunc'/> - <variable name='xmlGenericErrorContext' file='globals' type='void *'/> - <variable name='xmlGetWarningsDefaultValue' file='globals' type='int'/> - <variable name='xmlIndentTreeOutput' file='globals' type='int'/> + <variable name='xmlDoValidityCheckingDefaultValue' file='globals' type='int'> + <info>Global setting, indicate that the parser should work in validating mode. Disabled by default.</info> + </variable> + <variable name='xmlFree' file='globals' type='xmlFreeFunc'> + <info>@mem: an already allocated block of memory The variable holding the libxml free() implementation</info> + </variable> + <variable name='xmlGenericError' file='globals' type='xmlGenericErrorFunc'> + <info>Global setting: function used for generic error callbacks</info> + </variable> + <variable name='xmlGenericErrorContext' file='globals' type='void *'> + <info>Global setting passed to generic error callbacks</info> + </variable> + <variable name='xmlGetWarningsDefaultValue' file='globals' type='int'> + <info>Global setting, indicate that the parser should provide warnings. Activated by default.</info> + </variable> + <variable name='xmlIndentTreeOutput' file='globals' type='int'> + <info>Global setting, asking the serializer to indent the output tree by default Enabled by default</info> + </variable> <variable name='xmlIsBaseCharGroup' file='chvalid' type='const xmlChRangeGroup'/> <variable name='xmlIsCharGroup' file='chvalid' type='const xmlChRangeGroup'/> <variable name='xmlIsCombiningGroup' file='chvalid' type='const xmlChRangeGroup'/> @@ -6971,5 +6989,7 @@ <variable name='xmlIsExtenderGroup' file='chvalid' type='const xmlChRangeGroup'/> <variable name='xmlIsIdeographicGroup' file='chvalid' type='const xmlChRangeGroup'/> <variable name='xmlIsPubidChar_tab' file='chvalid' type='const unsigned charxmlIsPubidChar_tab[256]'/> - <variable name='xmlKeepBlanksDefaultValue' file='globals' type='int'/> + <variable name='xmlKeepBlanksDefaultValue' file='globals' type='int'> + <info>Global setting, indicate that the parser should keep all blanks nodes found in the content Activated by default, this is actually needed to have the parser conformant to the XML Recommendation, however the option is kept for some applications since this was libxml1 default behaviour.</info> + </variable> <variable name='xmlLastError' file='globals' type='xmlError'/> @@ -6975,7 +6995,17 @@ <variable name='xmlLastError' file='globals' type='xmlError'/> - <variable name='xmlLineNumbersDefaultValue' file='globals' type='int'/> - <variable name='xmlLoadExtDtdDefaultValue' file='globals' type='int'/> - <variable name='xmlMalloc' file='globals' type='xmlMallocFunc'/> - <variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'/> - <variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'/> + <variable name='xmlLineNumbersDefaultValue' file='globals' type='int'> + <info>DEPRECATED: The modern options API always enables line numbers. Global setting, indicate that the parser should store the line number in the content field of elements in the DOM tree. Disabled by default since this may not be safe for old classes of application.</info> + </variable> + <variable name='xmlLoadExtDtdDefaultValue' file='globals' type='int'> + <info>Global setting, indicate that the parser should load DTD while not validating. Disabled by default.</info> + </variable> + <variable name='xmlMalloc' file='globals' type='xmlMallocFunc'> + <info>@size: the size requested in bytes The variable holding the libxml malloc() implementation Returns a pointer to the newly allocated block or NULL in case of error</info> + </variable> + <variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'> + <info>@size: the size requested in bytes The variable holding the libxml malloc() implementation for atomic data (i.e. blocks not containing pointers), useful when using a garbage collecting allocator. Returns a pointer to the newly allocated block or NULL in case of error</info> + </variable> + <variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'> + <info>@str: a zero terminated string The variable holding the libxml strdup() implementation Returns the copy of the string or NULL in case of error</info> + </variable> <variable name='xmlOutputBufferCreateFilenameValue' file='globals' type='xmlOutputBufferCreateFilenameFunc'/> @@ -6981,3 +7011,5 @@ <variable name='xmlOutputBufferCreateFilenameValue' file='globals' type='xmlOutputBufferCreateFilenameFunc'/> - <variable name='xmlParserDebugEntities' file='globals' type='int'/> + <variable name='xmlParserDebugEntities' file='globals' type='int'> + <info>Global setting, asking the parser to print out debugging information. while handling entities. Disabled by default</info> + </variable> <variable name='xmlParserInputBufferCreateFilenameValue' file='globals' type='xmlParserInputBufferCreateFilenameFunc'/> @@ -6983,6 +7015,14 @@ <variable name='xmlParserInputBufferCreateFilenameValue' file='globals' type='xmlParserInputBufferCreateFilenameFunc'/> - <variable name='xmlParserMaxDepth' file='parserInternals' type='unsigned int'/> - <variable name='xmlParserVersion' file='globals' type='const char *'/> - <variable name='xmlPedanticParserDefaultValue' file='globals' type='int'/> - <variable name='xmlRealloc' file='globals' type='xmlReallocFunc'/> + <variable name='xmlParserMaxDepth' file='parserInternals' type='unsigned int'> + <info>arbitrary depth limit for the XML documents that we allow to process. This is not a limitation of the parser but a safety boundary feature. It can be disabled with the XML_PARSE_HUGE parser option.</info> + </variable> + <variable name='xmlParserVersion' file='globals' type='const char *'> + <info>Constant string describing the internal version of the library</info> + </variable> + <variable name='xmlPedanticParserDefaultValue' file='globals' type='int'> + <info>DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC. Global setting, indicate that the parser be pedantic Disabled by default.</info> + </variable> + <variable name='xmlRealloc' file='globals' type='xmlReallocFunc'> + <info>@mem: an already allocated block of memory @size: the new size requested in bytes The variable holding the libxml realloc() implementation Returns a pointer to the newly reallocated block or NULL in case of error</info> + </variable> <variable name='xmlRegisterNodeDefaultValue' file='globals' type='xmlRegisterNodeFunc'/> @@ -6988,5 +7028,7 @@ <variable name='xmlRegisterNodeDefaultValue' file='globals' type='xmlRegisterNodeFunc'/> - <variable name='xmlSaveNoEmptyTags' file='globals' type='int'/> + <variable name='xmlSaveNoEmptyTags' file='globals' type='int'> + <info>Global setting, asking the serializer to not output empty tags as <empty/> but <empty></empty>. those two forms are indistinguishable once parsed. Disabled by default</info> + </variable> <variable name='xmlStringComment' file='parserInternals' type='const xmlCharxmlStringComment[]'/> <variable name='xmlStringText' file='parserInternals' type='const xmlCharxmlStringText[]'/> <variable name='xmlStringTextNoenc' file='parserInternals' type='const xmlCharxmlStringTextNoenc[]'/> @@ -6990,10 +7032,18 @@ <variable name='xmlStringComment' file='parserInternals' type='const xmlCharxmlStringComment[]'/> <variable name='xmlStringText' file='parserInternals' type='const xmlCharxmlStringText[]'/> <variable name='xmlStringTextNoenc' file='parserInternals' type='const xmlCharxmlStringTextNoenc[]'/> - <variable name='xmlStructuredError' file='globals' type='xmlStructuredErrorFunc'/> - <variable name='xmlStructuredErrorContext' file='globals' type='void *'/> - <variable name='xmlSubstituteEntitiesDefaultValue' file='globals' type='int'/> - <variable name='xmlTreeIndentString' file='globals' type='const char *'/> + <variable name='xmlStructuredError' file='globals' type='xmlStructuredErrorFunc'> + <info>Global setting: function used for structured error callbacks</info> + </variable> + <variable name='xmlStructuredErrorContext' file='globals' type='void *'> + <info>Global setting passed to structured error callbacks</info> + </variable> + <variable name='xmlSubstituteEntitiesDefaultValue' file='globals' type='int'> + <info>Global setting, indicate that the parser should not generate entity references but replace them with the actual content of the entity Disabled by default, this should be activated when using XPath since the XPath data model requires entities replacement and the XPath engine does not handle entities references transparently.</info> + </variable> + <variable name='xmlTreeIndentString' file='globals' type='const char *'> + <info>The string used to do one-level indent. By default is equal to " " (two spaces)</info> + </variable> <variable name='xmlXPathNAN' file='xpath' type='double'/> <variable name='xmlXPathNINF' file='xpath' type='double'/> <variable name='xmlXPathPINF' file='xpath' type='double'/>