From: Jiri Denemark Date: Fri, 5 Jun 2015 09:48:59 +0000 (+0200) Subject: apibuild: Generate macro/@string attribute X-Git-Tag: v1.2.17-rc1~215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6a2639bd22671c44d6e3e0ca8c73b3b637d9e12;p=thirdparty%2Flibvirt.git apibuild: Generate macro/@string attribute If a macro has a string value, the @string attribute will contain the value. Otherwise @string attribute will be missing. For example, the following macro definition from libvirt-domain.h: /** * VIR_MIGRATE_PARAM_URI: * ... */ # define VIR_MIGRATE_PARAM_URI "migrate_uri" will result in https://bugzilla.redhat.com/show_bug.cgi?id=1229199 Signed-off-by: Jiri Denemark --- diff --git a/docs/apibuild.py b/docs/apibuild.py index 18278dba34..d93d1d6263 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -1028,9 +1028,12 @@ class CParser: name = string.split(name, '(') [0] except: pass - info = self.parseMacroComment(name, not self.is_header) + strValue = None + if len(lst) == 1 and lst[0][0] == '"' and lst[0][-1] == '"': + strValue = lst[0][1:-1] + (args, desc) = self.parseMacroComment(name, not self.is_header) self.index_add(name, self.filename, not self.is_header, - "macro", info) + "macro", (args, desc, strValue)) return token # @@ -2144,24 +2147,30 @@ class docBuilder: def serialize_macro(self, output, name): id = self.idx.macros[name] - output.write(" \n" % (name, + output.write(" \n" % (desc)) - self.indexString(name, desc) - for arg in args: - (name, desc) = arg - if desc is not None and desc != "": - output.write(" \n" % ( - name, escape(desc))) - self.indexString(name, desc) - else: - output.write(" \n" % (name)) - except: - pass + if id.info is None: + args = [] + desc = None + strValue = None + else: + (args, desc, strValue) = id.info + + if strValue is not None: + output.write(" string='%s'" % strValue) + output.write(">\n") + + if desc is not None and desc != "": + output.write(" \n" % (desc)) + self.indexString(name, desc) + for arg in args: + (name, desc) = arg + if desc is not None and desc != "": + output.write(" \n" % ( + name, escape(desc))) + self.indexString(name, desc) + else: + output.write(" \n" % (name)) output.write(" \n") def serialize_union(self, output, field, desc):