fixed whitespace errors
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 09c4f2f..472222d 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -69,11 +69,11 @@
Should get accessor return a value rather than void
@param cls The class name
@param m_name The member name
- @return True if of_g config and the specific member allow a
+ @return True if of_g config and the specific member allow a
return value. Otherwise False
"""
m_type = of_g.unified[cls]["union"][m_name]["m_type"]
- return (config_check("get_returns") =="value" and
+ return (config_check("get_returns") =="value" and
m_type in of_g.of_scalar_types)
# TODO serialize match outside accessor?
@@ -139,7 +139,7 @@
/**
* For each identifier from an OpenFlow header file, a Loxi version
* of the identifier is generated. For example, ofp_port_flood becomes
- * OF_PORT_DEST_FLOOD. Loxi provides the following macros related to
+ * OF_PORT_DEST_FLOOD. Loxi provides the following macros related to
* OpenFlow identifiers (using OF_IDENT_ as an example below):
* OF_IDENT_BY_VERSION(version) Get the value for the specific version
* OF_IDENT_SUPPORTED(version) Boolean: Is OF_IDENT defined for version
@@ -248,7 +248,7 @@
idents.sort()
out.write("""
/****************************************************************
- * Identifiers from %s
+ * Identifiers from %s
*****************************************************************/
""" % group)
for ident in idents:
@@ -578,10 +578,10 @@
/*
* Match structs in 1.2 come at the end of the fixed length part
* of structures. They add 8 bytes to the minimal length of the
- * message, but are also variable length. This means that the
- * type/length offsets are 8 bytes back from the end of the fixed
- * length part of the object. The right way to handle this is to
- * expose the offset of the match member more explicitly. For now,
+ * message, but are also variable length. This means that the
+ * type/length offsets are 8 bytes back from the end of the fixed
+ * length part of the object. The right way to handle this is to
+ * expose the offset of the match member more explicitly. For now,
* we make the calculation as described here.
*/
@@ -613,7 +613,7 @@
* @param obj An object with a match member
* @param match_offset The wire offset of the match object.
*
- * See above; for 1.2,
+ * See above; for 1.2,
* The match length is raw bytes but the actual space it takes
* up is padded for alignment to 64-bits
*/
@@ -1187,7 +1187,7 @@
*/
#define OF_VERSION_ARRAY_MAX %d
""" % (max + 1))
-
+
def gen_object_enum(out):
"""
Generate the enumerated type for object identification in LoxiGen
@@ -1474,7 +1474,7 @@
def v3_match_offset_get(cls):
"""
- Return the offset of an OF 1.2 match in an object if it has such;
+ Return the offset of an OF 1.2 match in an object if it has such;
otherwise return -1
"""
result = field_ver_get(cls, "match")
@@ -1653,7 +1653,7 @@
* idle_timeout
* hard_timeout
*
- * Note that the actions/instructions of a flow may be modified by a
+ * Note that the actions/instructions of a flow may be modified by a
* subsequent flow modify message. To facilitate implementations,
* the "effects" parameter is provided. If effects is NULL, the
* actions/instructions are taken from the flow_add message.
@@ -1817,7 +1817,7 @@
%(i_call)s;
/* Derive offset and length of child in parent */
- OF_TRY(of_object_child_attach(parent, child,
+ OF_TRY(of_object_child_attach(parent, child,
if ((rv = of_list_first((of_object_t *)list, (of_object_t *)obj)) < 0) {
return rv;
}
@@ -1849,7 +1849,7 @@
len_str = "obj->header.length"
else:
len_str = "obj->length"
-
+
out.write("""
/**
* Advance an iterator to the next element in a list
@@ -1936,7 +1936,7 @@
#
################################################################
-
+
def gen_accessor_declarations(out):
"""
Generate the declaration of each version independent accessor
@@ -1987,7 +1987,7 @@
%(gparams)s);
""" % dict(base_name=base_name, gparams=gparams, sparams=sparams,
get_ret_type=get_ret_type, set_ret_type=set_ret_type))
-
+
if loxi_utils.class_is_list(cls):
e_type = loxi_utils.list_to_entry_type(cls)
out.write("""
@@ -2101,7 +2101,7 @@
return of_g.base_length[(m_type[:-2], version)]
print "Unknown length request", m_type, version
sys.exit(1)
-
+
def gen_get_accessor_body(out, cls, m_type, m_name):
"""
@@ -2231,7 +2231,7 @@
sub_cls = m_type[:-2]
out.write("""
/**
- * Create a copy of %(m_name)s into a new variable of type %(m_type)s from
+ * Create a copy of %(m_name)s into a new variable of type %(m_type)s from
* a %(cls)s instance.
*
* @param obj Pointer to the source of type %(cls)s_t
@@ -2602,7 +2602,7 @@
* If bytes < 0, then the default fixed length is used for the object
*
* This is a "coerce" function that sets up the pointers for the
- * accessors properly.
+ * accessors properly.
*
* If anything other than 0 is passed in for the buffer size, the underlying
* wire buffer will have 'grow' called.
@@ -2679,7 +2679,7 @@
%(name)s));
}
""" % dict(name = enum_name(cls)))
-
+
for version in of_g.of_version_range:
if type_maps.class_is_extension(cls, version):
exp_name = type_maps.extension_to_experimenter_macro_name(cls)
@@ -2697,7 +2697,7 @@
}
""" % dict(exp_name=exp_name, version=of_g.wire_ver_map[version],
subtype=str(subtype)))
-
+
else: # Not a message
if loxi_utils.class_is_tlv16(cls):
out.write("""
@@ -2714,7 +2714,7 @@
/* Extended TLV obj; Call specific accessor */
of_extension_object_id_set(obj, %(enum)s);
""" % dict(cls=cls, enum=enum_name(cls)))
-
+
if loxi_utils.class_is_oxm(cls):
out.write("""\
@@ -3175,7 +3175,7 @@
out.write("""
/**
- * Structure for %(cls)s object. Get/set
+ * Structure for %(cls)s object. Get/set
* accessors available in all versions unless noted otherwise
*
""" % dict(cls=cls))
@@ -3310,7 +3310,7 @@
""")
def gen_jump_table_template(out=sys.stdout, all_unhandled=True,
- cxn_type="ls_cxn_handle_t",
+ cxn_type="ls_cxn_handle_t",
unhandled="unhandled_message"):
"""
Generate a template for a jump table.
@@ -3340,11 +3340,11 @@
if not all_unhandled:
fn_name = "%s_handler" % cls[3:]
out.write(" %s%s /* %s */\n" % (fn_name, comma, enum_name(cls)))
-
+
out.write("};\n")
def gen_message_switch_stmt_tmeplate(out=sys.stdout, all_unhandled=True,
- cxn_type="ls_cxn_handle_t",
+ cxn_type="ls_cxn_handle_t",
unhandled="unhandled_message"):
out.write("""
/*
@@ -3533,7 +3533,7 @@
of_flow_add_idle_timeout_get(flow_add, &val16);
of_flow_removed_idle_timeout_set(obj, val16);
-
+
if (obj->version >= OF_VERSION_1_2) {
of_flow_add_hard_timeout_get(flow_add, &val16);
of_flow_removed_hard_timeout_set(obj, val16);
@@ -3550,13 +3550,13 @@
{
switch (obj->version) {
case OF_VERSION_1_0:
- return flow_removed_setup_from_flow_add_common(obj, flow_add,
+ return flow_removed_setup_from_flow_add_common(obj, flow_add,
8, 8);
break;
case OF_VERSION_1_1:
case OF_VERSION_1_2:
case OF_VERSION_1_3:
- return flow_removed_setup_from_flow_add_common(obj, flow_add,
+ return flow_removed_setup_from_flow_add_common(obj, flow_add,
48, 48);
break;
default:
@@ -3625,7 +3625,7 @@
case OF_VERSION_1_1:
case OF_VERSION_1_2:
case OF_VERSION_1_3:
- return flow_stats_entry_setup_from_flow_add_common(obj, flow_add,
+ return flow_stats_entry_setup_from_flow_add_common(obj, flow_add,
effects, 48, 48);
break;
default:
diff --git a/c_gen/c_dump_gen.py b/c_gen/c_dump_gen.py
index 08abae0..aae2dc4 100644
--- a/c_gen/c_dump_gen.py
+++ b/c_gen/c_dump_gen.py
@@ -49,7 +49,7 @@
*
* AUTOMATICALLY GENERATED FILE. Edits will be lost on regen.
*
- * Header file for object dumping.
+ * Header file for object dumping.
*/
/**
@@ -75,9 +75,9 @@
/**
- * Dump any OF object.
+ * Dump any OF object.
*/
-int of_object_dump(loci_writer_f writer, void* cookie, of_object_t* obj);
+int of_object_dump(loci_writer_f writer, void* cookie, of_object_t* obj);
@@ -110,8 +110,8 @@
*
* AUTOMATICALLY GENERATED FILE. Edits will be lost on regen.
*
- * Source file for object dumping.
- *
+ * Source file for object dumping.
+ *
*/
#define DISABLE_WARN_UNUSED_RESULT
@@ -122,9 +122,9 @@
static int
unknown_dump(loci_writer_f writer, void* cookie, of_object_t *obj)
{
- return writer(cookie, "Unable to print object of type %d, version %d\\n",
+ return writer(cookie, "Unable to print object of type %d, version %d\\n",
obj->object_id, obj->version);
-}
+}
""")
for version in of_g.of_version_range:
@@ -188,7 +188,7 @@
out.write("""
%(cls)s_%(m_name)s_bind(obj, &%(v_name)s);
out += %(sub_cls)s_%(ver_name)s_dump(writer, cookie, &%(v_name)s);
-""" % dict(cls=cls, sub_cls=sub_cls, m_name=m_name,
+""" % dict(cls=cls, sub_cls=sub_cls, m_name=m_name,
v_name=var_name_map(m_type), ver_name=ver_name))
out.write("""
@@ -236,11 +236,11 @@
if j < len(of_g.all_class_order) - 1: # Avoid ultimate comma
comma = ","
- if (not loxi_utils.class_in_version(cls, version) or
+ if (not loxi_utils.class_in_version(cls, version) or
cls in type_maps.inheritance_map):
out.write(" unknown_dump%s\n" % comma);
else:
- out.write(" %s_%s_dump%s\n" %
+ out.write(" %s_%s_dump%s\n" %
(cls, loxi_utils.version_to_name(version), comma))
out.write("};\n\n")
diff --git a/c_gen/c_match.py b/c_gen/c_match.py
index 8c27bb5..18686c4 100644
--- a/c_gen/c_match.py
+++ b/c_gen/c_match.py
@@ -600,9 +600,9 @@
of_oxm_%(key)s_masked_init(elt,
src->version, -1, 1);
of_list_oxm_append_bind(oxm_list, &oxm_entry);
- of_oxm_%(key)s_masked_value_set(elt,
+ of_oxm_%(key)s_masked_value_set(elt,
src->fields.%(key)s);
- of_oxm_%(key)s_masked_value_mask_set(elt,
+ of_oxm_%(key)s_masked_value_mask_set(elt,
src->masks.%(key)s);
} else { /* Active, but not masked */
of_oxm_%(key)s_t *elt;
@@ -900,7 +900,7 @@
of_match_v%(version)d_t wire_match;
of_match_v%(version)d_init(&wire_match,
%(ver_name)s, -1, 1);
- of_object_buffer_bind((of_object_t *)&wire_match,
+ of_object_buffer_bind((of_object_t *)&wire_match,
octets->data, octets->bytes, NULL);
OF_TRY(of_match_v%(version)d_to_match(&wire_match, match));
@@ -958,7 +958,7 @@
int idx;
for (idx = 0; idx < OF_IPV6_BYTES; idx++) {
- if ((v1->addr[idx] & mask->addr[idx]) !=
+ if ((v1->addr[idx] & mask->addr[idx]) !=
(v2->addr[idx] & mask->addr[idx])) {
return 0;
}
@@ -977,7 +977,7 @@
int idx;
for (idx = 0; idx < OF_IPV6_BYTES; idx++) {
- if (((v1->addr[idx] & m1->addr[idx]) & m2->addr[idx]) !=
+ if (((v1->addr[idx] & m1->addr[idx]) & m2->addr[idx]) !=
((v2->addr[idx] & m1->addr[idx]) & m2->addr[idx])) {
return 0;
}
@@ -1020,12 +1020,12 @@
* Boolean test if two values agree when restricted to a mask
*/
static inline int
-of_restricted_match_mac_addr(of_mac_addr_t *v1, of_mac_addr_t *v2,
+of_restricted_match_mac_addr(of_mac_addr_t *v1, of_mac_addr_t *v2,
of_mac_addr_t *mask) {
int idx;
for (idx = 0; idx < OF_MAC_ADDR_BYTES; idx++) {
- if ((v1->addr[idx] & mask->addr[idx]) !=
+ if ((v1->addr[idx] & mask->addr[idx]) !=
(v2->addr[idx] & mask->addr[idx])) {
return 0;
}
@@ -1044,7 +1044,7 @@
int idx;
for (idx = 0; idx < OF_MAC_ADDR_BYTES; idx++) {
- if (((v1->addr[idx] & m1->addr[idx]) & m2->addr[idx]) !=
+ if (((v1->addr[idx] & m1->addr[idx]) & m2->addr[idx]) !=
((v2->addr[idx] & m1->addr[idx]) & m2->addr[idx])) {
return 0;
}
@@ -1147,7 +1147,7 @@
%(q_m)s)) {
return 0;
}
-""" % dict(match_type=match_type, comp=comp, q_f=q_f, e_f=e_f,
+""" % dict(match_type=match_type, comp=comp, q_f=q_f, e_f=e_f,
q_m=q_m, e_m=e_m, key=key))
out.write("""
@@ -1193,7 +1193,7 @@
f2 = "f2->%s" % key
out.write("""
/* Check overlap for %(key)s */
- if (!%(check)s(%(f1)s, %(f2)s,
+ if (!%(check)s(%(f1)s, %(f2)s,
%(m2)s, %(m1)s)) {
return 0; /* This field differentiates; all done */
}
diff --git a/c_gen/c_show_gen.py b/c_gen/c_show_gen.py
index 14709ab..0ec81b4 100644
--- a/c_gen/c_show_gen.py
+++ b/c_gen/c_show_gen.py
@@ -49,7 +49,7 @@
*
* AUTOMATICALLY GENERATED FILE. Edits will be lost on regen.
*
- * Header file for object showing.
+ * Header file for object showing.
*/
/**
@@ -75,9 +75,9 @@
/**
- * Show any OF object.
+ * Show any OF object.
*/
-int of_object_show(loci_writer_f writer, void* cookie, of_object_t* obj);
+int of_object_show(loci_writer_f writer, void* cookie, of_object_t* obj);
@@ -110,8 +110,8 @@
*
* AUTOMATICALLY GENERATED FILE. Edits will be lost on regen.
*
- * Source file for object showing.
- *
+ * Source file for object showing.
+ *
*/
#define DISABLE_WARN_UNUSED_RESULT
@@ -122,9 +122,9 @@
static int
unknown_show(loci_writer_f writer, void* cookie, of_object_t *obj)
{
- return writer(cookie, "Unable to print object of type %d, version %d\\n",
+ return writer(cookie, "Unable to print object of type %d, version %d\\n",
obj->object_id, obj->version);
-}
+}
""")
for version in of_g.of_version_range:
@@ -158,7 +158,7 @@
m_type = member["m_type"]
m_name = member["name"]
#emitter = "LOCI_SHOW_" + loxi_utils.type_to_short_name(m_type)
- emitter = "LOCI_SHOW_" + loxi_utils.type_to_short_name(m_type) + "_" + m_name;
+ emitter = "LOCI_SHOW_" + loxi_utils.type_to_short_name(m_type) + "_" + m_name;
if loxi_utils.skip_member_name(m_name):
continue
if (loxi_utils.type_is_scalar(m_type) or
@@ -167,7 +167,7 @@
%(cls)s_%(m_name)s_get(obj, &%(v_name)s);
out += writer(cookie, "%(m_name)s=");
out += %(emitter)s(writer, cookie, %(v_name)s);
- out += writer(cookie, " ");
+ out += writer(cookie, " ");
""" % dict(cls=cls, m_name=m_name, m_type=m_type,
v_name=var_name_map(m_type), emitter=emitter))
elif loxi_utils.class_is_list(m_type):
@@ -179,7 +179,7 @@
%(u_type)s_ITER(&%(v_name)s, &elt, rv) {
of_object_show(writer, cookie, (of_object_t *)&elt);
}
- out += writer(cookie, "} ");
+ out += writer(cookie, "} ");
""" % dict(sub_cls=sub_cls, u_type=sub_cls.upper(), v_name=var_name_map(m_type),
elt_type=elt_type, cls=cls, m_name=m_name, m_type=m_type))
else:
@@ -187,7 +187,7 @@
out.write("""
%(cls)s_%(m_name)s_bind(obj, &%(v_name)s);
out += %(sub_cls)s_%(ver_name)s_show(writer, cookie, &%(v_name)s);
-""" % dict(cls=cls, sub_cls=sub_cls, m_name=m_name,
+""" % dict(cls=cls, sub_cls=sub_cls, m_name=m_name,
v_name=var_name_map(m_type), ver_name=ver_name))
out.write("""
@@ -207,12 +207,12 @@
for key, entry in match.of_match_members.items():
m_type = entry["m_type"]
#emitter = "LOCI_SHOW_" + loxi_utils.type_to_short_name(m_type)
- emitter = "LOCI_SHOW_" + loxi_utils.type_to_short_name(m_type) + "_" + key;
+ emitter = "LOCI_SHOW_" + loxi_utils.type_to_short_name(m_type) + "_" + key;
out.write("""
if (OF_MATCH_MASK_%(ku)s_ACTIVE_TEST(match)) {
- out += writer(cookie, "%(key)s active=");
+ out += writer(cookie, "%(key)s active=");
out += %(emitter)s(writer, cookie, match->fields.%(key)s);
- out += writer(cookie, "/");
+ out += writer(cookie, "/");
out += %(emitter)s(writer, cookie, match->masks.%(key)s);
out += writer(cookie, " ");
}
@@ -234,11 +234,11 @@
if j < len(of_g.all_class_order) - 1: # Avoid ultimate comma
comma = ","
- if (not loxi_utils.class_in_version(cls, version) or
+ if (not loxi_utils.class_in_version(cls, version) or
cls in type_maps.inheritance_map):
out.write(" unknown_show%s\n" % comma);
else:
- out.write(" %s_%s_show%s\n" %
+ out.write(" %s_%s_show%s\n" %
(cls, loxi_utils.version_to_name(version), comma))
out.write("};\n\n")
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index 97cc78d..3609f98 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -83,11 +83,11 @@
of_fm_cmd_t="fm_cmd",
of_wc_bmap_t="wc_bmap",
of_match_bmap_t = "match_bmap",
- of_port_name_t="port_name",
+ of_port_name_t="port_name",
of_table_name_t="table_name",
of_desc_str_t="desc_str",
- of_serial_num_t="ser_num",
- of_mac_addr_t="mac_addr",
+ of_serial_num_t="ser_num",
+ of_mac_addr_t="mac_addr",
of_ipv6_t="ipv6",
# Non-scalars; more TBD
of_octets_t="octets",
@@ -104,7 +104,7 @@
"of_port_no_t", "of_fm_cmd_t", "of_wc_bmap_t",
"of_match_bmap_t"]
string_types = [ "of_port_name_t", "of_table_name_t",
- "of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
+ "of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
"of_ipv6_t"]
scalar_types = integer_types[:]
@@ -240,7 +240,7 @@
for key, entry in match.of_match_members.items():
out.write("""
- if (!(of_match_incompat[version] &
+ if (!(of_match_incompat[version] &
OF_OXM_BIT(OF_OXM_INDEX_%(ku)s))) {
OF_MATCH_MASK_%(ku)s_EXACT_SET(match);
VAR_%(u_type)s_INIT(match->fields.%(key)s, value);
@@ -362,7 +362,7 @@
* Declarations for list population and check primitives
*/
""")
-
+
for version in of_g.of_version_range:
for cls in of_g.ordered_list_objects:
if cls in type_maps.inheritance_map:
@@ -411,7 +411,7 @@
int exit_on_error = 1;
/**
- * Global error state: 0 is okay, 1 is error
+ * Global error state: 0 is okay, 1 is error
*/
int global_error = 0;
@@ -501,7 +501,7 @@
out.write(" RUN_TEST(%s_scalar);\n" % test_name)
out.write(" return TEST_PASS;\n}\n");
-
+
def message_scalar_test(out, version, cls):
"""
Generate one test case for the given version and class
@@ -523,7 +523,7 @@
TEST_ASSERT(obj->length == %(length)d);
TEST_ASSERT(obj->parent == NULL);
TEST_ASSERT(obj->object_id == %(u_cls)s);
-""" % dict(cls=cls, u_cls=cls.upper(),
+""" % dict(cls=cls, u_cls=cls.upper(),
v_name=v_name, length=length, version=version))
if not type_maps.class_is_virtual(cls):
out.write("""
@@ -539,7 +539,7 @@
/* Check values just set */
TEST_ASSERT(%(cls)s_%(v_name)s_check_scalars(obj, 1) != 0);
-""" % dict(cls=cls, u_cls=cls.upper(),
+""" % dict(cls=cls, u_cls=cls.upper(),
v_name=v_name, length=length, version=version))
out.write("""
@@ -566,7 +566,7 @@
for member in members:
m_type = member["m_type"]
m_name = member["name"]
- if (not loxi_utils.type_is_scalar(m_type) or
+ if (not loxi_utils.type_is_scalar(m_type) or
ignore_member(cls, version, m_name, m_type)):
continue
if not m_type in member_types:
@@ -580,8 +580,8 @@
"""
out.write("""
/**
- * Populate the scalar values in obj of type %(cls)s,
- * version %(v_name)s
+ * Populate the scalar values in obj of type %(cls)s,
+ * version %(v_name)s
* @param obj Pointer to an object to populate
* @param value The seed value to use in populating the object
* @returns The value after increments for this object's values
@@ -608,11 +608,11 @@
return value;
}
""")
-
+
out.write("""
/**
- * Check scalar values in obj of type %(cls)s,
- * version %(v_name)s
+ * Check scalar values in obj of type %(cls)s,
+ * version %(v_name)s
* @param obj Pointer to an object to check
* @param value Starting value for checking
* @returns The value after increments for this object's values
@@ -644,7 +644,7 @@
def gen_scalar_set_check_funs(out):
"""
- For each object class with scalar members, generate functions that
+ For each object class with scalar members, generate functions that
set and check their values
"""
for version in of_g.of_version_range:
@@ -658,7 +658,7 @@
base_type = loxi_utils.list_to_entry_type(cls)
setup_template = """
%(subcls)s_init(%(inst)s, %(v_name)s, -1, 1);
- %(cls)s_append_bind(list,
+ %(cls)s_append_bind(list,
(%(base_type)s_t *)%(inst)s);
value = %(subcls)s_%(v_name)s_populate(
%(inst)s, value);
@@ -670,8 +670,8 @@
""" % subcls)
for i in range(2):
out.write(setup_template %
- dict(inst=instance, subcls=subcls, v_name=v_name,
- base_type=base_type, cls=cls, inst_len=inst_len,
+ dict(inst=instance, subcls=subcls, v_name=v_name,
+ base_type=base_type, cls=cls, inst_len=inst_len,
version=version))
def check_instance(out, cls, subcls, instance, v_name, inst_len, version, last):
@@ -695,7 +695,7 @@
"""
out.write("\n /* Check two instances of type %s */" % instance)
- out.write(check_template %
+ out.write(check_template %
dict(elt_name=loxi_utils.enum_name(subcls), inst_len=inst_len,
inst=instance, subcls=subcls,
v_name=loxi_utils.version_to_name(version)))
@@ -703,7 +703,7 @@
TEST_OK(%(cls)s_next(list, &elt));
""" % dict(cls=cls))
- out.write(check_template %
+ out.write(check_template %
dict(elt_name=loxi_utils.enum_name(subcls), inst_len=inst_len,
inst=instance, subcls=subcls,
v_name=loxi_utils.version_to_name(version)))
@@ -735,7 +735,7 @@
%(base_type)s_t elt;
int cur_len = 0;
""" % dict(cls=cls, base_type=base_type))
-
+
sub_classes = type_maps.sub_class_map(base_type, version)
v_name = loxi_utils.version_to_name(version)
@@ -770,7 +770,7 @@
"""
out.write("""
/**
- * Check a list of type %(cls)s generated by
+ * Check a list of type %(cls)s generated by
* list_setup_%(cls)s_%(v_name)s
*/
int
@@ -782,7 +782,7 @@
out.write("""
%(base_type)s_t elt;
""" % dict(cls=cls, base_type=base_type))
-
+
sub_classes = type_maps.sub_class_map(base_type, version)
v_name = loxi_utils.version_to_name(version)
@@ -804,7 +804,7 @@
inst_len = -1
else:
inst_len = loxi_utils.base_type_to_length(base_type, version)
- check_instance(out, cls, base_type, "elt_p", v_name, inst_len,
+ check_instance(out, cls, base_type, "elt_p", v_name, inst_len,
version, True)
else:
count = 0
@@ -814,7 +814,7 @@
inst_len = -1
else:
inst_len = of_g.base_length[(subcls, version)]
- check_instance(out, cls, subcls, instance, v_name, inst_len,
+ check_instance(out, cls, subcls, instance, v_name, inst_len,
version, count==len(sub_classes))
out.write("""
@@ -856,7 +856,7 @@
value = list_setup_%(cls)s_%(v_name)s(list, value);
TEST_ASSERT(value != 0);
-""" % dict(cls=cls, base_type=base_type, v_name=loxi_utils.version_to_name(version),
+""" % dict(cls=cls, base_type=base_type, v_name=loxi_utils.version_to_name(version),
enum_cls=loxi_utils.enum_name(cls)))
out.write("""
@@ -890,7 +890,7 @@
#include <locitest/test_common.h>
""")
-
+
for version in of_g.of_version_range:
v_name = loxi_utils.version_to_name(version)
out.write("""
@@ -1034,9 +1034,9 @@
out.write("""
/* Serialize to version %(v_name)s */
TEST_ASSERT((value = of_match_populate(&match1, %(v_name)s, value)) > 0);
- TEST_ASSERT(of_match_serialize(%(v_name)s, &match1, &octets) ==
+ TEST_ASSERT(of_match_serialize(%(v_name)s, &match1, &octets) ==
OF_ERROR_NONE);
- TEST_ASSERT(of_match_deserialize(%(v_name)s, &match2, &octets) ==
+ TEST_ASSERT(of_match_deserialize(%(v_name)s, &match2, &octets) ==
OF_ERROR_NONE);
TEST_ASSERT(memcmp(&match1, &match2, sizeof(match1)) == 0);
FREE(octets.data);
@@ -1132,7 +1132,7 @@
out.write(" RUN_TEST(%s);\n" % test_name)
out.write("\n return TEST_PASS;\n}\n");
-
+
def gen_list_setup_check(out, cls, version):
"""
@@ -1156,7 +1156,7 @@
%(base_type)s_t elt;
int cur_len = 0;
""" % dict(cls=cls, base_type=base_type))
-
+
sub_classes = type_maps.sub_class_map(base_type, version)
v_name = loxi_utils.version_to_name(version)
@@ -1188,7 +1188,7 @@
else:
for instance, subcls in sub_classes:
inst_len = of_g.base_length[(subcls, version)]
- setup_instance(out, cls, subcls, instance, v_name,
+ setup_instance(out, cls, subcls, instance, v_name,
inst_len, version)
out.write("""
return value;
@@ -1196,7 +1196,7 @@
""")
out.write("""
/**
- * Check a list of type %(cls)s generated by
+ * Check a list of type %(cls)s generated by
* %(cls)s_%(v_name)s_populate
* @param list Pointer to the list that was populated
* @param value Starting value for checking
@@ -1213,7 +1213,7 @@
int count = 0;
int rv;
""" % dict(cls=cls, base_type=base_type))
-
+
sub_classes = type_maps.sub_class_map(base_type, version)
v_name = loxi_utils.version_to_name(version)
@@ -1238,7 +1238,7 @@
inst_len = -1
else:
inst_len = loxi_utils.base_type_to_length(base_type, version)
- check_instance(out, cls, base_type, "elt_p", v_name, inst_len,
+ check_instance(out, cls, base_type, "elt_p", v_name, inst_len,
version, True)
else:
count = 0
@@ -1248,7 +1248,7 @@
inst_len = -1
else:
inst_len = of_g.base_length[(subcls, version)]
- check_instance(out, cls, subcls, instance, v_name, inst_len,
+ check_instance(out, cls, subcls, instance, v_name, inst_len,
version, count==len(sub_classes))
out.write("""
""" % dict(base_type=base_type))
@@ -1332,7 +1332,7 @@
/* Test bind */
%(cls)s_%(m_name)s_bind(obj, &sub_cls);
}
-""" % dict(var_name=var_name_map(m_type), cls=cls,
+""" % dict(var_name=var_name_map(m_type), cls=cls,
m_name=m_name, sub_cls=sub_cls,
v_name=loxi_utils.version_to_name(version)))
@@ -1355,7 +1355,7 @@
TEST_ASSERT(value != 0);
%(cls)s_%(m_name)s_set(
obj, &%(var_name)s);
-""" % dict(cls=cls, var_name=var_name_map(m_type),
+""" % dict(cls=cls, var_name=var_name_map(m_type),
m_name=m_name, v_name=loxi_utils.version_to_name(version)))
elif m_type == "of_octets_t":
out.write("""\
@@ -1498,7 +1498,7 @@
TEST_ASSERT(obj->length == %(length)d);
TEST_ASSERT(obj->parent == NULL);
TEST_ASSERT(obj->object_id == %(u_cls)s);
-""" % dict(cls=cls, u_cls=cls.upper(),
+""" % dict(cls=cls, u_cls=cls.upper(),
v_name=v_name, length=length, version=version))
if (not type_maps.class_is_virtual(cls)) or loxi_utils.class_is_list(cls):
out.write("""
@@ -1522,7 +1522,7 @@
/* Check values just set */
TEST_ASSERT(%(cls)s_%(v_name)s_check(
obj, 1) != 0);
-""" % dict(cls=cls, u_cls=cls.upper(),
+""" % dict(cls=cls, u_cls=cls.upper(),
v_name=v_name, length=length, version=version))
out.write("""
@@ -1602,7 +1602,7 @@
elt_type = loxi_utils.list_to_entry_type(cls)
out.write("""
/**
- * Duplicate a list of type %(cls)s
+ * Duplicate a list of type %(cls)s
* using accessor functions
* @param src Pointer to object to be duplicated
* @returns A new object of type %(cls)s.
@@ -1643,7 +1643,7 @@
ver_name = loxi_utils.version_to_name(version)
out.write("""
/**
- * Duplicate a super class object of type %(cls)s
+ * Duplicate a super class object of type %(cls)s
* @param src Pointer to object to be duplicated
* @returns A new object of type %(cls)s.
*
@@ -1680,7 +1680,7 @@
out.write("""
/**
- * Duplicate an object of type %(cls)s
+ * Duplicate an object of type %(cls)s
* using accessor functions
* @param src Pointer to object to be duplicated
* @returns A new object of type %(cls)s.
@@ -1741,7 +1741,7 @@
}
%(cls)s_%(m_name)s_set(dst, dst_%(v_name)s);
%(sub_cls)s_delete(dst_%(v_name)s);
-""" % dict(sub_cls=sub_cls, cls=cls, m_name=m_name,
+""" % dict(sub_cls=sub_cls, cls=cls, m_name=m_name,
v_name=var_name_map(m_type), ver_name=ver_name))
out.write("""
@@ -1902,7 +1902,7 @@
of_object_dump((loci_writer_f)fprintf, out, obj);
of_object_delete(obj);
""" % dict(cls=cls, version=of_g.of_version_wire2name[version]))
-
+
out.write("""
fclose(out);
return TEST_PASS;
diff --git a/c_gen/c_type_maps.py b/c_gen/c_type_maps.py
index d790c85..578bf0a 100644
--- a/c_gen/c_type_maps.py
+++ b/c_gen/c_type_maps.py
@@ -61,46 +61,46 @@
comma = ","
if cls in type_maps.stats_reply_list:
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_stats_reply", version)],
comma, cls))
elif cls in type_maps.stats_request_list:
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_stats_request", version)],
comma, cls))
elif cls in type_maps.flow_mod_list:
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_flow_mod", version)],
comma, cls))
elif (cls, version) in type_maps.type_val:
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[(cls, version)], comma, cls))
elif type_maps.message_is_extension(cls, version):
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_experimenter", version)],
comma, cls))
elif type_maps.action_is_extension(cls, version):
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_action_experimenter",
version)],
comma, cls))
elif type_maps.action_id_is_extension(cls, version):
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_action_id_experimenter",
version)],
comma, cls))
elif type_maps.instruction_is_extension(cls, version):
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_instruction_experimenter",
version)],
comma, cls))
elif type_maps.queue_prop_is_extension(cls, version):
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_queue_prop_experimenter",
version)],
comma, cls))
elif type_maps.table_feature_prop_is_extension(cls, version):
- out.write(" %d%s /* %s */\n" %
+ out.write(" %d%s /* %s */\n" %
(type_maps.type_val[("of_table_feature_prop_experimenter",
version)],
comma, cls))
@@ -142,7 +142,7 @@
if type_maps.class_is_extension(cls, version):
exp_name = type_maps.extension_to_experimenter_macro_name(cls)
subtype = type_maps.extension_to_subtype(cls, version)
- out.write(" {1, %s, %d}%s /* %s */\n" %
+ out.write(" {1, %s, %d}%s /* %s */\n" %
(exp_name, subtype, comma, cls))
else:
out.write(" {0, 0, 0}%s /* %s (non-extension) */\n" %
@@ -219,7 +219,7 @@
out.write("""
};
-""" % dict(name=type_str, u_name=type_str.upper(),
+""" % dict(name=type_str, u_name=type_str.upper(),
max_val=max_val, c_name=prefix.lower()))
def gen_type_maps(out):
@@ -238,7 +238,7 @@
"OF_ACTION_ID_%s", type_maps.action_id_types,
max_type_value)
gen_type_to_object_id(out, "instruction_type_to_id", "OF_INSTRUCTION",
- "OF_INSTRUCTION_%s", type_maps.instruction_types,
+ "OF_INSTRUCTION_%s", type_maps.instruction_types,
max_type_value)
gen_type_to_object_id(out, "queue_prop_type_to_id", "OF_QUEUE_PROP",
"OF_QUEUE_PROP_%s", type_maps.queue_prop_types,
@@ -301,10 +301,10 @@
* @param version The version associated with the check
* @return The %(name)s OF object type
* @return OF_OBJECT_INVALID if type does not map to an object
- *
+ *
*/
static inline of_object_id_t
-of_%(name)s_to_object_id(int %(name)s, of_version_t version)
+of_%(name)s_to_object_id(int %(name)s, of_version_t version)
{
if (!OF_VERSION_OKAY(version)) {
return OF_OBJECT_INVALID;
@@ -332,10 +332,10 @@
* @param version The version associated with the check
* @return The %(name)s OF object type
* @return OF_OBJECT_INVALID if type does not map to an object
- *
+ *
*/
static inline of_object_id_t
-of_%(name)s_to_object_id(int %(name)s, of_version_t version)
+of_%(name)s_to_object_id(int %(name)s, of_version_t version)
{
if (!OF_VERSION_OKAY(version)) {
return OF_OBJECT_INVALID;
@@ -367,10 +367,10 @@
* @param version The version associated with the check
* @return The %(name)s OF object type
* @return OF_OBJECT_INVALID if type does not map to an object
- *
+ *
*/
static inline of_object_id_t
-of_%(name)s_to_object_id(int %(name)s, of_version_t version)
+of_%(name)s_to_object_id(int %(name)s, of_version_t version)
{
if (!OF_VERSION_OKAY(version)) {
return OF_OBJECT_INVALID;
@@ -417,7 +417,7 @@
for version, experimenter_lists in type_maps.extension_message_subtype.items():
for exp, subtypes in experimenter_lists.items():
experimenter_function += """
- if ((experimenter_id == OF_EXPERIMENTER_ID_%(exp_name)s) &&
+ if ((experimenter_id == OF_EXPERIMENTER_ID_%(exp_name)s) &&
(version == %(ver_name)s)) {
""" % dict(exp_name=exp.upper(), ver_name=of_g.wire_ver_map[version])
for ext_msg, subtype in subtypes.items():
@@ -510,69 +510,69 @@
# Action types array gen
ar_len = type_maps.type_array_len(type_maps.action_types, max_type_value)
- out.write(map_with_experimenter_template %
+ out.write(map_with_experimenter_template %
dict(name="action", u_name="ACTION", ar_len=ar_len))
# Action ID types array gen
ar_len = type_maps.type_array_len(type_maps.action_id_types, max_type_value)
- out.write(map_with_experimenter_template %
+ out.write(map_with_experimenter_template %
dict(name="action_id", u_name="ACTION_ID", ar_len=ar_len))
# Instruction types array gen
ar_len = type_maps.type_array_len(type_maps.instruction_types,
max_type_value)
- out.write(map_with_experimenter_template %
+ out.write(map_with_experimenter_template %
dict(name="instruction", u_name="INSTRUCTION", ar_len=ar_len))
# Queue prop types array gen
ar_len = type_maps.type_array_len(type_maps.queue_prop_types,
max_type_value)
- out.write(map_with_experimenter_template %
+ out.write(map_with_experimenter_template %
dict(name="queue_prop", u_name="QUEUE_PROP", ar_len=ar_len))
# Table feature prop types array gen
ar_len = type_maps.type_array_len(type_maps.table_feature_prop_types,
max_type_value)
- out.write(map_with_experimenter_template %
+ out.write(map_with_experimenter_template %
dict(name="table_feature_prop", u_name="TABLE_FEATURE_PROP",
ar_len=ar_len))
# Meter band types array gen
ar_len = type_maps.type_array_len(type_maps.meter_band_types,
max_type_value)
- out.write(map_with_experimenter_template %
+ out.write(map_with_experimenter_template %
dict(name="meter_band", u_name="METER_BAND", ar_len=ar_len))
# Hello elem types array gen
ar_len = type_maps.type_array_len(type_maps.hello_elem_types,
max_type_value)
- out.write(map_template %
+ out.write(map_template %
dict(name="hello_elem", u_name="HELLO_ELEM", ar_len=ar_len))
# Stats types array gen
ar_len = type_maps.type_array_len(type_maps.stats_types,
max_type_value)
- out.write(stats_template %
+ out.write(stats_template %
dict(name="stats_reply", u_name="STATS_REPLY", ar_len=ar_len))
- out.write(stats_template %
- dict(name="stats_request", u_name="STATS_REQUEST",
+ out.write(stats_template %
+ dict(name="stats_request", u_name="STATS_REQUEST",
ar_len=ar_len))
ar_len = type_maps.type_array_len(type_maps.flow_mod_types, max_type_value)
- out.write(map_template %
+ out.write(map_template %
dict(name="flow_mod", u_name="FLOW_MOD", ar_len=ar_len))
ar_len = type_maps.type_array_len(type_maps.oxm_types, max_type_value)
out.write("""
/* NOTE: We could optimize the OXM and only generate OF 1.2 versions. */
""")
- out.write(map_template %
+ out.write(map_template %
dict(name="oxm", u_name="OXM", ar_len=ar_len))
out.write(experimenter_function)
# Must follow stats reply/request
ar_len = type_maps.type_array_len(type_maps.message_types, max_type_value)
- out.write(msg_template %
+ out.write(msg_template %
dict(name="message", u_name="MESSAGE", ar_len=ar_len))
def gen_obj_to_type_map_functions(out):
@@ -784,7 +784,7 @@
out.write("""
/**
- * Generic experimenter type value. Applies to all except
+ * Generic experimenter type value. Applies to all except
* top level message: Action, instruction, error, stats, queue_props, oxm
*/
#define OF_EXPERIMENTER_TYPE 0xffff
@@ -926,7 +926,7 @@
out.write("""
/**
* Special length calculation for %(cls)s->%(name)s.
- * @param obj An object of type %(cls)s to check for
+ * @param obj An object of type %(cls)s to check for
* length of %(name)s
* @param bytes[out] Where to store the calculated length
*
@@ -937,7 +937,7 @@
/**
* Special offset calculation for %(cls)s->%(name)s.
- * @param obj An object of type %(cls)s to check for
+ * @param obj An object of type %(cls)s to check for
* length of %(name)s
* @param offset[out] Where to store the calculated length
*
@@ -966,7 +966,7 @@
# */
# extern int of_length_%(s_cls)s_get(
# %(cls)s_t *obj, int *bytes);
-# """ % dict(cls=cls, s_cls=s_cls))
+# """ % dict(cls=cls, s_cls=s_cls))
out.write("""
/****************************************************************
@@ -992,15 +992,15 @@
extern void of_action_wire_object_id_get(of_object_t *obj, of_object_id_t *id);
extern void of_action_id_wire_object_id_get(of_object_t *obj, of_object_id_t *id);
-extern void of_instruction_wire_object_id_get(of_object_t *obj,
+extern void of_instruction_wire_object_id_get(of_object_t *obj,
of_object_id_t *id);
-extern void of_queue_prop_wire_object_id_get(of_object_t *obj,
+extern void of_queue_prop_wire_object_id_get(of_object_t *obj,
of_object_id_t *id);
-extern void of_table_feature_prop_wire_object_id_get(of_object_t *obj,
+extern void of_table_feature_prop_wire_object_id_get(of_object_t *obj,
of_object_id_t *id);
-extern void of_meter_band_wire_object_id_get(of_object_t *obj,
+extern void of_meter_band_wire_object_id_get(of_object_t *obj,
of_object_id_t *id);
-extern void of_hello_elem_wire_object_id_get(of_object_t *obj,
+extern void of_hello_elem_wire_object_id_get(of_object_t *obj,
of_object_id_t *id);
/** @fixme VERIFY LENGTH IS NUMBER OF BYTES OF ENTRY INCLUDING HDR */
@@ -1064,7 +1064,7 @@
};
""")
-
+
################################################################
################################################################
diff --git a/c_gen/c_validator_gen.py b/c_gen/c_validator_gen.py
index 3ab6acf..f617175 100644
--- a/c_gen/c_validator_gen.py
+++ b/c_gen/c_validator_gen.py
@@ -210,9 +210,9 @@
""" % dict(m_name=m_name, m_offset=m_offset, cls=cls))
else:
out.write("""
-
+
{ int %(m_name)s_len = len - %(m_offset)s;
-
+
""" % dict(m_name=m_name, m_offset=m_offset))
out.write("""
if (%(m_cls)s_%(ver_name)s_validate(buf + %(m_offset)s, %(m_name)s_len) < 0) {
@@ -240,7 +240,7 @@
subclasses = type_maps.inheritance_map[e_cls]
out.write("""\
while (len >= %(fixed_len)s) {
- of_object_id_t e_id;
+ of_object_id_t e_id;
uint16_t e_type, e_len;
buf_u16_get(buf, &e_type);
buf_u16_get(buf+2, &e_len);