mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
python: sanitize indentation after line continuations
Line continuations should be 4 space indented unless a previous opening brace required different alignment. docs/apibuild.py:2014:24: E126 continuation line over-indented for hanging indent token[0], token[1])) ^ docs/apibuild.py:74:3: E121 continuation line under-indented for hanging indent "ATTRIBUTE_UNUSED": (0, "macro keyword"), ^ ...more... Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
43d29cb40b
commit
3df69e628f
@ -883,12 +883,10 @@ sc_require_enum_last_marker:
|
|||||||
exit 1; } || :
|
exit 1; } || :
|
||||||
|
|
||||||
# Validate many python style rules
|
# Validate many python style rules
|
||||||
FLAKE8_INDENTATION = E114,E115,E116,E121,E125,E126,E127,E128,E129,E131
|
|
||||||
FLAKE8_LINE_LENGTH = E501
|
FLAKE8_LINE_LENGTH = E501
|
||||||
FLAKE8_WARNINGS = W504
|
FLAKE8_WARNINGS = W504
|
||||||
|
|
||||||
FLAKE8_IGNORE = $(FLAKE8_INDENTATION),$\
|
FLAKE8_IGNORE = $(FLAKE8_LINE_LENGTH),$\
|
||||||
$(FLAKE8_LINE_LENGTH),$\
|
|
||||||
$(FLAKE8_WARNINGS) \
|
$(FLAKE8_WARNINGS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
240
docs/apibuild.py
240
docs/apibuild.py
@ -24,103 +24,103 @@ debugsym = None
|
|||||||
# C parser analysis code
|
# C parser analysis code
|
||||||
#
|
#
|
||||||
included_files = {
|
included_files = {
|
||||||
"libvirt-common.h": "header with general libvirt API definitions",
|
"libvirt-common.h": "header with general libvirt API definitions",
|
||||||
"libvirt-domain.h": "header with general libvirt API definitions",
|
"libvirt-domain.h": "header with general libvirt API definitions",
|
||||||
"libvirt-domain-checkpoint.h": "header with general libvirt API definitions",
|
"libvirt-domain-checkpoint.h": "header with general libvirt API definitions",
|
||||||
"libvirt-domain-snapshot.h": "header with general libvirt API definitions",
|
"libvirt-domain-snapshot.h": "header with general libvirt API definitions",
|
||||||
"libvirt-event.h": "header with general libvirt API definitions",
|
"libvirt-event.h": "header with general libvirt API definitions",
|
||||||
"libvirt-host.h": "header with general libvirt API definitions",
|
"libvirt-host.h": "header with general libvirt API definitions",
|
||||||
"libvirt-interface.h": "header with general libvirt API definitions",
|
"libvirt-interface.h": "header with general libvirt API definitions",
|
||||||
"libvirt-network.h": "header with general libvirt API definitions",
|
"libvirt-network.h": "header with general libvirt API definitions",
|
||||||
"libvirt-nodedev.h": "header with general libvirt API definitions",
|
"libvirt-nodedev.h": "header with general libvirt API definitions",
|
||||||
"libvirt-nwfilter.h": "header with general libvirt API definitions",
|
"libvirt-nwfilter.h": "header with general libvirt API definitions",
|
||||||
"libvirt-secret.h": "header with general libvirt API definitions",
|
"libvirt-secret.h": "header with general libvirt API definitions",
|
||||||
"libvirt-storage.h": "header with general libvirt API definitions",
|
"libvirt-storage.h": "header with general libvirt API definitions",
|
||||||
"libvirt-stream.h": "header with general libvirt API definitions",
|
"libvirt-stream.h": "header with general libvirt API definitions",
|
||||||
"virterror.h": "header with error specific API definitions",
|
"virterror.h": "header with error specific API definitions",
|
||||||
"libvirt.c": "Main interfaces for the libvirt library",
|
"libvirt.c": "Main interfaces for the libvirt library",
|
||||||
"libvirt-domain.c": "Domain interfaces for the libvirt library",
|
"libvirt-domain.c": "Domain interfaces for the libvirt library",
|
||||||
"libvirt-domain-checkpoint.c": "Domain checkpoint interfaces for the libvirt library",
|
"libvirt-domain-checkpoint.c": "Domain checkpoint interfaces for the libvirt library",
|
||||||
"libvirt-domain-snapshot.c": "Domain snapshot interfaces for the libvirt library",
|
"libvirt-domain-snapshot.c": "Domain snapshot interfaces for the libvirt library",
|
||||||
"libvirt-host.c": "Host interfaces for the libvirt library",
|
"libvirt-host.c": "Host interfaces for the libvirt library",
|
||||||
"libvirt-interface.c": "Interface interfaces for the libvirt library",
|
"libvirt-interface.c": "Interface interfaces for the libvirt library",
|
||||||
"libvirt-network.c": "Network interfaces for the libvirt library",
|
"libvirt-network.c": "Network interfaces for the libvirt library",
|
||||||
"libvirt-nodedev.c": "Node device interfaces for the libvirt library",
|
"libvirt-nodedev.c": "Node device interfaces for the libvirt library",
|
||||||
"libvirt-nwfilter.c": "NWFilter interfaces for the libvirt library",
|
"libvirt-nwfilter.c": "NWFilter interfaces for the libvirt library",
|
||||||
"libvirt-secret.c": "Secret interfaces for the libvirt library",
|
"libvirt-secret.c": "Secret interfaces for the libvirt library",
|
||||||
"libvirt-storage.c": "Storage interfaces for the libvirt library",
|
"libvirt-storage.c": "Storage interfaces for the libvirt library",
|
||||||
"libvirt-stream.c": "Stream interfaces for the libvirt library",
|
"libvirt-stream.c": "Stream interfaces for the libvirt library",
|
||||||
"virerror.c": "implements error handling and reporting code for libvirt",
|
"virerror.c": "implements error handling and reporting code for libvirt",
|
||||||
"virevent.c": "event loop for monitoring file handles",
|
"virevent.c": "event loop for monitoring file handles",
|
||||||
"virtypedparam-public.c": "virTypedParameters APIs",
|
"virtypedparam-public.c": "virTypedParameters APIs",
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_included_files = {
|
qemu_included_files = {
|
||||||
"libvirt-qemu.h": "header with QEMU specific API definitions",
|
"libvirt-qemu.h": "header with QEMU specific API definitions",
|
||||||
"libvirt-qemu.c": "Implementations for the QEMU specific APIs",
|
"libvirt-qemu.c": "Implementations for the QEMU specific APIs",
|
||||||
}
|
}
|
||||||
|
|
||||||
lxc_included_files = {
|
lxc_included_files = {
|
||||||
"libvirt-lxc.h": "header with LXC specific API definitions",
|
"libvirt-lxc.h": "header with LXC specific API definitions",
|
||||||
"libvirt-lxc.c": "Implementations for the LXC specific APIs",
|
"libvirt-lxc.c": "Implementations for the LXC specific APIs",
|
||||||
}
|
}
|
||||||
|
|
||||||
admin_included_files = {
|
admin_included_files = {
|
||||||
"libvirt-admin.h": "header with admin specific API definitions",
|
"libvirt-admin.h": "header with admin specific API definitions",
|
||||||
"admin/libvirt-admin.c": "Implementations for the admin specific APIs",
|
"admin/libvirt-admin.c": "Implementations for the admin specific APIs",
|
||||||
}
|
}
|
||||||
|
|
||||||
ignored_words = {
|
ignored_words = {
|
||||||
"G_GNUC_UNUSED": (0, "macro keyword"),
|
"G_GNUC_UNUSED": (0, "macro keyword"),
|
||||||
"G_GNUC_NULL_TERMINATED": (0, "macro keyword"),
|
"G_GNUC_NULL_TERMINATED": (0, "macro keyword"),
|
||||||
"VIR_DEPRECATED": (0, "macro keyword"),
|
"VIR_DEPRECATED": (0, "macro keyword"),
|
||||||
"VIR_EXPORT_VAR": (0, "macro keyword"),
|
"VIR_EXPORT_VAR": (0, "macro keyword"),
|
||||||
"WINAPI": (0, "Windows keyword"),
|
"WINAPI": (0, "Windows keyword"),
|
||||||
"__declspec": (3, "Windows keyword"),
|
"__declspec": (3, "Windows keyword"),
|
||||||
"__stdcall": (0, "Windows keyword"),
|
"__stdcall": (0, "Windows keyword"),
|
||||||
}
|
}
|
||||||
|
|
||||||
ignored_functions = {
|
ignored_functions = {
|
||||||
"virConnectSupportsFeature": "private function for remote access",
|
"virConnectSupportsFeature": "private function for remote access",
|
||||||
"virDomainMigrateFinish": "private function for migration",
|
"virDomainMigrateFinish": "private function for migration",
|
||||||
"virDomainMigrateFinish2": "private function for migration",
|
"virDomainMigrateFinish2": "private function for migration",
|
||||||
"virDomainMigratePerform": "private function for migration",
|
"virDomainMigratePerform": "private function for migration",
|
||||||
"virDomainMigratePrepare": "private function for migration",
|
"virDomainMigratePrepare": "private function for migration",
|
||||||
"virDomainMigratePrepare2": "private function for migration",
|
"virDomainMigratePrepare2": "private function for migration",
|
||||||
"virDomainMigratePrepareTunnel": "private function for tunnelled migration",
|
"virDomainMigratePrepareTunnel": "private function for tunnelled migration",
|
||||||
"virDomainMigrateBegin3": "private function for migration",
|
"virDomainMigrateBegin3": "private function for migration",
|
||||||
"virDomainMigrateFinish3": "private function for migration",
|
"virDomainMigrateFinish3": "private function for migration",
|
||||||
"virDomainMigratePerform3": "private function for migration",
|
"virDomainMigratePerform3": "private function for migration",
|
||||||
"virDomainMigratePrepare3": "private function for migration",
|
"virDomainMigratePrepare3": "private function for migration",
|
||||||
"virDomainMigrateConfirm3": "private function for migration",
|
"virDomainMigrateConfirm3": "private function for migration",
|
||||||
"virDomainMigratePrepareTunnel3": "private function for tunnelled migration",
|
"virDomainMigratePrepareTunnel3": "private function for tunnelled migration",
|
||||||
"DllMain": "specific function for Win32",
|
"DllMain": "specific function for Win32",
|
||||||
"virTypedParamsValidate": "internal function in virtypedparam.c",
|
"virTypedParamsValidate": "internal function in virtypedparam.c",
|
||||||
"virTypedParameterValidateSet": "internal function in virtypedparam.c",
|
"virTypedParameterValidateSet": "internal function in virtypedparam.c",
|
||||||
"virTypedParameterAssign": "internal function in virtypedparam.c",
|
"virTypedParameterAssign": "internal function in virtypedparam.c",
|
||||||
"virTypedParameterAssignFromStr": "internal function in virtypedparam.c",
|
"virTypedParameterAssignFromStr": "internal function in virtypedparam.c",
|
||||||
"virTypedParameterToString": "internal function in virtypedparam.c",
|
"virTypedParameterToString": "internal function in virtypedparam.c",
|
||||||
"virTypedParamsCheck": "internal function in virtypedparam.c",
|
"virTypedParamsCheck": "internal function in virtypedparam.c",
|
||||||
"virTypedParamsCopy": "internal function in virtypedparam.c",
|
"virTypedParamsCopy": "internal function in virtypedparam.c",
|
||||||
"virDomainMigrateBegin3Params": "private function for migration",
|
"virDomainMigrateBegin3Params": "private function for migration",
|
||||||
"virDomainMigrateFinish3Params": "private function for migration",
|
"virDomainMigrateFinish3Params": "private function for migration",
|
||||||
"virDomainMigratePerform3Params": "private function for migration",
|
"virDomainMigratePerform3Params": "private function for migration",
|
||||||
"virDomainMigratePrepare3Params": "private function for migration",
|
"virDomainMigratePrepare3Params": "private function for migration",
|
||||||
"virDomainMigrateConfirm3Params": "private function for migration",
|
"virDomainMigrateConfirm3Params": "private function for migration",
|
||||||
"virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration",
|
"virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration",
|
||||||
"virErrorCopyNew": "private",
|
"virErrorCopyNew": "private",
|
||||||
}
|
}
|
||||||
|
|
||||||
ignored_macros = {
|
ignored_macros = {
|
||||||
"_virSchedParameter": "backward compatibility macro for virTypedParameter",
|
"_virSchedParameter": "backward compatibility macro for virTypedParameter",
|
||||||
"_virBlkioParameter": "backward compatibility macro for virTypedParameter",
|
"_virBlkioParameter": "backward compatibility macro for virTypedParameter",
|
||||||
"_virMemoryParameter": "backward compatibility macro for virTypedParameter",
|
"_virMemoryParameter": "backward compatibility macro for virTypedParameter",
|
||||||
}
|
}
|
||||||
|
|
||||||
# macros that should be completely skipped
|
# macros that should be completely skipped
|
||||||
hidden_macros = {
|
hidden_macros = {
|
||||||
"VIR_DEPRECATED": "internal macro to mark deprecated apis",
|
"VIR_DEPRECATED": "internal macro to mark deprecated apis",
|
||||||
"VIR_EXPORT_VAR": "internal macro to mark exported vars",
|
"VIR_EXPORT_VAR": "internal macro to mark exported vars",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -909,8 +909,8 @@ class CParser:
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
if i >= nbargs:
|
if i >= nbargs:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
self.warning("Unable to find arg %s from function comment for %s" % (
|
self.warning("Unable to find arg %s from function comment for %s" %
|
||||||
arg, name))
|
(arg, name))
|
||||||
while len(lines) > 0 and lines[0] == '*':
|
while len(lines) > 0 and lines[0] == '*':
|
||||||
del lines[0]
|
del lines[0]
|
||||||
desc = None
|
desc = None
|
||||||
@ -977,7 +977,7 @@ class CParser:
|
|||||||
return None
|
return None
|
||||||
if token[0] == 'preproc':
|
if token[0] == 'preproc':
|
||||||
self.index_add(token[1], self.filename, not self.is_header,
|
self.index_add(token[1], self.filename, not self.is_header,
|
||||||
"include")
|
"include")
|
||||||
return self.lexer.token()
|
return self.lexer.token()
|
||||||
return token
|
return token
|
||||||
if name == "#define":
|
if name == "#define":
|
||||||
@ -989,8 +989,8 @@ class CParser:
|
|||||||
name = token[1]
|
name = token[1]
|
||||||
lst = []
|
lst = []
|
||||||
token = self.lexer.token()
|
token = self.lexer.token()
|
||||||
while token is not None and token[0] == 'preproc' and \
|
while (token is not None and token[0] == 'preproc' and
|
||||||
token[1][0] != '#':
|
token[1][0] != '#'):
|
||||||
lst.append(token[1])
|
lst.append(token[1])
|
||||||
token = self.lexer.token()
|
token = self.lexer.token()
|
||||||
try:
|
try:
|
||||||
@ -1058,17 +1058,17 @@ class CParser:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
elif name == "#else":
|
elif name == "#else":
|
||||||
if self.conditionals != [] and \
|
if (self.conditionals != [] and
|
||||||
self.defines[-1].find('ENABLED') != -1:
|
self.defines[-1].find('ENABLED') != -1):
|
||||||
self.conditionals[-1] = "!(%s)" % self.conditionals[-1]
|
self.conditionals[-1] = "!(%s)" % self.conditionals[-1]
|
||||||
elif name == "#endif":
|
elif name == "#endif":
|
||||||
if self.conditionals != [] and \
|
if (self.conditionals != [] and
|
||||||
self.defines[-1].find('ENABLED') != -1:
|
self.defines[-1].find('ENABLED') != -1):
|
||||||
self.conditionals = self.conditionals[:-1]
|
self.conditionals = self.conditionals[:-1]
|
||||||
self.defines = self.defines[:-1]
|
self.defines = self.defines[:-1]
|
||||||
token = self.lexer.token()
|
token = self.lexer.token()
|
||||||
while token is not None and token[0] == 'preproc' and \
|
while (token is not None and token[0] == 'preproc' and
|
||||||
token[1][0] != '#':
|
token[1][0] != '#'):
|
||||||
token = self.lexer.token()
|
token = self.lexer.token()
|
||||||
return token
|
return token
|
||||||
|
|
||||||
@ -1133,19 +1133,19 @@ class CParser:
|
|||||||
if signature is not None:
|
if signature is not None:
|
||||||
type = type.split('(')[0]
|
type = type.split('(')[0]
|
||||||
d = self.mergeFunctionComment(name,
|
d = self.mergeFunctionComment(name,
|
||||||
((type, None), signature), 1)
|
((type, None), signature), 1)
|
||||||
self.index_add(name, self.filename, not self.is_header,
|
self.index_add(name, self.filename, not self.is_header,
|
||||||
"functype", d)
|
"functype", d)
|
||||||
else:
|
else:
|
||||||
if base_type == "struct":
|
if base_type == "struct":
|
||||||
self.index_add(name, self.filename, not self.is_header,
|
self.index_add(name, self.filename, not self.is_header,
|
||||||
"struct", type)
|
"struct", type)
|
||||||
base_type = "struct " + name
|
base_type = "struct " + name
|
||||||
else:
|
else:
|
||||||
# TODO report missing or misformatted comments
|
# TODO report missing or misformatted comments
|
||||||
info = self.parseTypeComment(name, 1)
|
info = self.parseTypeComment(name, 1)
|
||||||
self.index_add(name, self.filename, not self.is_header,
|
self.index_add(name, self.filename, not self.is_header,
|
||||||
"typedef", type, info)
|
"typedef", type, info)
|
||||||
token = self.token()
|
token = self.token()
|
||||||
else:
|
else:
|
||||||
self.error("parsing typedef: expecting a name")
|
self.error("parsing typedef: expecting a name")
|
||||||
@ -1188,20 +1188,20 @@ class CParser:
|
|||||||
if oldtok[0] == "name" and oldtok[1][0:3] == "vir":
|
if oldtok[0] == "name" and oldtok[1][0:3] == "vir":
|
||||||
if token[0] == "sep" and token[1] == "(":
|
if token[0] == "sep" and token[1] == "(":
|
||||||
self.index_add_ref(oldtok[1], self.filename,
|
self.index_add_ref(oldtok[1], self.filename,
|
||||||
0, "function")
|
0, "function")
|
||||||
token = self.token()
|
token = self.token()
|
||||||
elif token[0] == "name":
|
elif token[0] == "name":
|
||||||
token = self.token()
|
token = self.token()
|
||||||
if token[0] == "sep" and (token[1] == ";" or
|
if token[0] == "sep" and (token[1] == ";" or
|
||||||
token[1] == "," or token[1] == "="):
|
token[1] == "," or token[1] == "="):
|
||||||
self.index_add_ref(oldtok[1], self.filename,
|
self.index_add_ref(oldtok[1], self.filename,
|
||||||
0, "type")
|
0, "type")
|
||||||
elif oldtok[0] == "name" and oldtok[1][0:4] == "XEN_":
|
elif oldtok[0] == "name" and oldtok[1][0:4] == "XEN_":
|
||||||
self.index_add_ref(oldtok[1], self.filename,
|
self.index_add_ref(oldtok[1], self.filename,
|
||||||
0, "typedef")
|
0, "typedef")
|
||||||
elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXEN_":
|
elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXEN_":
|
||||||
self.index_add_ref(oldtok[1], self.filename,
|
self.index_add_ref(oldtok[1], self.filename,
|
||||||
0, "typedef")
|
0, "typedef")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
token = self.token()
|
token = self.token()
|
||||||
@ -1350,7 +1350,7 @@ class CParser:
|
|||||||
value = token[1][1:]
|
value = token[1][1:]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
while token[0] != "sep" or (token[1] != ',' and
|
while token[0] != "sep" or (token[1] != ',' and
|
||||||
token[1] != '}'):
|
token[1] != '}'):
|
||||||
# We might be dealing with '1U << 12' here
|
# We might be dealing with '1U << 12' here
|
||||||
value = value + re.sub(r"^(\d+)U$", "\\1", token[1])
|
value = value + re.sub(r"^(\d+)U$", "\\1", token[1])
|
||||||
token = self.token()
|
token = self.token()
|
||||||
@ -1670,7 +1670,8 @@ class CParser:
|
|||||||
return token
|
return token
|
||||||
token = self.token()
|
token = self.token()
|
||||||
while token is not None and (token[0] == "op" or
|
while token is not None and (token[0] == "op" or
|
||||||
token[0] == "name" and token[1] == "const"):
|
token[0] == "name" and
|
||||||
|
token[1] == "const"):
|
||||||
self.type = self.type + " " + token[1]
|
self.type = self.type + " " + token[1]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
|
|
||||||
@ -1718,8 +1719,8 @@ class CParser:
|
|||||||
while token is not None and token[0] == "sep" and token[1] == '[':
|
while token is not None and token[0] == "sep" and token[1] == '[':
|
||||||
self.type = self.type + token[1]
|
self.type = self.type + token[1]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
while token is not None and token[0] != 'sep' and \
|
while (token is not None and token[0] != 'sep' and
|
||||||
token[1] != ']' and token[1] != ';':
|
token[1] != ']' and token[1] != ';'):
|
||||||
self.type = self.type + token[1]
|
self.type = self.type + token[1]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
if token is not None and token[0] == 'sep' and token[1] == ']':
|
if token is not None and token[0] == 'sep' and token[1] == ']':
|
||||||
@ -1868,13 +1869,13 @@ class CParser:
|
|||||||
token = self.token()
|
token = self.token()
|
||||||
# print('Entering extern "C line ', self.lineno())
|
# print('Entering extern "C line ', self.lineno())
|
||||||
while token is not None and (token[0] != 'sep' or
|
while token is not None and (token[0] != 'sep' or
|
||||||
token[1] != "}"):
|
token[1] != "}"):
|
||||||
if token[0] == 'name':
|
if token[0] == 'name':
|
||||||
token = self.parseGlobal(token)
|
token = self.parseGlobal(token)
|
||||||
else:
|
else:
|
||||||
self.error(
|
self.error(("token %s %s unexpected at the "
|
||||||
"token %s %s unexpected at the top level" % (
|
"top level") %
|
||||||
token[0], token[1]))
|
(token[0], token[1]))
|
||||||
token = self.parseGlobal(token)
|
token = self.parseGlobal(token)
|
||||||
# print('Exiting extern "C" line', self.lineno())
|
# print('Exiting extern "C" line', self.lineno())
|
||||||
token = self.token()
|
token = self.token()
|
||||||
@ -1933,10 +1934,11 @@ class CParser:
|
|||||||
if type == "struct":
|
if type == "struct":
|
||||||
self.checkLongLegacyStruct(self.name, self.struct_fields)
|
self.checkLongLegacyStruct(self.name, self.struct_fields)
|
||||||
self.index_add(self.name, self.filename,
|
self.index_add(self.name, self.filename,
|
||||||
not self.is_header, "struct", self.struct_fields)
|
not self.is_header, "struct",
|
||||||
|
self.struct_fields)
|
||||||
else:
|
else:
|
||||||
self.index_add(self.name, self.filename,
|
self.index_add(self.name, self.filename,
|
||||||
not self.is_header, "variable", type)
|
not self.is_header, "variable", type)
|
||||||
break
|
break
|
||||||
elif token[1] == "(":
|
elif token[1] == "(":
|
||||||
token = self.token()
|
token = self.token()
|
||||||
@ -1946,22 +1948,24 @@ class CParser:
|
|||||||
if token[0] == "sep" and token[1] == ";":
|
if token[0] == "sep" and token[1] == ";":
|
||||||
self.checkLongLegacyFunction(self.name, type, self.signature)
|
self.checkLongLegacyFunction(self.name, type, self.signature)
|
||||||
d = self.mergeFunctionComment(self.name,
|
d = self.mergeFunctionComment(self.name,
|
||||||
((type, None), self.signature), 1)
|
((type, None),
|
||||||
|
self.signature), 1)
|
||||||
self.index_add(self.name, self.filename, static,
|
self.index_add(self.name, self.filename, static,
|
||||||
"function", d)
|
"function", d)
|
||||||
token = self.token()
|
token = self.token()
|
||||||
elif token[0] == "sep" and token[1] == "{":
|
elif token[0] == "sep" and token[1] == "{":
|
||||||
self.checkLongLegacyFunction(self.name, type, self.signature)
|
self.checkLongLegacyFunction(self.name, type, self.signature)
|
||||||
d = self.mergeFunctionComment(self.name,
|
d = self.mergeFunctionComment(self.name,
|
||||||
((type, None), self.signature), static)
|
((type, None),
|
||||||
|
self.signature), static)
|
||||||
self.index_add(self.name, self.filename, static,
|
self.index_add(self.name, self.filename, static,
|
||||||
"function", d)
|
"function", d)
|
||||||
token = self.token()
|
token = self.token()
|
||||||
token = self.parseBlock(token)
|
token = self.parseBlock(token)
|
||||||
elif token[1] == ',':
|
elif token[1] == ',':
|
||||||
self.comment = None
|
self.comment = None
|
||||||
self.index_add(self.name, self.filename, static,
|
self.index_add(self.name, self.filename, static,
|
||||||
"variable", type)
|
"variable", type)
|
||||||
type = type_orig
|
type = type_orig
|
||||||
token = self.token()
|
token = self.token()
|
||||||
while token is not None and token[0] == "sep":
|
while token is not None and token[0] == "sep":
|
||||||
@ -1984,7 +1988,7 @@ class CParser:
|
|||||||
token = self.parseGlobal(token)
|
token = self.parseGlobal(token)
|
||||||
else:
|
else:
|
||||||
self.error("token %s %s unexpected at the top level" % (
|
self.error("token %s %s unexpected at the top level" % (
|
||||||
token[0], token[1]))
|
token[0], token[1]))
|
||||||
token = self.parseGlobal(token)
|
token = self.parseGlobal(token)
|
||||||
return
|
return
|
||||||
self.parseTopComment(self.top_comment)
|
self.parseTopComment(self.top_comment)
|
||||||
@ -2182,7 +2186,7 @@ class docBuilder:
|
|||||||
id = self.idx.typedefs[name]
|
id = self.idx.typedefs[name]
|
||||||
if id.info[0:7] == 'struct ':
|
if id.info[0:7] == 'struct ':
|
||||||
output.write(" <struct name='%s' file='%s' type='%s'" % (
|
output.write(" <struct name='%s' file='%s' type='%s'" % (
|
||||||
name, self.modulename_file(id.header), id.info))
|
name, self.modulename_file(id.header), id.info))
|
||||||
name = id.info[7:]
|
name = id.info[7:]
|
||||||
if (name in self.idx.structs and
|
if (name in self.idx.structs and
|
||||||
isinstance(self.idx.structs[name].info, (list, tuple))):
|
isinstance(self.idx.structs[name].info, (list, tuple))):
|
||||||
@ -2221,10 +2225,10 @@ class docBuilder:
|
|||||||
id = self.idx.variables[name]
|
id = self.idx.variables[name]
|
||||||
if id.info is not None:
|
if id.info is not None:
|
||||||
output.write(" <variable name='%s' file='%s' type='%s'/>\n" % (
|
output.write(" <variable name='%s' file='%s' type='%s'/>\n" % (
|
||||||
name, self.modulename_file(id.header), id.info))
|
name, self.modulename_file(id.header), id.info))
|
||||||
else:
|
else:
|
||||||
output.write(" <variable name='%s' file='%s'/>\n" % (
|
output.write(" <variable name='%s' file='%s'/>\n" % (
|
||||||
name, self.modulename_file(id.header)))
|
name, self.modulename_file(id.header)))
|
||||||
|
|
||||||
def serialize_function(self, output, name):
|
def serialize_function(self, output, name):
|
||||||
id = self.idx.functions[name]
|
id = self.idx.functions[name]
|
||||||
@ -2256,7 +2260,7 @@ class docBuilder:
|
|||||||
self.error("Missing documentation for return of function `%s'" % name)
|
self.error("Missing documentation for return of function `%s'" % name)
|
||||||
else:
|
else:
|
||||||
output.write(" <return type='%s' info='%s'/>\n" % (
|
output.write(" <return type='%s' info='%s'/>\n" % (
|
||||||
ret[0], escape(ret[1])))
|
ret[0], escape(ret[1])))
|
||||||
self.indexString(name, ret[1])
|
self.indexString(name, ret[1])
|
||||||
for param in params:
|
for param in params:
|
||||||
if param[0] == 'void':
|
if param[0] == 'void':
|
||||||
@ -2407,10 +2411,10 @@ class docBuilder:
|
|||||||
for id in typ:
|
for id in typ:
|
||||||
idf = self.idx.identifiers[id]
|
idf = self.idx.identifiers[id]
|
||||||
module = idf.header
|
module = idf.header
|
||||||
output.write(" <reference name='%s' href='%s'/>\n" % (id,
|
output.write(" <reference name='%s' href='%s'/>\n" %
|
||||||
'html/' + self.basename + '-' +
|
(id, 'html/' + self.basename + '-' +
|
||||||
self.modulename_file(module) + '.html#' +
|
self.modulename_file(module) + '.html#' +
|
||||||
id))
|
id))
|
||||||
|
|
||||||
def serialize_xrefs_index(self, output):
|
def serialize_xrefs_index(self, output):
|
||||||
index = self.xref
|
index = self.xref
|
||||||
|
@ -453,9 +453,9 @@ class GenericObject(Type):
|
|||||||
members += "\n"
|
members += "\n"
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
members += self.generic_objects_by_name[self.extends] \
|
obj = self.generic_objects_by_name[self.extends]
|
||||||
.generate_struct_members(add_banner=True,
|
members += obj.generate_struct_members(add_banner=True,
|
||||||
struct_gap=False) + "\n"
|
struct_gap=False) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
members += " /* %s */\n" % self.name
|
members += " /* %s */\n" % self.name
|
||||||
@ -482,8 +482,8 @@ class GenericObject(Type):
|
|||||||
% (suffix, extended_by)
|
% (suffix, extended_by)
|
||||||
|
|
||||||
for extended_by in self.extended_by:
|
for extended_by in self.extended_by:
|
||||||
source += self.generic_objects_by_name[extended_by] \
|
obj = self.generic_objects_by_name[extended_by]
|
||||||
.generate_dispatch(suffix, False)
|
source += obj.generate_dispatch(suffix, False)
|
||||||
|
|
||||||
return source
|
return source
|
||||||
|
|
||||||
@ -491,8 +491,8 @@ class GenericObject(Type):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += self.generic_objects_by_name[self.extends] \
|
obj = self.generic_objects_by_name[self.extends]
|
||||||
.generate_free_code(add_banner=True) + "\n"
|
source += obj.generate_free_code(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -516,8 +516,8 @@ class GenericObject(Type):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += self.generic_objects_by_name[self.extends] \
|
obj = self.generic_objects_by_name[self.extends]
|
||||||
.generate_validate_code(add_banner=True) + "\n"
|
source += obj.generate_validate_code(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -564,8 +564,8 @@ class Object(GenericObject):
|
|||||||
% extended_by
|
% extended_by
|
||||||
|
|
||||||
for extended_by in self.extended_by:
|
for extended_by in self.extended_by:
|
||||||
source += objects_by_name[extended_by] \
|
obj = objects_by_name[extended_by]
|
||||||
.generate_dynamic_cast_code(False)
|
source += obj.generate_dynamic_cast_code(False)
|
||||||
|
|
||||||
return source
|
return source
|
||||||
|
|
||||||
@ -573,8 +573,8 @@ class Object(GenericObject):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += objects_by_name[self.extends] \
|
obj = objects_by_name[self.extends]
|
||||||
.generate_deep_copy_code(add_banner=True) + "\n"
|
source += obj.generate_deep_copy_code(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -598,8 +598,8 @@ class Object(GenericObject):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += objects_by_name[self.extends] \
|
obj = objects_by_name[self.extends]
|
||||||
.generate_serialize_code(add_banner=True) + "\n"
|
source += obj.generate_serialize_code(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -616,8 +616,8 @@ class Object(GenericObject):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += objects_by_name[self.extends] \
|
obj = objects_by_name[self.extends]
|
||||||
.generate_deserialize_code(add_banner=True) + "\n"
|
source += obj.generate_deserialize_code(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -671,40 +671,46 @@ class Object(GenericObject):
|
|||||||
% (self.name, self.name, self.name)
|
% (self.name, self.name, self.name)
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
header += ("int esxVI_%s_DeepCopyList(esxVI_%s **dstList, "
|
header += ((
|
||||||
"esxVI_%s *srcList);\n") \
|
"int esxVI_%s_DeepCopyList(esxVI_%s **dstList, "
|
||||||
% (self.name, self.name, self.name)
|
" esxVI_%s *srcList);\n") %
|
||||||
|
(self.name, self.name, self.name))
|
||||||
|
|
||||||
if self.features & Object.FEATURE__ANY_TYPE:
|
if self.features & Object.FEATURE__ANY_TYPE:
|
||||||
header += ("int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, "
|
header += ((
|
||||||
"esxVI_%s **item);\n") \
|
"int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, "
|
||||||
% (self.name, self.name)
|
" esxVI_%s **item);\n") %
|
||||||
|
(self.name, self.name))
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
header += ("int esxVI_%s_CastListFromAnyType(esxVI_AnyType *anyType, "
|
header += ((
|
||||||
"esxVI_%s **list);\n") \
|
"int esxVI_%s_CastListFromAnyType(esxVI_AnyType *anyType, "
|
||||||
% (self.name, self.name)
|
" esxVI_%s **list);\n") %
|
||||||
|
(self.name, self.name))
|
||||||
|
|
||||||
if self.features & Object.FEATURE__SERIALIZE:
|
if self.features & Object.FEATURE__SERIALIZE:
|
||||||
header += ("int esxVI_%s_Serialize(esxVI_%s *item, "
|
header += ((
|
||||||
"const char *element, "
|
"int esxVI_%s_Serialize(esxVI_%s *item, "
|
||||||
"virBufferPtr output);\n") \
|
" const char *element, "
|
||||||
% (self.name, self.name)
|
" virBufferPtr output);\n") %
|
||||||
|
(self.name, self.name))
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
header += ("int esxVI_%s_SerializeList(esxVI_%s *list, "
|
header += ((
|
||||||
"const char *element, "
|
"int esxVI_%s_SerializeList(esxVI_%s *list, "
|
||||||
"virBufferPtr output);\n") \
|
" const char *element, "
|
||||||
% (self.name, self.name)
|
" virBufferPtr output);\n") %
|
||||||
|
(self.name, self.name))
|
||||||
|
|
||||||
if self.features & Object.FEATURE__DESERIALIZE:
|
if self.features & Object.FEATURE__DESERIALIZE:
|
||||||
header += "int esxVI_%s_Deserialize(xmlNodePtr node, esxVI_%s **item);\n" \
|
header += "int esxVI_%s_Deserialize(xmlNodePtr node, esxVI_%s **item);\n" \
|
||||||
% (self.name, self.name)
|
% (self.name, self.name)
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
header += ("int esxVI_%s_DeserializeList(xmlNodePtr node, "
|
header += ((
|
||||||
"esxVI_%s **list);\n") \
|
"int esxVI_%s_DeserializeList(xmlNodePtr node, "
|
||||||
% (self.name, self.name)
|
" esxVI_%s **list);\n") %
|
||||||
|
(self.name, self.name))
|
||||||
|
|
||||||
header += "\n\n\n"
|
header += "\n\n\n"
|
||||||
|
|
||||||
@ -887,8 +893,8 @@ class ManagedObject(GenericObject):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += managed_objects_by_name[self.extends] \
|
obj = managed_objects_by_name[self.extends]
|
||||||
.generate_lookup_code1(add_banner=True) + "\n"
|
source += obj.generate_lookup_code1(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -912,8 +918,8 @@ class ManagedObject(GenericObject):
|
|||||||
source = ""
|
source = ""
|
||||||
|
|
||||||
if self.extends is not None:
|
if self.extends is not None:
|
||||||
source += managed_objects_by_name[self.extends] \
|
obj = managed_objects_by_name[self.extends]
|
||||||
.generate_lookup_code2(add_banner=True) + "\n"
|
source += obj.generate_lookup_code2(add_banner=True) + "\n"
|
||||||
|
|
||||||
if self.extends is not None or add_banner:
|
if self.extends is not None or add_banner:
|
||||||
source += " /* %s */\n" % self.name
|
source += " /* %s */\n" % self.name
|
||||||
@ -957,12 +963,12 @@ class ManagedObject(GenericObject):
|
|||||||
header += "int esxVI_%s_Alloc(esxVI_%s **item);\n" % (self.name, self.name)
|
header += "int esxVI_%s_Alloc(esxVI_%s **item);\n" % (self.name, self.name)
|
||||||
header += "void esxVI_%s_Free(esxVI_%s **item);\n" % (self.name, self.name)
|
header += "void esxVI_%s_Free(esxVI_%s **item);\n" % (self.name, self.name)
|
||||||
header += ("int esxVI_%s_Validate(esxVI_%s *item, "
|
header += ("int esxVI_%s_Validate(esxVI_%s *item, "
|
||||||
"esxVI_String *selectedPropertyNameList);\n") \
|
" esxVI_String *selectedPropertyNameList);\n") \
|
||||||
% (self.name, self.name)
|
% (self.name, self.name)
|
||||||
|
|
||||||
if self.features & Object.FEATURE__LIST:
|
if self.features & Object.FEATURE__LIST:
|
||||||
header += "int esxVI_%s_AppendToList(esxVI_%s **list, esxVI_%s *item);\n" \
|
header += "int esxVI_%s_AppendToList(esxVI_%s **list, esxVI_%s *item);\n" \
|
||||||
% (self.name, self.name, self.name)
|
% (self.name, self.name, self.name)
|
||||||
|
|
||||||
header += "\n\n\n"
|
header += "\n\n\n"
|
||||||
|
|
||||||
@ -972,11 +978,11 @@ class ManagedObject(GenericObject):
|
|||||||
# functions
|
# functions
|
||||||
return (
|
return (
|
||||||
"int esxVI_Lookup%(name)s(esxVI_Context *ctx,"
|
"int esxVI_Lookup%(name)s(esxVI_Context *ctx,"
|
||||||
" const char *name,"
|
" const char *name,"
|
||||||
" esxVI_ManagedObjectReference *root,"
|
" esxVI_ManagedObjectReference *root,"
|
||||||
" esxVI_String *selectedPropertyNameList,"
|
" esxVI_String *selectedPropertyNameList,"
|
||||||
" esxVI_%(name)s **item,"
|
" esxVI_%(name)s **item,"
|
||||||
" esxVI_Occurrence occurrence);\n\n"
|
" esxVI_Occurrence occurrence);\n\n"
|
||||||
% {"name": self.name}
|
% {"name": self.name}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1074,18 +1080,18 @@ class Enum(Type):
|
|||||||
# functions
|
# functions
|
||||||
if self.features & Enum.FEATURE__ANY_TYPE:
|
if self.features & Enum.FEATURE__ANY_TYPE:
|
||||||
header += ("int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, "
|
header += ("int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, "
|
||||||
"esxVI_%s *item);\n") \
|
" esxVI_%s *item);\n") \
|
||||||
% (self.name, self.name)
|
% (self.name, self.name)
|
||||||
|
|
||||||
if self.features & Enum.FEATURE__SERIALIZE:
|
if self.features & Enum.FEATURE__SERIALIZE:
|
||||||
header += ("int esxVI_%s_Serialize(esxVI_%s item, const char *element, "
|
header += ("int esxVI_%s_Serialize(esxVI_%s item, const char *element, "
|
||||||
"virBufferPtr output);\n") \
|
" virBufferPtr output);\n") \
|
||||||
% (self.name, self.name)
|
% (self.name, self.name)
|
||||||
|
|
||||||
if self.features & Enum.FEATURE__DESERIALIZE:
|
if self.features & Enum.FEATURE__DESERIALIZE:
|
||||||
header += ("int esxVI_%s_Deserialize(xmlNodePtr node, "
|
header += ("int esxVI_%s_Deserialize(xmlNodePtr node, "
|
||||||
"esxVI_%s *item);\n") \
|
" esxVI_%s *item);\n") \
|
||||||
% (self.name, self.name)
|
% (self.name, self.name)
|
||||||
|
|
||||||
header += "\n\n\n"
|
header += "\n\n\n"
|
||||||
|
|
||||||
@ -1096,12 +1102,12 @@ class Enum(Type):
|
|||||||
source += " * VI Enum: %s\n" % self.name
|
source += " * VI Enum: %s\n" % self.name
|
||||||
source += " */\n\n"
|
source += " */\n\n"
|
||||||
source += "static const esxVI_Enumeration _esxVI_%s_Enumeration = {\n" \
|
source += "static const esxVI_Enumeration _esxVI_%s_Enumeration = {\n" \
|
||||||
% self.name
|
% self.name
|
||||||
source += " esxVI_Type_%s, {\n" % self.name
|
source += " esxVI_Type_%s, {\n" % self.name
|
||||||
|
|
||||||
for value in self.values:
|
for value in self.values:
|
||||||
source += " { \"%s\", esxVI_%s_%s },\n" \
|
source += " { \"%s\", esxVI_%s_%s },\n" \
|
||||||
% (value, self.name, capitalize_first(value))
|
% (value, self.name, capitalize_first(value))
|
||||||
|
|
||||||
source += " { NULL, -1 },\n"
|
source += " { NULL, -1 },\n"
|
||||||
source += " },\n"
|
source += " },\n"
|
||||||
@ -1239,11 +1245,11 @@ def parse_method(block):
|
|||||||
|
|
||||||
|
|
||||||
def is_known_type(type):
|
def is_known_type(type):
|
||||||
return type in predefined_objects or \
|
return (type in predefined_objects or
|
||||||
type in predefined_enums or \
|
type in predefined_enums or
|
||||||
type in objects_by_name or \
|
type in objects_by_name or
|
||||||
type in managed_objects_by_name or \
|
type in managed_objects_by_name or
|
||||||
type in enums_by_name
|
type in enums_by_name)
|
||||||
|
|
||||||
|
|
||||||
def open_and_print(filename):
|
def open_and_print(filename):
|
||||||
@ -1497,17 +1503,19 @@ def propagate_feature(obj, feature):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for property in obj.properties:
|
for property in obj.properties:
|
||||||
if property.occurrence == OCCURRENCE__IGNORED or \
|
if (property.occurrence == OCCURRENCE__IGNORED or
|
||||||
not property.is_type_generated():
|
not property.is_type_generated()):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if property.is_enum():
|
if property.is_enum():
|
||||||
if feature == Object.FEATURE__SERIALIZE and \
|
if (feature == Object.FEATURE__SERIALIZE and
|
||||||
not (enums_by_name[property.type].features & Enum.FEATURE__SERIALIZE):
|
not (enums_by_name[property.type].features &
|
||||||
|
Enum.FEATURE__SERIALIZE)):
|
||||||
enums_by_name[property.type].features |= Enum.FEATURE__SERIALIZE
|
enums_by_name[property.type].features |= Enum.FEATURE__SERIALIZE
|
||||||
features_have_changed = True
|
features_have_changed = True
|
||||||
elif feature == Object.FEATURE__DESERIALIZE and \
|
elif (feature == Object.FEATURE__DESERIALIZE and
|
||||||
not (enums_by_name[property.type].features & Enum.FEATURE__DESERIALIZE):
|
not (enums_by_name[property.type].features &
|
||||||
|
Enum.FEATURE__DESERIALIZE)):
|
||||||
enums_by_name[property.type].features |= Enum.FEATURE__DESERIALIZE
|
enums_by_name[property.type].features |= Enum.FEATURE__DESERIALIZE
|
||||||
features_have_changed = True
|
features_have_changed = True
|
||||||
elif property.is_object():
|
elif property.is_object():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user