X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vppapigen%2Fpyvppapigen.py;h=675712ab616d330d32db8d1eda0130e3f76ddfd5;hb=f195019a300e9f0d375f74cd11ee1dd0cc64aecf;hp=75d6a1416fa3ddad098a9da6eb114a0db71868d5;hpb=69a9b76d648a108e0a7fad4404b218ebdd6a8ea5;p=vpp.git diff --git a/vppapigen/pyvppapigen.py b/vppapigen/pyvppapigen.py index 75d6a1416fa..675712ab616 100755 --- a/vppapigen/pyvppapigen.py +++ b/vppapigen/pyvppapigen.py @@ -150,11 +150,20 @@ def encode_print(name, id, t): # first, deal with all the other fields pack = '>' + ''.join([get_pack(f)[0] for f in t[:-1]]) - # now see if the last field is a vla - if len(t[-1]) >= 3 and t[-1][2] == '0': + # named variable-length-array + if len(t[-1]) == 4 and t[-1][2] == '0' and t[-1][3] == t[-2][1]: + print(u" vpp_api.write(pack('" + pack + "', base + " + + id + ", 0, context, " + ', '.join(args[3:-2] + ["len(" + args[-1] + ")"]) + + ") + " + args[-1] + ")") + + # unnamed variable-length-array + elif len(t[-1]) >= 3 and t[-1][2] == '0': print(u" vpp_api.write(pack('" + pack + "', base + " + id + ", 0, context, " + ', '.join(args[3:-1]) + ") + " + args[-1] + ")") + + + # not a variable-length-array else: pack += get_pack(t[-1])[0] print(u" vpp_api.write(pack('" + pack + "', base + " + id +