diff options
| author | Mark Asselstine <mark.asselstine@windriver.com> | 2018-06-05 09:47:35 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-06-05 12:01:05 -0400 |
| commit | d4c5cd1d939ac9bc8f4e2065e5afa83b1fa00418 (patch) | |
| tree | 00a71160f4ee549b5387c9e7d545e1b9edccbe1d /recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch | |
| parent | 343b40ba0d44caeb22013a1586ae2159e415bd4c (diff) | |
| download | meta-virtualization-d4c5cd1d939ac9bc8f4e2065e5afa83b1fa00418.tar.gz | |
openvswitch: remove unused patches
commit 1fd1ff372014 [openvswitch: uprev to v2.9.2] left a bunch of
unused patches in place. Remove unreferenced patches as they are no
longer needed.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch')
| -rw-r--r-- | recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch | 1262 |
1 files changed, 0 insertions, 1262 deletions
diff --git a/recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch b/recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch deleted file mode 100644 index 7bdcc003..00000000 --- a/recipes-networking/openvswitch/openvswitch-git/0001-Python3-compatibility-Convert-print-statements.patch +++ /dev/null | |||
| @@ -1,1262 +0,0 @@ | |||
| 1 | From 3658d861c3c83caab9040bec04b195be3f86d4ce Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jason Wessel <jason.wessel@windriver.com> | ||
| 3 | Date: Thu, 29 Jun 2017 20:33:23 -0700 | ||
| 4 | Subject: [PATCH] Python3 compatibility: Convert print statements | ||
| 5 | |||
| 6 | Commit d34a1cc02536f9a812517a71accec3fbd3c6c98b from | ||
| 7 | https://github.com/openvswitch/ovs.git | ||
| 8 | |||
| 9 | This patch fixes up all the print statements to work with python3 or | ||
| 10 | python2. | ||
| 11 | |||
| 12 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> | ||
| 13 | Signed-off-by: Ben Pfaff <blp@ovn.org> | ||
| 14 | |||
| 15 | --- | ||
| 16 | build-aux/check-structs | 4 +- | ||
| 17 | build-aux/extract-ofp-actions | 68 +++--- | ||
| 18 | build-aux/extract-ofp-errors | 2 +- | ||
| 19 | build-aux/extract-ofp-fields | 2 +- | ||
| 20 | build-aux/extract-ofp-msgs | 6 +- | ||
| 21 | ovsdb/ovsdb-doc | 6 +- | ||
| 22 | ovsdb/ovsdb-idlc.in | 523 +++++++++++++++++++++--------------------- | ||
| 23 | 7 files changed, 306 insertions(+), 305 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/build-aux/check-structs b/build-aux/check-structs | ||
| 26 | index 5129b72..cbb19b6 100755 | ||
| 27 | --- a/build-aux/check-structs | ||
| 28 | +++ b/build-aux/check-structs | ||
| 29 | @@ -211,7 +211,7 @@ def checkStructs(): | ||
| 30 | |||
| 31 | if '--help' in sys.argv: | ||
| 32 | argv0 = os.path.basename(sys.argv[0]) | ||
| 33 | - print '''\ | ||
| 34 | + print('''\ | ||
| 35 | %(argv0)s, for checking struct and struct member alignment | ||
| 36 | usage: %(argv0)s -Ipath HEADER [HEADER]... | ||
| 37 | |||
| 38 | @@ -226,7 +226,7 @@ assertions using OFP_ASSERT. | ||
| 39 | |||
| 40 | This program is specialized for reading Open vSwitch's OpenFlow header | ||
| 41 | files. It will not work on arbitrary header files without extensions.\ | ||
| 42 | -''' % {"argv0": argv0} | ||
| 43 | +''' % {"argv0": argv0}) | ||
| 44 | sys.exit(0) | ||
| 45 | |||
| 46 | global fileName | ||
| 47 | diff --git a/build-aux/extract-ofp-actions b/build-aux/extract-ofp-actions | ||
| 48 | index ee8c4ff..67e3848 100755 | ||
| 49 | --- a/build-aux/extract-ofp-actions | ||
| 50 | +++ b/build-aux/extract-ofp-actions | ||
| 51 | @@ -67,7 +67,7 @@ def fatal(msg): | ||
| 52 | |||
| 53 | def usage(): | ||
| 54 | argv0 = os.path.basename(sys.argv[0]) | ||
| 55 | - print ('''\ | ||
| 56 | + print('''\ | ||
| 57 | %(argv0)s, for extracting OpenFlow action data | ||
| 58 | usage: %(argv0)s OFP_ACTIONS.C [--prototypes | --definitions] | ||
| 59 | |||
| 60 | @@ -238,36 +238,36 @@ def extract_ofp_actions(fn, definitions): | ||
| 61 | if n_errors: | ||
| 62 | sys.exit(1) | ||
| 63 | |||
| 64 | - print """\ | ||
| 65 | + print("""\ | ||
| 66 | /* Generated automatically; do not modify! -*- buffer-read-only: t -*- */ | ||
| 67 | -""" | ||
| 68 | +""") | ||
| 69 | |||
| 70 | if definitions: | ||
| 71 | - print "/* Verify that structs used as actions are reasonable sizes. */" | ||
| 72 | + print("/* Verify that structs used as actions are reasonable sizes. */") | ||
| 73 | for s in sorted(arg_structs): | ||
| 74 | - print "BUILD_ASSERT_DECL(sizeof(%s) %% OFP_ACTION_ALIGN == 0);" % s | ||
| 75 | + print("BUILD_ASSERT_DECL(sizeof(%s) %% OFP_ACTION_ALIGN == 0);" % s) | ||
| 76 | |||
| 77 | - print "\nstatic struct ofpact_raw_instance all_raw_instances[] = {" | ||
| 78 | + print("\nstatic struct ofpact_raw_instance all_raw_instances[] = {") | ||
| 79 | for vendor in domain: | ||
| 80 | for type_ in domain[vendor]: | ||
| 81 | for version in domain[vendor][type_]: | ||
| 82 | d = domain[vendor][type_][version] | ||
| 83 | - print " { { 0x%08x, %2d, 0x%02x }, " % ( | ||
| 84 | - vendor, type_, version) | ||
| 85 | - print " %s," % d["enum"] | ||
| 86 | - print " HMAP_NODE_NULL_INITIALIZER," | ||
| 87 | - print " HMAP_NODE_NULL_INITIALIZER," | ||
| 88 | - print " %s," % d["min_length"] | ||
| 89 | - print " %s," % d["max_length"] | ||
| 90 | - print " %s," % d["arg_ofs"] | ||
| 91 | - print " %s," % d["arg_len"] | ||
| 92 | - print " \"%s\"," % re.sub('_RAW[0-9]*', '', d["enum"], 1) | ||
| 93 | + print(" { { 0x%08x, %2d, 0x%02x }, " % ( | ||
| 94 | + vendor, type_, version)) | ||
| 95 | + print(" %s," % d["enum"]) | ||
| 96 | + print(" HMAP_NODE_NULL_INITIALIZER,") | ||
| 97 | + print(" HMAP_NODE_NULL_INITIALIZER,") | ||
| 98 | + print(" %s," % d["min_length"]) | ||
| 99 | + print(" %s," % d["max_length"]) | ||
| 100 | + print(" %s," % d["arg_ofs"]) | ||
| 101 | + print(" %s," % d["arg_len"]) | ||
| 102 | + print(" \"%s\"," % re.sub('_RAW[0-9]*', '', d["enum"], 1)) | ||
| 103 | if d["deprecation"]: | ||
| 104 | - print " \"%s\"," % re.sub(r'(["\\])', r'\\\1', d["deprecation"]) | ||
| 105 | + print(" \"%s\"," % re.sub(r'(["\\])', r'\\\1', d["deprecation"])) | ||
| 106 | else: | ||
| 107 | - print " NULL," | ||
| 108 | - print " }," | ||
| 109 | - print "};"; | ||
| 110 | + print(" NULL,") | ||
| 111 | + print(" },") | ||
| 112 | + print("};") | ||
| 113 | |||
| 114 | for versions in enums.values(): | ||
| 115 | need_ofp_version = False | ||
| 116 | @@ -314,11 +314,11 @@ def extract_ofp_actions(fn, definitions): | ||
| 117 | decl += "}" | ||
| 118 | else: | ||
| 119 | decl += ";" | ||
| 120 | - print decl | ||
| 121 | |||
| 122 | + print(decl) | ||
| 123 | + print("") | ||
| 124 | |||
| 125 | if definitions: | ||
| 126 | - print """\ | ||
| 127 | + print("""\ | ||
| 128 | static enum ofperr | ||
| 129 | ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 130 | enum ofp_version version, uint64_t arg, | ||
| 131 | @@ -326,14 +326,14 @@ ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 132 | uint64_t *tlv_bitmap, struct ofpbuf *out) | ||
| 133 | { | ||
| 134 | switch (raw) {\ | ||
| 135 | -""" | ||
| 136 | +""") | ||
| 137 | for versions in enums.values(): | ||
| 138 | enum = versions[0]["enum"] | ||
| 139 | - print " case %s:" % enum | ||
| 140 | + print(" case %s:" % enum) | ||
| 141 | base_argtype = versions[0]["base_argtype"] | ||
| 142 | arg_vl_mff_map = versions[0]["arg_vl_mff_map"] | ||
| 143 | if base_argtype == 'void': | ||
| 144 | - print " return decode_%s(out);" % enum | ||
| 145 | + print(" return decode_%s(out);" % enum) | ||
| 146 | else: | ||
| 147 | if base_argtype.startswith('struct'): | ||
| 148 | arg = "ALIGNED_CAST(const %s *, a)" % base_argtype | ||
| 149 | @@ -344,16 +344,16 @@ ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 150 | else: | ||
| 151 | arg = "arg" | ||
| 152 | if arg_vl_mff_map: | ||
| 153 | - print " return decode_%s(%s, version, vl_mff_map, tlv_bitmap, out);" % (enum, arg) | ||
| 154 | + print(" return decode_%s(%s, version, vl_mff_map, tlv_bitmap, out);" % (enum, arg)) | ||
| 155 | else: | ||
| 156 | - print " return decode_%s(%s, version, out);" % (enum, arg) | ||
| 157 | |||
| 158 | - print """\ | ||
| 159 | + print(" return decode_%s(%s, version, out);" % (enum, arg)) | ||
| 160 | + print("") | ||
| 161 | + print("""\ | ||
| 162 | default: | ||
| 163 | OVS_NOT_REACHED(); | ||
| 164 | } | ||
| 165 | }\ | ||
| 166 | -""" | ||
| 167 | +""") | ||
| 168 | else: | ||
| 169 | for versions in enums.values(): | ||
| 170 | enum = versions[0]["enum"] | ||
| 171 | @@ -368,15 +368,15 @@ ofpact_decode(const struct ofp_action_header *a, enum ofp_raw_action_type raw, | ||
| 172 | if arg_vl_mff_map: | ||
| 173 | prototype += 'const struct vl_mff_map *, uint64_t *, ' | ||
| 174 | prototype += "struct ofpbuf *);" | ||
| 175 | - print prototype | ||
| 176 | + print(prototype) | ||
| 177 | |||
| 178 | - print """ | ||
| 179 | + print(""" | ||
| 180 | static enum ofperr ofpact_decode(const struct ofp_action_header *, | ||
| 181 | enum ofp_raw_action_type raw, | ||
| 182 | enum ofp_version version, | ||
| 183 | uint64_t arg, const struct vl_mff_map *vl_mff_map, | ||
| 184 | uint64_t *tlv_bitmap, struct ofpbuf *out); | ||
| 185 | -""" | ||
| 186 | +""") | ||
| 187 | |||
| 188 | if __name__ == '__main__': | ||
| 189 | if '--help' in sys.argv: | ||
| 190 | diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors | ||
| 191 | index e36444e..97d62d2 100755 | ||
| 192 | --- a/build-aux/extract-ofp-errors | ||
| 193 | +++ b/build-aux/extract-ofp-errors | ||
| 194 | @@ -426,7 +426,7 @@ static const struct ofperr_domain %s = { | ||
| 195 | vendor, type_, code = map[enum] | ||
| 196 | if code == None: | ||
| 197 | code = -1 | ||
| 198 | - print " { %#8x, %2d, %3d }, /* %s */" % (vendor, type_, code, enum) | ||
| 199 | + print (" { %#8x, %2d, %3d }, /* %s */" % (vendor, type_, code, enum)) | ||
| 200 | else: | ||
| 201 | print (" { -1, -1, -1 }, /* %s */" % enum) | ||
| 202 | print ("""\ | ||
| 203 | diff --git a/build-aux/extract-ofp-fields b/build-aux/extract-ofp-fields | ||
| 204 | index c248e76..80c7d35 100755 | ||
| 205 | --- a/build-aux/extract-ofp-fields | ||
| 206 | +++ b/build-aux/extract-ofp-fields | ||
| 207 | @@ -728,7 +728,7 @@ def make_ovs_fields(meta_flow_h, meta_flow_xml): | ||
| 208 | ovs\-fields \- protocol header fields in OpenFlow and Open vSwitch | ||
| 209 | . | ||
| 210 | .PP | ||
| 211 | -''') % version | ||
| 212 | +''' % version) | ||
| 213 | |||
| 214 | recursively_replace(doc, 'oxm_classes', make_oxm_classes_xml(document)) | ||
| 215 | |||
| 216 | diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs | ||
| 217 | index c2a91f9..92c4bda 100755 | ||
| 218 | --- a/build-aux/extract-ofp-msgs | ||
| 219 | +++ b/build-aux/extract-ofp-msgs | ||
| 220 | @@ -56,14 +56,14 @@ def fatal(msg): | ||
| 221 | |||
| 222 | def usage(): | ||
| 223 | argv0 = os.path.basename(sys.argv[0]) | ||
| 224 | - print '''\ | ||
| 225 | + print('''\ | ||
| 226 | %(argv0)s, for extracting OpenFlow message types from header files | ||
| 227 | usage: %(argv0)s INPUT OUTPUT | ||
| 228 | where INPUT is the name of the input header file | ||
| 229 | and OUTPUT is the output file name. | ||
| 230 | Despite OUTPUT, the output is written to stdout, and the OUTPUT argument | ||
| 231 | only controls #line directives in the output.\ | ||
| 232 | -''' % {"argv0": argv0} | ||
| 233 | +''' % {"argv0": argv0}) | ||
| 234 | sys.exit(0) | ||
| 235 | |||
| 236 | def make_sizeof(s): | ||
| 237 | @@ -378,5 +378,5 @@ if __name__ == '__main__': | ||
| 238 | line_number = 0 | ||
| 239 | |||
| 240 | for line in extract_ofp_msgs(sys.argv[2]): | ||
| 241 | - print line | ||
| 242 | + print(line) | ||
| 243 | |||
| 244 | diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc | ||
| 245 | index bdf2dcc..e82ad59 100755 | ||
| 246 | --- a/ovsdb/ovsdb-doc | ||
| 247 | +++ b/ovsdb/ovsdb-doc | ||
| 248 | @@ -258,7 +258,7 @@ represent strong references; thin lines represent weak references. | ||
| 249 | return s | ||
| 250 | |||
| 251 | def usage(): | ||
| 252 | - print """\ | ||
| 253 | + print("""\ | ||
| 254 | %(argv0)s: ovsdb schema documentation generator | ||
| 255 | Prints documentation for an OVSDB schema as an nroff-formatted manpage. | ||
| 256 | usage: %(argv0)s [OPTIONS] SCHEMA XML | ||
| 257 | @@ -269,7 +269,7 @@ The following options are also available: | ||
| 258 | --er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC | ||
| 259 | --version=VERSION use VERSION to display on document footer | ||
| 260 | -h, --help display this help message\ | ||
| 261 | -""" % {'argv0': argv0} | ||
| 262 | +""" % {'argv0': argv0}) | ||
| 263 | sys.exit(0) | ||
| 264 | |||
| 265 | if __name__ == "__main__": | ||
| 266 | @@ -304,7 +304,7 @@ if __name__ == "__main__": | ||
| 267 | for line in s.split("\n"): | ||
| 268 | line = line.strip() | ||
| 269 | if len(line): | ||
| 270 | - print line | ||
| 271 | + print(line) | ||
| 272 | |||
| 273 | except error.Error, e: | ||
| 274 | sys.stderr.write("%s: %s\n" % (argv0, e.msg)) | ||
| 275 | diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in | ||
| 276 | index bfbcf23..62442ee 100755 | ||
| 277 | --- a/ovsdb/ovsdb-idlc.in | ||
| 278 | +++ b/ovsdb/ovsdb-idlc.in | ||
| 279 | @@ -1,5 +1,6 @@ | ||
| 280 | #! /usr/bin/env @PYTHON@ | ||
| 281 | |||
| 282 | +from __future__ import print_function | ||
| 283 | import getopt | ||
| 284 | import os | ||
| 285 | import re | ||
| 286 | @@ -123,7 +124,7 @@ def sorted_columns(table): | ||
| 287 | def printCIDLHeader(schemaFile): | ||
| 288 | schema = parseSchema(schemaFile) | ||
| 289 | prefix = schema.idlPrefix | ||
| 290 | - print '''\ | ||
| 291 | + print('''\ | ||
| 292 | /* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */ | ||
| 293 | |||
| 294 | #ifndef %(prefix)sIDL_HEADER | ||
| 295 | @@ -135,39 +136,39 @@ def printCIDLHeader(schemaFile): | ||
| 296 | #include "ovsdb-data.h" | ||
| 297 | #include "ovsdb-idl-provider.h" | ||
| 298 | #include "smap.h" | ||
| 299 | -#include "uuid.h"''' % {'prefix': prefix.upper()} | ||
| 300 | +#include "uuid.h"''' % {'prefix': prefix.upper()}) | ||
| 301 | |||
| 302 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 303 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 304 | |||
| 305 | - print "" | ||
| 306 | - print "/* %s table. */" % tableName | ||
| 307 | - print "struct %s {" % structName | ||
| 308 | - print "\tstruct ovsdb_idl_row header_;" | ||
| 309 | + print("") | ||
| 310 | + print("/* %s table. */" % tableName) | ||
| 311 | + print("struct %s {" % structName) | ||
| 312 | + print("\tstruct ovsdb_idl_row header_;") | ||
| 313 | for columnName, column in sorted_columns(table): | ||
| 314 | - print "\n\t/* %s column. */" % columnName | ||
| 315 | + print("\n\t/* %s column. */" % columnName) | ||
| 316 | comment, members = cMembers(prefix, tableName, | ||
| 317 | columnName, column, False) | ||
| 318 | for member in members: | ||
| 319 | - print "\t%(type)s%(name)s;%(comment)s" % member | ||
| 320 | - print "};" | ||
| 321 | + print("\t%(type)s%(name)s;%(comment)s" % member) | ||
| 322 | + print("};") | ||
| 323 | |||
| 324 | # Column indexes. | ||
| 325 | printEnum("%s_column_id" % structName.lower(), ["%s_COL_%s" % (structName.upper(), columnName.upper()) | ||
| 326 | for columnName, column in sorted_columns(table)] | ||
| 327 | + ["%s_N_COLUMNS" % structName.upper()]) | ||
| 328 | |||
| 329 | |||
| 330 | + print("") | ||
| 331 | for columnName in table.columns: | ||
| 332 | - print "#define %(s)s_col_%(c)s (%(s)s_columns[%(S)s_COL_%(C)s])" % { | ||
| 333 | + print("#define %(s)s_col_%(c)s (%(s)s_columns[%(S)s_COL_%(C)s])" % { | ||
| 334 | 's': structName, | ||
| 335 | 'S': structName.upper(), | ||
| 336 | 'c': columnName, | ||
| 337 | - 'C': columnName.upper()} | ||
| 338 | + 'C': columnName.upper()}) | ||
| 339 | |||
| 340 | - print "\nextern struct ovsdb_idl_column %s_columns[%s_N_COLUMNS];" % (structName, structName.upper()) | ||
| 341 | + print("\nextern struct ovsdb_idl_column %s_columns[%s_N_COLUMNS];" % (structName, structName.upper())) | ||
| 342 | |||
| 343 | - print ''' | ||
| 344 | + print(''' | ||
| 345 | const struct %(s)s *%(s)s_get_for_uuid(const struct ovsdb_idl *, const struct uuid *); | ||
| 346 | const struct %(s)s *%(s)s_first(const struct ovsdb_idl *); | ||
| 347 | const struct %(s)s *%(s)s_next(const struct %(s)s *); | ||
| 348 | @@ -205,87 +206,87 @@ void %(s)s_init(struct %(s)s *); | ||
| 349 | void %(s)s_delete(const struct %(s)s *); | ||
| 350 | struct %(s)s *%(s)s_insert(struct ovsdb_idl_txn *); | ||
| 351 | bool %(s)s_is_updated(const struct %(s)s *, enum %(s)s_column_id); | ||
| 352 | -''' % {'s': structName, 'S': structName.upper()} | ||
| 353 | +''' % {'s': structName, 'S': structName.upper()}) | ||
| 354 | |||
| 355 | for columnName, column in sorted_columns(table): | ||
| 356 | - print 'void %(s)s_verify_%(c)s(const struct %(s)s *);' % {'s': structName, 'c': columnName} | ||
| 357 | + print('void %(s)s_verify_%(c)s(const struct %(s)s *);' % {'s': structName, 'c': columnName}) | ||
| 358 | |||
| 359 | |||
| 360 | + print("") | ||
| 361 | for columnName, column in sorted_columns(table): | ||
| 362 | if column.type.value: | ||
| 363 | valueParam = ', enum ovsdb_atomic_type value_type' | ||
| 364 | else: | ||
| 365 | valueParam = '' | ||
| 366 | - print 'const struct ovsdb_datum *%(s)s_get_%(c)s(const struct %(s)s *, enum ovsdb_atomic_type key_type%(v)s);' % { | ||
| 367 | - 's': structName, 'c': columnName, 'v': valueParam} | ||
| 368 | + print('const struct ovsdb_datum *%(s)s_get_%(c)s(const struct %(s)s *, enum ovsdb_atomic_type key_type%(v)s);' % { | ||
| 369 | + 's': structName, 'c': columnName, 'v': valueParam}) | ||
| 370 | |||
| 371 | |||
| 372 | + print("") | ||
| 373 | for columnName, column in sorted_columns(table): | ||
| 374 | - print 'void %(s)s_set_%(c)s(const struct %(s)s *,' % {'s': structName, 'c': columnName}, | ||
| 375 | + print('void %(s)s_set_%(c)s(const struct %(s)s *,' % {'s': structName, 'c': columnName}, end=' ') | ||
| 376 | if column.type.is_smap(): | ||
| 377 | args = ['const struct smap *'] | ||
| 378 | else: | ||
| 379 | comment, members = cMembers(prefix, tableName, columnName, | ||
| 380 | column, True) | ||
| 381 | args = ['%(type)s%(name)s' % member for member in members] | ||
| 382 | - print '%s);' % ', '.join(args) | ||
| 383 | + print('%s);' % ', '.join(args)) | ||
| 384 | |||
| 385 | |||
| 386 | + print("") | ||
| 387 | for columnName, column in sorted_columns(table): | ||
| 388 | if column.type.is_map(): | ||
| 389 | - print 'void %(s)s_update_%(c)s_setkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 390 | - print '%(coltype)s, %(valtype)s);' % {'coltype':column.type.key.to_const_c_type(prefix), 'valtype':column.type.value.to_const_c_type(prefix)} | ||
| 391 | - print 'void %(s)s_update_%(c)s_delkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 392 | - print '%(coltype)s);' % {'coltype':column.type.key.to_const_c_type(prefix)} | ||
| 393 | + print('void %(s)s_update_%(c)s_setkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 394 | + print('%(coltype)s, %(valtype)s);' % {'coltype':column.type.key.to_const_c_type(prefix), 'valtype':column.type.value.to_const_c_type(prefix)}) | ||
| 395 | + print('void %(s)s_update_%(c)s_delkey(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 396 | + print('%(coltype)s);' % {'coltype':column.type.key.to_const_c_type(prefix)}) | ||
| 397 | if column.type.is_set(): | ||
| 398 | - print 'void %(s)s_update_%(c)s_addvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 399 | - print '%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)} | ||
| 400 | - print 'void %(s)s_update_%(c)s_delvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, | ||
| 401 | - print '%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)} | ||
| 402 | + print('void %(s)s_update_%(c)s_addvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 403 | + print('%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)}) | ||
| 404 | + print('void %(s)s_update_%(c)s_delvalue(const struct %(s)s *, ' % {'s': structName, 'c': columnName}, end=' ') | ||
| 405 | + print('%(valtype)s);' % {'valtype':column.type.key.to_const_c_type(prefix)}) | ||
| 406 | |||
| 407 | - print 'void %(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *, enum ovsdb_function function,' % {'s': structName, 'c': columnName}, | ||
| 408 | + print('void %(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *, enum ovsdb_function function,' % {'s': structName, 'c': columnName}, end=' ') | ||
| 409 | if column.type.is_smap(): | ||
| 410 | args = ['const struct smap *'] | ||
| 411 | else: | ||
| 412 | comment, members = cMembers(prefix, tableName, columnName, | ||
| 413 | column, True, refTable=False) | ||
| 414 | args = ['%(type)s%(name)s' % member for member in members] | ||
| 415 | - print '%s);' % ', '.join(args) | ||
| 416 | + print('%s);' % ', '.join(args)) | ||
| 417 | |||
| 418 | - print 'void %(s)s_set_condition(struct ovsdb_idl *, struct ovsdb_idl_condition *);' % {'s': structName}, | ||
| 419 | + print('void %(s)s_set_condition(struct ovsdb_idl *, struct ovsdb_idl_condition *);' % {'s': structName}) | ||
| 420 | |||
| 421 | |||
| 422 | + print("") | ||
| 423 | |||
| 424 | # Table indexes. | ||
| 425 | printEnum("%stable_id" % prefix.lower(), ["%sTABLE_%s" % (prefix.upper(), tableName.upper()) for tableName in sorted(schema.tables)] + ["%sN_TABLES" % prefix.upper()]) | ||
| 426 | |||
| 427 | + print("") | ||
| 428 | for tableName in schema.tables: | ||
| 429 | - print "#define %(p)stable_%(t)s (%(p)stable_classes[%(P)sTABLE_%(T)s])" % { | ||
| 430 | + print("#define %(p)stable_%(t)s (%(p)stable_classes[%(P)sTABLE_%(T)s])" % { | ||
| 431 | 'p': prefix, | ||
| 432 | 'P': prefix.upper(), | ||
| 433 | 't': tableName.lower(), | ||
| 434 | - 'T': tableName.upper()} | ||
| 435 | - print "\nextern struct ovsdb_idl_table_class %stable_classes[%sN_TABLES];" % (prefix, prefix.upper()) | ||
| 436 | + 'T': tableName.upper()}) | ||
| 437 | + print("\nextern struct ovsdb_idl_table_class %stable_classes[%sN_TABLES];" % (prefix, prefix.upper())) | ||
| 438 | |||
| 439 | - print "\nextern struct ovsdb_idl_class %sidl_class;" % prefix | ||
| 440 | + print("\nextern struct ovsdb_idl_class %sidl_class;" % prefix) | ||
| 441 | |||
| 442 | - print "\nconst char * %sget_db_version(void);" % prefix | ||
| 443 | - print "\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()} | ||
| 444 | + print("\nconst char * %sget_db_version(void);" % prefix) | ||
| 445 | + print("\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()}) | ||
| 446 | |||
| 447 | def printEnum(type, members): | ||
| 448 | if len(members) == 0: | ||
| 449 | return | ||
| 450 | |||
| 451 | - print "\nenum %s {" % type | ||
| 452 | + print("\nenum %s {" % type) | ||
| 453 | for member in members[:-1]: | ||
| 454 | - print " %s," % member | ||
| 455 | - print " %s" % members[-1] | ||
| 456 | - print "};" | ||
| 457 | + print(" %s," % member) | ||
| 458 | + print(" %s" % members[-1]) | ||
| 459 | + print("};") | ||
| 460 | |||
| 461 | def printCIDLSource(schemaFile): | ||
| 462 | schema = parseSchema(schemaFile) | ||
| 463 | prefix = schema.idlPrefix | ||
| 464 | - print '''\ | ||
| 465 | + print('''\ | ||
| 466 | /* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */ | ||
| 467 | |||
| 468 | #include <config.h> | ||
| 469 | @@ -296,33 +297,33 @@ def printCIDLSource(schemaFile): | ||
| 470 | #include "ovsdb-error.h" | ||
| 471 | #include "util.h" | ||
| 472 | |||
| 473 | -''' % schema.idlHeader | ||
| 474 | +''' % schema.idlHeader) | ||
| 475 | |||
| 476 | # Cast functions. | ||
| 477 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 478 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 479 | - print ''' | ||
| 480 | + print(''' | ||
| 481 | static struct %(s)s * | ||
| 482 | %(s)s_cast(const struct ovsdb_idl_row *row) | ||
| 483 | { | ||
| 484 | return row ? CONTAINER_OF(row, struct %(s)s, header_) : NULL; | ||
| 485 | }\ | ||
| 486 | -''' % {'s': structName} | ||
| 487 | +''' % {'s': structName}) | ||
| 488 | |||
| 489 | |||
| 490 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 491 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 492 | - print "" | ||
| 493 | - print "/* %s table. */" % (tableName) | ||
| 494 | + print("") | ||
| 495 | + print("/* %s table. */" % (tableName)) | ||
| 496 | |||
| 497 | # Parse functions. | ||
| 498 | for columnName, column in sorted_columns(table): | ||
| 499 | - print ''' | ||
| 500 | + print(''' | ||
| 501 | static void | ||
| 502 | %(s)s_parse_%(c)s(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum) | ||
| 503 | { | ||
| 504 | struct %(s)s *row = %(s)s_cast(row_);''' % {'s': structName, | ||
| 505 | - 'c': columnName} | ||
| 506 | + 'c': columnName}) | ||
| 507 | type = column.type | ||
| 508 | if type.value: | ||
| 509 | keyVar = "row->key_%s" % columnName | ||
| 510 | @@ -332,89 +333,89 @@ static void | ||
| 511 | valueVar = None | ||
| 512 | |||
| 513 | if type.is_smap(): | ||
| 514 | - print " smap_init(&row->%s);" % columnName | ||
| 515 | - print " for (size_t i = 0; i < datum->n; i++) {" | ||
| 516 | - print " smap_add(&row->%s," % columnName | ||
| 517 | - print " datum->keys[i].string," | ||
| 518 | - print " datum->values[i].string);" | ||
| 519 | - print " }" | ||
| 520 | + print(" smap_init(&row->%s);" % columnName) | ||
| 521 | + print(" for (size_t i = 0; i < datum->n; i++) {") | ||
| 522 | + print(" smap_add(&row->%s," % columnName) | ||
| 523 | + print(" datum->keys[i].string,") | ||
| 524 | + print(" datum->values[i].string);") | ||
| 525 | + print(" }") | ||
| 526 | elif (type.n_min == 1 and type.n_max == 1) or type.is_optional_pointer(): | ||
| 527 | |||
| 528 | - print " if (datum->n >= 1) {" | ||
| 529 | + print("") | ||
| 530 | + print(" if (datum->n >= 1) {") | ||
| 531 | if not type.key.ref_table: | ||
| 532 | - print " %s = datum->keys[0].%s;" % (keyVar, type.key.type.to_string()) | ||
| 533 | + print(" %s = datum->keys[0].%s;" % (keyVar, type.key.type.to_string())) | ||
| 534 | else: | ||
| 535 | - print " %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->keys[0].uuid));" % (keyVar, prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower()) | ||
| 536 | + print(" %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->keys[0].uuid));" % (keyVar, prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower())) | ||
| 537 | |||
| 538 | if valueVar: | ||
| 539 | if not type.value.ref_table: | ||
| 540 | - print " %s = datum->values[0].%s;" % (valueVar, type.value.type.to_string()) | ||
| 541 | + print(" %s = datum->values[0].%s;" % (valueVar, type.value.type.to_string())) | ||
| 542 | else: | ||
| 543 | - print " %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->values[0].uuid));" % (valueVar, prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower()) | ||
| 544 | - print " } else {" | ||
| 545 | - print " %s" % type.key.initCDefault(keyVar, type.n_min == 0) | ||
| 546 | + print(" %s = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->values[0].uuid));" % (valueVar, prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower())) | ||
| 547 | + print(" } else {") | ||
| 548 | + print(" %s" % type.key.initCDefault(keyVar, type.n_min == 0)) | ||
| 549 | if valueVar: | ||
| 550 | - print " %s" % type.value.initCDefault(valueVar, type.n_min == 0) | ||
| 551 | - print " }" | ||
| 552 | + print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0)) | ||
| 553 | + print(" }") | ||
| 554 | else: | ||
| 555 | if type.n_max != sys.maxint: | ||
| 556 | - print " size_t n = MIN(%d, datum->n);" % type.n_max | ||
| 557 | + print(" size_t n = MIN(%d, datum->n);" % type.n_max) | ||
| 558 | nMax = "n" | ||
| 559 | else: | ||
| 560 | nMax = "datum->n" | ||
| 561 | - print " %s = NULL;" % keyVar | ||
| 562 | + print(" %s = NULL;" % keyVar) | ||
| 563 | if valueVar: | ||
| 564 | - print " %s = NULL;" % valueVar | ||
| 565 | - print " row->n_%s = 0;" % columnName | ||
| 566 | - print " for (size_t i = 0; i < %s; i++) {" % nMax | ||
| 567 | + print(" %s = NULL;" % valueVar) | ||
| 568 | + print(" row->n_%s = 0;" % columnName) | ||
| 569 | + print(" for (size_t i = 0; i < %s; i++) {" % nMax) | ||
| 570 | if type.key.ref_table: | ||
| 571 | - print """\ | ||
| 572 | + print("""\ | ||
| 573 | struct %s%s *keyRow = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->keys[i].uuid)); | ||
| 574 | if (!keyRow) { | ||
| 575 | continue; | ||
| 576 | }\ | ||
| 577 | -""" % (prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower()) | ||
| 578 | +""" % (prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower(), prefix, type.key.ref_table.name.lower())) | ||
| 579 | keySrc = "keyRow" | ||
| 580 | else: | ||
| 581 | keySrc = "datum->keys[i].%s" % type.key.type.to_string() | ||
| 582 | if type.value and type.value.ref_table: | ||
| 583 | - print """\ | ||
| 584 | + print("""\ | ||
| 585 | struct %s%s *valueRow = %s%s_cast(ovsdb_idl_get_row_arc(row_, &%stable_%s, &datum->values[i].uuid)); | ||
| 586 | if (!valueRow) { | ||
| 587 | continue; | ||
| 588 | }\ | ||
| 589 | -""" % (prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower()) | ||
| 590 | +""" % (prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower(), prefix, type.value.ref_table.name.lower())) | ||
| 591 | valueSrc = "valueRow" | ||
| 592 | elif valueVar: | ||
| 593 | valueSrc = "datum->values[i].%s" % type.value.type.to_string() | ||
| 594 | - print " if (!row->n_%s) {" % (columnName) | ||
| 595 | + print(" if (!row->n_%s) {" % (columnName)) | ||
| 596 | |||
| 597 | - print " %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 598 | - keyVar, nMax, keyVar) | ||
| 599 | + print(" %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 600 | + keyVar, nMax, keyVar)) | ||
| 601 | if valueVar: | ||
| 602 | - print " %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 603 | - valueVar, nMax, valueVar) | ||
| 604 | - print " }" | ||
| 605 | - print " %s[row->n_%s] = %s;" % (keyVar, columnName, keySrc) | ||
| 606 | + print(" %s = xmalloc(%s * sizeof *%s);" % ( | ||
| 607 | + valueVar, nMax, valueVar)) | ||
| 608 | + print(" }") | ||
| 609 | + print(" %s[row->n_%s] = %s;" % (keyVar, columnName, keySrc)) | ||
| 610 | if valueVar: | ||
| 611 | - print " %s[row->n_%s] = %s;" % (valueVar, columnName, valueSrc) | ||
| 612 | - print " row->n_%s++;" % columnName | ||
| 613 | - print " }" | ||
| 614 | - print "}" | ||
| 615 | + print(" %s[row->n_%s] = %s;" % (valueVar, columnName, valueSrc)) | ||
| 616 | + print(" row->n_%s++;" % columnName) | ||
| 617 | + print(" }") | ||
| 618 | + print("}") | ||
| 619 | |||
| 620 | # Unparse functions. | ||
| 621 | for columnName, column in sorted_columns(table): | ||
| 622 | type = column.type | ||
| 623 | if type.is_smap() or (type.n_min != 1 or type.n_max != 1) and not type.is_optional_pointer(): | ||
| 624 | - print ''' | ||
| 625 | + print(''' | ||
| 626 | static void | ||
| 627 | %(s)s_unparse_%(c)s(struct ovsdb_idl_row *row_) | ||
| 628 | { | ||
| 629 | struct %(s)s *row = %(s)s_cast(row_);''' % {'s': structName, | ||
| 630 | - 'c': columnName} | ||
| 631 | + 'c': columnName}) | ||
| 632 | |||
| 633 | if type.is_smap(): | ||
| 634 | - print " smap_destroy(&row->%s);" % columnName | ||
| 635 | + print(" smap_destroy(&row->%s);" % columnName) | ||
| 636 | else: | ||
| 637 | if type.value: | ||
| 638 | keyVar = "row->key_%s" % columnName | ||
| 639 | @@ -422,45 +423,45 @@ static void | ||
| 640 | else: | ||
| 641 | keyVar = "row->%s" % columnName | ||
| 642 | valueVar = None | ||
| 643 | - print " free(%s);" % keyVar | ||
| 644 | + print(" free(%s);" % keyVar) | ||
| 645 | if valueVar: | ||
| 646 | - print " free(%s);" % valueVar | ||
| 647 | - print '}' | ||
| 648 | + print(" free(%s);" % valueVar) | ||
| 649 | + print('}') | ||
| 650 | else: | ||
| 651 | - print ''' | ||
| 652 | + print(''' | ||
| 653 | static void | ||
| 654 | %(s)s_unparse_%(c)s(struct ovsdb_idl_row *row OVS_UNUSED) | ||
| 655 | { | ||
| 656 | /* Nothing to do. */ | ||
| 657 | -}''' % {'s': structName, 'c': columnName} | ||
| 658 | +}''' % {'s': structName, 'c': columnName}) | ||
| 659 | |||
| 660 | # Generic Row Initialization function. | ||
| 661 | - print """ | ||
| 662 | + print(""" | ||
| 663 | static void | ||
| 664 | %(s)s_init__(struct ovsdb_idl_row *row) | ||
| 665 | { | ||
| 666 | %(s)s_init(%(s)s_cast(row)); | ||
| 667 | -}""" % {'s': structName} | ||
| 668 | +}""" % {'s': structName}) | ||
| 669 | |||
| 670 | # Row Initialization function. | ||
| 671 | - print """ | ||
| 672 | + print(""" | ||
| 673 | /* Clears the contents of 'row' in table "%(t)s". */ | ||
| 674 | void | ||
| 675 | %(s)s_init(struct %(s)s *row) | ||
| 676 | { | ||
| 677 | - memset(row, 0, sizeof *row); """ % {'s': structName, 't': tableName} | ||
| 678 | + memset(row, 0, sizeof *row); """ % {'s': structName, 't': tableName}) | ||
| 679 | for columnName, column in sorted_columns(table): | ||
| 680 | if column.type.is_smap(): | ||
| 681 | - print " smap_init(&row->%s);" % columnName | ||
| 682 | + print(" smap_init(&row->%s);" % columnName) | ||
| 683 | elif (column.type.n_min == 1 and | ||
| 684 | column.type.n_max == 1 and | ||
| 685 | column.type.key.type == ovs.db.types.StringType and | ||
| 686 | not column.type.value): | ||
| 687 | - print " row->%s = \"\";" % columnName | ||
| 688 | - print "}" | ||
| 689 | + print(" row->%s = \"\";" % columnName) | ||
| 690 | + print("}") | ||
| 691 | |||
| 692 | # First, next functions. | ||
| 693 | - print ''' | ||
| 694 | + print(''' | ||
| 695 | /* Searches table "%(t)s" in 'idl' for a row with UUID 'uuid'. Returns | ||
| 696 | * a pointer to the row if there is one, otherwise a null pointer. */ | ||
| 697 | const struct %(s)s * | ||
| 698 | @@ -514,9 +515,9 @@ const struct %(s)s | ||
| 699 | 'P': prefix.upper(), | ||
| 700 | 't': tableName, | ||
| 701 | 'tl': tableName.lower(), | ||
| 702 | - 'T': tableName.upper()} | ||
| 703 | + 'T': tableName.upper()}) | ||
| 704 | |||
| 705 | - print ''' | ||
| 706 | + print(''' | ||
| 707 | |||
| 708 | /* Deletes 'row' from table "%(t)s". 'row' may be freed, so it must not be | ||
| 709 | * accessed afterward. | ||
| 710 | @@ -550,11 +551,11 @@ bool | ||
| 711 | 'P': prefix.upper(), | ||
| 712 | 't': tableName, | ||
| 713 | 'tl': tableName.lower(), | ||
| 714 | - 'T': tableName.upper()} | ||
| 715 | + 'T': tableName.upper()}) | ||
| 716 | |||
| 717 | # Verify functions. | ||
| 718 | for columnName, column in sorted_columns(table): | ||
| 719 | - print ''' | ||
| 720 | + print(''' | ||
| 721 | /* Causes the original contents of column "%(c)s" in 'row' to be | ||
| 722 | * verified as a prerequisite to completing the transaction. That is, if | ||
| 723 | * "%(c)s" in 'row' changed (or if 'row' was deleted) between the | ||
| 724 | @@ -585,7 +586,7 @@ void | ||
| 725 | }''' % {'s': structName, | ||
| 726 | 'S': structName.upper(), | ||
| 727 | 'c': columnName, | ||
| 728 | - 'C': columnName.upper()} | ||
| 729 | + 'C': columnName.upper()}) | ||
| 730 | |||
| 731 | # Get functions. | ||
| 732 | for columnName, column in sorted_columns(table): | ||
| 733 | @@ -597,7 +598,7 @@ void | ||
| 734 | valueParam = '' | ||
| 735 | valueType = '' | ||
| 736 | valueComment = '' | ||
| 737 | - print """ | ||
| 738 | + print(""" | ||
| 739 | /* Returns the "%(c)s" column's value from the "%(t)s" table in 'row' | ||
| 740 | * as a struct ovsdb_datum. This is useful occasionally: for example, | ||
| 741 | * ovsdb_datum_find_key() is an easier and more efficient way to search | ||
| 742 | @@ -625,7 +626,7 @@ const struct ovsdb_datum * | ||
| 743 | return ovsdb_idl_read(&row->header_, &%(s)s_col_%(c)s); | ||
| 744 | }""" % {'t': tableName, 's': structName, 'c': columnName, | ||
| 745 | 'kt': column.type.key.toAtomicType(), | ||
| 746 | - 'v': valueParam, 'vt': valueType, 'vc': valueComment} | ||
| 747 | + 'v': valueParam, 'vt': valueType, 'vc': valueComment}) | ||
| 748 | |||
| 749 | # Set functions. | ||
| 750 | for columnName, column in sorted_columns(table): | ||
| 751 | @@ -635,8 +636,8 @@ const struct ovsdb_datum * | ||
| 752 | column, True) | ||
| 753 | |||
| 754 | if type.is_smap(): | ||
| 755 | - print comment | ||
| 756 | - print """void | ||
| 757 | + print(comment) | ||
| 758 | + print("""void | ||
| 759 | %(s)s_set_%(c)s(const struct %(s)s *row, const struct smap *%(c)s) | ||
| 760 | { | ||
| 761 | struct ovsdb_datum datum; | ||
| 762 | @@ -654,7 +655,7 @@ const struct ovsdb_datum * | ||
| 763 | 's': structName, | ||
| 764 | 'S': structName.upper(), | ||
| 765 | 'c': columnName, | ||
| 766 | - 'C': columnName.upper()} | ||
| 767 | + 'C': columnName.upper()}) | ||
| 768 | continue | ||
| 769 | |||
| 770 | keyVar = members[0]['name'] | ||
| 771 | @@ -668,84 +669,84 @@ const struct ovsdb_datum * | ||
| 772 | if len(members) > 1: | ||
| 773 | nVar = members[1]['name'] | ||
| 774 | |||
| 775 | - print comment | ||
| 776 | - print """\ | ||
| 777 | + print(comment) | ||
| 778 | + print("""\ | ||
| 779 | void | ||
| 780 | %(s)s_set_%(c)s(const struct %(s)s *row, %(args)s) | ||
| 781 | { | ||
| 782 | struct ovsdb_datum datum;""" % {'s': structName, | ||
| 783 | 'c': columnName, | ||
| 784 | 'args': ', '.join(['%(type)s%(name)s' | ||
| 785 | - % m for m in members])} | ||
| 786 | + % m for m in members])}) | ||
| 787 | if type.n_min == 1 and type.n_max == 1: | ||
| 788 | - print " union ovsdb_atom key;" | ||
| 789 | + print(" union ovsdb_atom key;") | ||
| 790 | if type.value: | ||
| 791 | - print " union ovsdb_atom value;" | ||
| 792 | |||
| 793 | - print " datum.n = 1;" | ||
| 794 | - print " datum.keys = &key;" | ||
| 795 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar) | ||
| 796 | + print(" union ovsdb_atom value;") | ||
| 797 | + print("") | ||
| 798 | + print(" datum.n = 1;") | ||
| 799 | + print(" datum.keys = &key;") | ||
| 800 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar)) | ||
| 801 | if type.value: | ||
| 802 | - print " datum.values = &value;" | ||
| 803 | - print " "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar) | ||
| 804 | + print(" datum.values = &value;") | ||
| 805 | + print(" "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar)) | ||
| 806 | else: | ||
| 807 | - print " datum.values = NULL;" | ||
| 808 | + print(" datum.values = NULL;") | ||
| 809 | txn_write_func = "ovsdb_idl_txn_write_clone" | ||
| 810 | elif type.is_optional_pointer(): | ||
| 811 | - print " union ovsdb_atom key;" | ||
| 812 | |||
| 813 | - print " if (%s) {" % keyVar | ||
| 814 | - print " datum.n = 1;" | ||
| 815 | - print " datum.keys = &key;" | ||
| 816 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar) | ||
| 817 | - print " } else {" | ||
| 818 | - print " datum.n = 0;" | ||
| 819 | - print " datum.keys = NULL;" | ||
| 820 | - print " }" | ||
| 821 | - print " datum.values = NULL;" | ||
| 822 | + print(" union ovsdb_atom key;") | ||
| 823 | + print("") | ||
| 824 | + print(" if (%s) {" % keyVar) | ||
| 825 | + print(" datum.n = 1;") | ||
| 826 | + print(" datum.keys = &key;") | ||
| 827 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar)) | ||
| 828 | + print(" } else {") | ||
| 829 | + print(" datum.n = 0;") | ||
| 830 | + print(" datum.keys = NULL;") | ||
| 831 | + print(" }") | ||
| 832 | + print(" datum.values = NULL;") | ||
| 833 | txn_write_func = "ovsdb_idl_txn_write_clone" | ||
| 834 | elif type.n_max == 1: | ||
| 835 | - print " union ovsdb_atom key;" | ||
| 836 | |||
| 837 | - print " if (%s) {" % nVar | ||
| 838 | - print " datum.n = 1;" | ||
| 839 | - print " datum.keys = &key;" | ||
| 840 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar) | ||
| 841 | - print " } else {" | ||
| 842 | - print " datum.n = 0;" | ||
| 843 | - print " datum.keys = NULL;" | ||
| 844 | - print " }" | ||
| 845 | - print " datum.values = NULL;" | ||
| 846 | + print(" union ovsdb_atom key;") | ||
| 847 | + print("") | ||
| 848 | + print(" if (%s) {" % nVar) | ||
| 849 | + print(" datum.n = 1;") | ||
| 850 | + print(" datum.keys = &key;") | ||
| 851 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar)) | ||
| 852 | + print(" } else {") | ||
| 853 | + print(" datum.n = 0;") | ||
| 854 | + print(" datum.keys = NULL;") | ||
| 855 | + print(" }") | ||
| 856 | + print(" datum.values = NULL;") | ||
| 857 | txn_write_func = "ovsdb_idl_txn_write_clone" | ||
| 858 | else: | ||
| 859 | |||
| 860 | - print " datum.n = %s;" % nVar | ||
| 861 | - print " datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar) | ||
| 862 | + print("") | ||
| 863 | + print(" datum.n = %s;" % nVar) | ||
| 864 | + print(" datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar)) | ||
| 865 | if type.value: | ||
| 866 | - print " datum.values = xmalloc(%s * sizeof *datum.values);" % nVar | ||
| 867 | + print(" datum.values = xmalloc(%s * sizeof *datum.values);" % nVar) | ||
| 868 | else: | ||
| 869 | - print " datum.values = NULL;" | ||
| 870 | - print " for (size_t i = 0; i < %s; i++) {" % nVar | ||
| 871 | - print " " + type.key.copyCValue("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar) | ||
| 872 | + print(" datum.values = NULL;") | ||
| 873 | + print(" for (size_t i = 0; i < %s; i++) {" % nVar) | ||
| 874 | + print(" " + type.key.copyCValue("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar)) | ||
| 875 | if type.value: | ||
| 876 | - print " " + type.value.copyCValue("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar) | ||
| 877 | - print " }" | ||
| 878 | + print(" " + type.value.copyCValue("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar)) | ||
| 879 | + print(" }") | ||
| 880 | if type.value: | ||
| 881 | valueType = type.value.toAtomicType() | ||
| 882 | else: | ||
| 883 | valueType = "OVSDB_TYPE_VOID" | ||
| 884 | txn_write_func = "ovsdb_idl_txn_write" | ||
| 885 | - print " %(f)s(&row->header_, &%(s)s_col_%(c)s, &datum);" \ | ||
| 886 | + print(" %(f)s(&row->header_, &%(s)s_col_%(c)s, &datum);" \ | ||
| 887 | % {'f': txn_write_func, | ||
| 888 | 's': structName, | ||
| 889 | 'S': structName.upper(), | ||
| 890 | - 'c': columnName} | ||
| 891 | - print "}" | ||
| 892 | + 'c': columnName}) | ||
| 893 | + print("}") | ||
| 894 | # Update/Delete of partial map column functions | ||
| 895 | for columnName, column in sorted_columns(table): | ||
| 896 | type = column.type | ||
| 897 | if type.is_map(): | ||
| 898 | - print ''' | ||
| 899 | + print(''' | ||
| 900 | /* Sets an element of the "%(c)s" map column from the "%(t)s" table in 'row' | ||
| 901 | * to 'new_value' given the key value 'new_key'. | ||
| 902 | * | ||
| 903 | @@ -761,17 +762,17 @@ void | ||
| 904 | datum->values = xmalloc(datum->n * sizeof *datum->values); | ||
| 905 | ''' % {'s': structName, 'c': columnName,'coltype':column.type.key.to_const_c_type(prefix), | ||
| 906 | 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper(), | ||
| 907 | - 'C': columnName.upper(), 't': tableName} | ||
| 908 | + 'C': columnName.upper(), 't': tableName}) | ||
| 909 | |||
| 910 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_key") | ||
| 911 | - print " "+ type.value.copyCValue("datum->values[0].%s" % type.value.type.to_string(), "new_value") | ||
| 912 | - print ''' | ||
| 913 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_key")) | ||
| 914 | + print(" "+ type.value.copyCValue("datum->values[0].%s" % type.value.type.to_string(), "new_value")) | ||
| 915 | + print(''' | ||
| 916 | ovsdb_idl_txn_write_partial_map(&row->header_, | ||
| 917 | &%(s)s_col_%(c)s, | ||
| 918 | datum); | ||
| 919 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 920 | - 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 921 | - print ''' | ||
| 922 | + 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 923 | + print(''' | ||
| 924 | /* Deletes an element of the "%(c)s" map column from the "%(t)s" table in 'row' | ||
| 925 | * given the key value 'delete_key'. | ||
| 926 | * | ||
| 927 | @@ -787,19 +788,19 @@ void | ||
| 928 | datum->values = NULL; | ||
| 929 | ''' % {'s': structName, 'c': columnName,'coltype':column.type.key.to_const_c_type(prefix), | ||
| 930 | 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper(), | ||
| 931 | - 'C': columnName.upper(), 't': tableName} | ||
| 932 | + 'C': columnName.upper(), 't': tableName}) | ||
| 933 | |||
| 934 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_key") | ||
| 935 | - print ''' | ||
| 936 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_key")) | ||
| 937 | + print(''' | ||
| 938 | ovsdb_idl_txn_delete_partial_map(&row->header_, | ||
| 939 | &%(s)s_col_%(c)s, | ||
| 940 | datum); | ||
| 941 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 942 | - 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 943 | + 'valtype':column.type.value.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 944 | # End Update/Delete of partial maps | ||
| 945 | # Update/Delete of partial set column functions | ||
| 946 | if type.is_set(): | ||
| 947 | - print ''' | ||
| 948 | + print(''' | ||
| 949 | /* Adds the value 'new_value' to the "%(c)s" set column from the "%(t)s" table | ||
| 950 | * in 'row'. | ||
| 951 | * | ||
| 952 | @@ -814,16 +815,16 @@ void | ||
| 953 | datum->keys = xmalloc(datum->n * sizeof *datum->values); | ||
| 954 | datum->values = NULL; | ||
| 955 | ''' % {'s': structName, 'c': columnName, | ||
| 956 | - 'valtype':column.type.key.to_const_c_type(prefix), 't': tableName} | ||
| 957 | + 'valtype':column.type.key.to_const_c_type(prefix), 't': tableName}) | ||
| 958 | |||
| 959 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_value") | ||
| 960 | - print ''' | ||
| 961 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "new_value")) | ||
| 962 | + print(''' | ||
| 963 | ovsdb_idl_txn_write_partial_set(&row->header_, | ||
| 964 | &%(s)s_col_%(c)s, | ||
| 965 | datum); | ||
| 966 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 967 | - 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 968 | - print ''' | ||
| 969 | + 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 970 | + print(''' | ||
| 971 | /* Deletes the value 'delete_value' from the "%(c)s" set column from the | ||
| 972 | * "%(t)s" table in 'row'. | ||
| 973 | * | ||
| 974 | @@ -839,15 +840,15 @@ void | ||
| 975 | datum->values = NULL; | ||
| 976 | ''' % {'s': structName, 'c': columnName,'coltype':column.type.key.to_const_c_type(prefix), | ||
| 977 | 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper(), | ||
| 978 | - 'C': columnName.upper(), 't': tableName} | ||
| 979 | + 'C': columnName.upper(), 't': tableName}) | ||
| 980 | |||
| 981 | - print " "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_value") | ||
| 982 | - print ''' | ||
| 983 | + print(" "+ type.key.copyCValue("datum->keys[0].%s" % type.key.type.to_string(), "delete_value")) | ||
| 984 | + print(''' | ||
| 985 | ovsdb_idl_txn_delete_partial_set(&row->header_, | ||
| 986 | &%(s)s_col_%(c)s, | ||
| 987 | datum); | ||
| 988 | }''' % {'s': structName, 'c': columnName,'coltype':column.type.key.toCType(prefix), | ||
| 989 | - 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()} | ||
| 990 | + 'valtype':column.type.key.to_const_c_type(prefix), 'S': structName.upper()}) | ||
| 991 | # End Update/Delete of partial set | ||
| 992 | |||
| 993 | # Add clause functions. | ||
| 994 | @@ -858,8 +859,8 @@ void | ||
| 995 | column, True, refTable=False) | ||
| 996 | |||
| 997 | if type.is_smap(): | ||
| 998 | - print comment | ||
| 999 | - print """void | ||
| 1000 | + print(comment) | ||
| 1001 | + print("""void | ||
| 1002 | %(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *%(c)s) | ||
| 1003 | { | ||
| 1004 | struct ovsdb_datum datum; | ||
| 1005 | @@ -884,7 +885,7 @@ void | ||
| 1006 | 'P': prefix.upper(), | ||
| 1007 | 's': structName, | ||
| 1008 | 'S': structName.upper(), | ||
| 1009 | - 'c': columnName} | ||
| 1010 | + 'c': columnName}) | ||
| 1011 | continue | ||
| 1012 | |||
| 1013 | keyVar = members[0]['name'] | ||
| 1014 | @@ -898,73 +899,73 @@ void | ||
| 1015 | if len(members) > 1: | ||
| 1016 | nVar = members[1]['name'] | ||
| 1017 | |||
| 1018 | - print comment | ||
| 1019 | - print 'void' | ||
| 1020 | - print '%(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *cond, enum ovsdb_function function, %(args)s)' % \ | ||
| 1021 | + print(comment) | ||
| 1022 | + print('void') | ||
| 1023 | + print('%(s)s_add_clause_%(c)s(struct ovsdb_idl_condition *cond, enum ovsdb_function function, %(args)s)' % \ | ||
| 1024 | {'s': structName, 'c': columnName, | ||
| 1025 | - 'args': ', '.join(['%(type)s%(name)s' % m for m in members])} | ||
| 1026 | - print "{" | ||
| 1027 | - print " struct ovsdb_datum datum;" | ||
| 1028 | + 'args': ', '.join(['%(type)s%(name)s' % m for m in members])}) | ||
| 1029 | + print("{") | ||
| 1030 | + print(" struct ovsdb_datum datum;") | ||
| 1031 | free = [] | ||
| 1032 | if type.n_min == 1 and type.n_max == 1: | ||
| 1033 | - print " union ovsdb_atom key;" | ||
| 1034 | + print(" union ovsdb_atom key;") | ||
| 1035 | if type.value: | ||
| 1036 | - print " union ovsdb_atom value;" | ||
| 1037 | |||
| 1038 | - print " datum.n = 1;" | ||
| 1039 | - print " datum.keys = &key;" | ||
| 1040 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False) | ||
| 1041 | + print(" union ovsdb_atom value;") | ||
| 1042 | + print("") | ||
| 1043 | + print(" datum.n = 1;") | ||
| 1044 | + print(" datum.keys = &key;") | ||
| 1045 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False)) | ||
| 1046 | if type.value: | ||
| 1047 | - print " datum.values = &value;" | ||
| 1048 | - print " "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar, refTable=False) | ||
| 1049 | + print(" datum.values = &value;") | ||
| 1050 | + print(" "+ type.value.assign_c_value_casting_away_const("value.%s" % type.value.type.to_string(), valueVar, refTable=False)) | ||
| 1051 | else: | ||
| 1052 | - print " datum.values = NULL;" | ||
| 1053 | + print(" datum.values = NULL;") | ||
| 1054 | elif type.is_optional_pointer(): | ||
| 1055 | - print " union ovsdb_atom key;" | ||
| 1056 | |||
| 1057 | - print " if (%s) {" % keyVar | ||
| 1058 | - print " datum.n = 1;" | ||
| 1059 | - print " datum.keys = &key;" | ||
| 1060 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False) | ||
| 1061 | - print " } else {" | ||
| 1062 | - print " datum.n = 0;" | ||
| 1063 | - print " datum.keys = NULL;" | ||
| 1064 | - print " }" | ||
| 1065 | - print " datum.values = NULL;" | ||
| 1066 | + print(" union ovsdb_atom key;") | ||
| 1067 | + print("") | ||
| 1068 | + print(" if (%s) {" % keyVar) | ||
| 1069 | + print(" datum.n = 1;") | ||
| 1070 | + print(" datum.keys = &key;") | ||
| 1071 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), keyVar, refTable=False)) | ||
| 1072 | + print(" } else {") | ||
| 1073 | + print(" datum.n = 0;") | ||
| 1074 | + print(" datum.keys = NULL;") | ||
| 1075 | + print(" }") | ||
| 1076 | + print(" datum.values = NULL;") | ||
| 1077 | elif type.n_max == 1: | ||
| 1078 | - print " union ovsdb_atom key;" | ||
| 1079 | |||
| 1080 | - print " if (%s) {" % nVar | ||
| 1081 | - print " datum.n = 1;" | ||
| 1082 | - print " datum.keys = &key;" | ||
| 1083 | - print " " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar, refTable=False) | ||
| 1084 | - print " } else {" | ||
| 1085 | - print " datum.n = 0;" | ||
| 1086 | - print " datum.keys = NULL;" | ||
| 1087 | - print " }" | ||
| 1088 | - print " datum.values = NULL;" | ||
| 1089 | + print(" union ovsdb_atom key;") | ||
| 1090 | + print("") | ||
| 1091 | + print(" if (%s) {" % nVar) | ||
| 1092 | + print(" datum.n = 1;") | ||
| 1093 | + print(" datum.keys = &key;") | ||
| 1094 | + print(" " + type.key.assign_c_value_casting_away_const("key.%s" % type.key.type.to_string(), "*" + keyVar, refTable=False)) | ||
| 1095 | + print(" } else {") | ||
| 1096 | + print(" datum.n = 0;") | ||
| 1097 | + print(" datum.keys = NULL;") | ||
| 1098 | + print(" }") | ||
| 1099 | + print(" datum.values = NULL;") | ||
| 1100 | else: | ||
| 1101 | - print " datum.n = %s;" % nVar | ||
| 1102 | - print " datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar) | ||
| 1103 | + print(" datum.n = %s;" % nVar) | ||
| 1104 | + print(" datum.keys = %s ? xmalloc(%s * sizeof *datum.keys) : NULL;" % (nVar, nVar)) | ||
| 1105 | free += ['datum.keys'] | ||
| 1106 | if type.value: | ||
| 1107 | - print " datum.values = xmalloc(%s * sizeof *datum.values);" % nVar | ||
| 1108 | + print(" datum.values = xmalloc(%s * sizeof *datum.values);" % nVar) | ||
| 1109 | free += ['datum.values'] | ||
| 1110 | else: | ||
| 1111 | - print " datum.values = NULL;" | ||
| 1112 | - print " for (size_t i = 0; i < %s; i++) {" % nVar | ||
| 1113 | - print " " + type.key.assign_c_value_casting_away_const("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar, refTable=False) | ||
| 1114 | + print(" datum.values = NULL;") | ||
| 1115 | + print(" for (size_t i = 0; i < %s; i++) {" % nVar) | ||
| 1116 | + print(" " + type.key.assign_c_value_casting_away_const("datum.keys[i].%s" % type.key.type.to_string(), "%s[i]" % keyVar, refTable=False)) | ||
| 1117 | if type.value: | ||
| 1118 | - print " " + type.value.assign_c_value_casting_away_const("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar, refTable=False) | ||
| 1119 | - print " }" | ||
| 1120 | + print(" " + type.value.assign_c_value_casting_away_const("datum.values[i].%s" % type.value.type.to_string(), "%s[i]" % valueVar, refTable=False)) | ||
| 1121 | + print(" }") | ||
| 1122 | if type.value: | ||
| 1123 | valueType = type.value.toAtomicType() | ||
| 1124 | else: | ||
| 1125 | valueType = "OVSDB_TYPE_VOID" | ||
| 1126 | - print " ovsdb_datum_sort_unique(&datum, %s, %s);" % ( | ||
| 1127 | - type.key.toAtomicType(), valueType) | ||
| 1128 | + print(" ovsdb_datum_sort_unique(&datum, %s, %s);" % ( | ||
| 1129 | + type.key.toAtomicType(), valueType)) | ||
| 1130 | |||
| 1131 | - print""" ovsdb_idl_condition_add_clause(cond, | ||
| 1132 | + print(""" ovsdb_idl_condition_add_clause(cond, | ||
| 1133 | function, | ||
| 1134 | &%(s)s_col_%(c)s, | ||
| 1135 | &datum);\ | ||
| 1136 | @@ -974,28 +975,28 @@ void | ||
| 1137 | 'P': prefix.upper(), | ||
| 1138 | 's': structName, | ||
| 1139 | 'S': structName.upper(), | ||
| 1140 | - 'c': columnName} | ||
| 1141 | + 'c': columnName}) | ||
| 1142 | for var in free: | ||
| 1143 | - print " free(%s);" % var | ||
| 1144 | - print "}" | ||
| 1145 | + print(" free(%s);" % var) | ||
| 1146 | + print("}") | ||
| 1147 | |||
| 1148 | - print """ | ||
| 1149 | + print(""" | ||
| 1150 | void | ||
| 1151 | %(s)s_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition) | ||
| 1152 | { | ||
| 1153 | ovsdb_idl_set_condition(idl, &%(p)stable_%(tl)s, condition); | ||
| 1154 | }""" % {'p': prefix, | ||
| 1155 | 's': structName, | ||
| 1156 | - 'tl': tableName.lower()} | ||
| 1157 | + 'tl': tableName.lower()}) | ||
| 1158 | |||
| 1159 | # Table columns. | ||
| 1160 | for columnName, column in sorted_columns(table): | ||
| 1161 | prereqs = [] | ||
| 1162 | x = column.type.cInitType("%s_col_%s" % (tableName, columnName), prereqs) | ||
| 1163 | if prereqs: | ||
| 1164 | - print '\n'.join(prereqs) | ||
| 1165 | - print "\nstruct ovsdb_idl_column %s_columns[%s_N_COLUMNS] = {" % ( | ||
| 1166 | - structName, structName.upper()) | ||
| 1167 | + print('\n'.join(prereqs)) | ||
| 1168 | + print("\nstruct ovsdb_idl_column %s_columns[%s_N_COLUMNS] = {" % ( | ||
| 1169 | + structName, structName.upper())) | ||
| 1170 | for columnName, column in sorted_columns(table): | ||
| 1171 | if column.mutable: | ||
| 1172 | mutable = "true" | ||
| 1173 | @@ -1003,7 +1004,7 @@ void | ||
| 1174 | mutable = "false" | ||
| 1175 | type_init = '\n'.join(" " + x | ||
| 1176 | for x in column.type.cInitType("%s_col_%s" % (tableName, columnName), prereqs)) | ||
| 1177 | - print """\ | ||
| 1178 | + print("""\ | ||
| 1179 | [%(P)s%(T)s_COL_%(C)s] = { | ||
| 1180 | .name = "%(c)s", | ||
| 1181 | .type = { | ||
| 1182 | @@ -1018,38 +1019,38 @@ void | ||
| 1183 | 'C': columnName.upper(), | ||
| 1184 | 's': structName, | ||
| 1185 | 'mutable': mutable, | ||
| 1186 | - 'type': type_init} | ||
| 1187 | - print "};" | ||
| 1188 | + 'type': type_init}) | ||
| 1189 | + print("};") | ||
| 1190 | |||
| 1191 | # Table classes. | ||
| 1192 | - print "" | ||
| 1193 | - print "struct ovsdb_idl_table_class %stable_classes[%sN_TABLES] = {" % (prefix, prefix.upper()) | ||
| 1194 | + print("") | ||
| 1195 | + print("struct ovsdb_idl_table_class %stable_classes[%sN_TABLES] = {" % (prefix, prefix.upper())) | ||
| 1196 | for tableName, table in sorted(schema.tables.iteritems()): | ||
| 1197 | structName = "%s%s" % (prefix, tableName.lower()) | ||
| 1198 | if table.is_root: | ||
| 1199 | is_root = "true" | ||
| 1200 | else: | ||
| 1201 | is_root = "false" | ||
| 1202 | - print " {\"%s\", %s," % (tableName, is_root) | ||
| 1203 | - print " %s_columns, ARRAY_SIZE(%s_columns)," % ( | ||
| 1204 | - structName, structName) | ||
| 1205 | - print " sizeof(struct %s), %s_init__}," % (structName, structName) | ||
| 1206 | - print "};" | ||
| 1207 | + print(" {\"%s\", %s," % (tableName, is_root)) | ||
| 1208 | + print(" %s_columns, ARRAY_SIZE(%s_columns)," % ( | ||
| 1209 | + structName, structName)) | ||
| 1210 | + print(" sizeof(struct %s), %s_init__}," % (structName, structName)) | ||
| 1211 | + print("};") | ||
| 1212 | |||
| 1213 | # IDL class. | ||
| 1214 | - print "\nstruct ovsdb_idl_class %sidl_class = {" % prefix | ||
| 1215 | - print " \"%s\", %stable_classes, ARRAY_SIZE(%stable_classes)" % ( | ||
| 1216 | - schema.name, prefix, prefix) | ||
| 1217 | - print "};" | ||
| 1218 | + print("\nstruct ovsdb_idl_class %sidl_class = {" % prefix) | ||
| 1219 | + print(" \"%s\", %stable_classes, ARRAY_SIZE(%stable_classes)" % ( | ||
| 1220 | + schema.name, prefix, prefix)) | ||
| 1221 | + print("};") | ||
| 1222 | |||
| 1223 | - print """ | ||
| 1224 | + print(""" | ||
| 1225 | /* Return the schema version. The caller must not free the returned value. */ | ||
| 1226 | const char * | ||
| 1227 | %sget_db_version(void) | ||
| 1228 | { | ||
| 1229 | return "%s"; | ||
| 1230 | } | ||
| 1231 | -""" % (prefix, schema.version) | ||
| 1232 | +""" % (prefix, schema.version)) | ||
| 1233 | |||
| 1234 | |||
| 1235 | |||
| 1236 | @@ -1075,7 +1076,7 @@ def ovsdb_escape(string): | ||
| 1237 | return re.sub(r'["\\\000-\037]', escape, string) | ||
| 1238 | |||
| 1239 | def usage(): | ||
| 1240 | - print """\ | ||
| 1241 | + print("""\ | ||
| 1242 | %(argv0)s: ovsdb schema compiler | ||
| 1243 | usage: %(argv0)s [OPTIONS] COMMAND ARG... | ||
| 1244 | |||
| 1245 | @@ -1087,7 +1088,7 @@ The following commands are supported: | ||
| 1246 | The following options are also available: | ||
| 1247 | -h, --help display this help message | ||
| 1248 | -V, --version display version information\ | ||
| 1249 | -""" % {'argv0': argv0} | ||
| 1250 | +""" % {'argv0': argv0}) | ||
| 1251 | sys.exit(0) | ||
| 1252 | |||
| 1253 | if __name__ == "__main__": | ||
| 1254 | @@ -1105,7 +1106,7 @@ if __name__ == "__main__": | ||
| 1255 | if key in ['-h', '--help']: | ||
| 1256 | usage() | ||
| 1257 | elif key in ['-V', '--version']: | ||
| 1258 | - print "ovsdb-idlc (Open vSwitch) @VERSION@" | ||
| 1259 | + print("ovsdb-idlc (Open vSwitch) @VERSION@") | ||
| 1260 | elif key in ['-C', '--directory']: | ||
| 1261 | os.chdir(value) | ||
| 1262 | else: | ||
