Skip to content

Commit

Permalink
fixed whitespace errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andi-bigswitch committed May 2, 2013
1 parent fe49b41 commit 5325616
Show file tree
Hide file tree
Showing 16 changed files with 3,958 additions and 3,958 deletions.
60 changes: 30 additions & 30 deletions c_gen/c_code_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def member_returns_val(cls, m_name):
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?
Expand Down Expand Up @@ -139,7 +139,7 @@ def identifiers_gen(out, filename):
/**
* 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
Expand Down Expand Up @@ -248,7 +248,7 @@ def identifiers_gen(out, filename):
idents.sort()
out.write("""
/****************************************************************
* Identifiers from %s
* Identifiers from %s
*****************************************************************/
""" % group)
for ident in idents:
Expand Down Expand Up @@ -578,10 +578,10 @@ def gen_len_offset_macros(out):
/*
* 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.
*/
Expand Down Expand Up @@ -613,7 +613,7 @@ def gen_len_offset_macros(out):
* @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
*/
Expand Down Expand Up @@ -1187,7 +1187,7 @@ def gen_version_enum(out):
*/
#define OF_VERSION_ARRAY_MAX %d
""" % (max + 1))

def gen_object_enum(out):
"""
Generate the enumerated type for object identification in LoxiGen
Expand Down Expand Up @@ -1474,7 +1474,7 @@ def field_ver_get(cls, m_name):

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")
Expand Down Expand Up @@ -1653,7 +1653,7 @@ def gen_flow_add_setup_function_declarations(out):
* 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.
Expand Down Expand Up @@ -1817,7 +1817,7 @@ def gen_bind(out, cls, m_name, m_type):
%(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;
}
Expand Down Expand Up @@ -1849,7 +1849,7 @@ def gen_list_next(out, cls, e_type):
len_str = "obj->header.length"
else:
len_str = "obj->length"

out.write("""
/**
* Advance an iterator to the next element in a list
Expand Down Expand Up @@ -1936,7 +1936,7 @@ def gen_list_accessors(out, cls):
#
################################################################


def gen_accessor_declarations(out):
"""
Generate the declaration of each version independent accessor
Expand Down Expand Up @@ -1987,7 +1987,7 @@ def gen_accessor_declarations(out):
%(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("""
Expand Down Expand Up @@ -2101,7 +2101,7 @@ def length_of(m_type, version):
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):
"""
Expand Down Expand Up @@ -2231,7 +2231,7 @@ def gen_of_object_get(out, cls, m_name, m_type):
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
Expand Down Expand Up @@ -2602,7 +2602,7 @@ def gen_init_fn_body(cls, out):
* 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.
Expand Down Expand Up @@ -2679,7 +2679,7 @@ def gen_wire_push_fn(cls, out):
%(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)
Expand All @@ -2697,7 +2697,7 @@ def gen_wire_push_fn(cls, out):
}
""" % 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("""
Expand All @@ -2714,7 +2714,7 @@ def gen_wire_push_fn(cls, out):
/* 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("""\
Expand Down Expand Up @@ -3175,7 +3175,7 @@ def gen_accessor_doc(out, name):

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))
Expand Down Expand Up @@ -3310,7 +3310,7 @@ def gen_code_samples(out, name):
""")

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.
Expand Down Expand Up @@ -3340,11 +3340,11 @@ def gen_jump_table_template(out=sys.stdout, all_unhandled=True,
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("""
/*
Expand Down Expand Up @@ -3533,7 +3533,7 @@ def gen_setup_from_add_fns(out):
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);
Expand All @@ -3550,13 +3550,13 @@ def gen_setup_from_add_fns(out):
{
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:
Expand Down Expand Up @@ -3625,7 +3625,7 @@ def gen_setup_from_add_fns(out):
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:
Expand Down
20 changes: 10 additions & 10 deletions c_gen/c_dump_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def gen_obj_dump_h(out, name):
*
* AUTOMATICALLY GENERATED FILE. Edits will be lost on regen.
*
* Header file for object dumping.
* Header file for object dumping.
*/
/**
Expand All @@ -75,9 +75,9 @@ def gen_obj_dump_h(out, name):
/**
* 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);
Expand Down Expand Up @@ -110,8 +110,8 @@ def gen_obj_dump_c(out, name):
*
* AUTOMATICALLY GENERATED FILE. Edits will be lost on regen.
*
* Source file for object dumping.
*
* Source file for object dumping.
*
*/
#define DISABLE_WARN_UNUSED_RESULT
Expand All @@ -122,9 +122,9 @@ def gen_obj_dump_c(out, name):
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:
Expand Down Expand Up @@ -188,7 +188,7 @@ def gen_obj_dump_c(out, name):
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("""
Expand Down Expand Up @@ -236,11 +236,11 @@ def gen_obj_dump_c(out, name):
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")

Expand Down
20 changes: 10 additions & 10 deletions c_gen/c_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,9 @@ def gen_unified_match_to_v3(out):
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;
Expand Down Expand Up @@ -900,7 +900,7 @@ def gen_deserialize(out):
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));
Expand Down Expand Up @@ -958,7 +958,7 @@ def gen_match_comp(out=sys.stdout):
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;
}
Expand All @@ -977,7 +977,7 @@ def gen_match_comp(out=sys.stdout):
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;
}
Expand Down Expand Up @@ -1020,12 +1020,12 @@ def gen_match_comp(out=sys.stdout):
* 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;
}
Expand All @@ -1044,7 +1044,7 @@ def gen_match_comp(out=sys.stdout):
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;
}
Expand Down Expand Up @@ -1147,7 +1147,7 @@ def gen_match_comp(out=sys.stdout):
%(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("""
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def gen_match_comp(out=sys.stdout):
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 */
}
Expand Down
Loading

0 comments on commit 5325616

Please sign in to comment.