X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Ftools%2Fvppapigen%2Fvppapigen_c.py;h=46f60dea84382b3ceb095be1bf7a5c8eb798469c;hb=2dbee9361e74d03727a8b618ba80a5e28c006011;hp=64f023b9217064d3c05db657378809b1ed8939a1;hpb=b307c712f459f90d8a585fe51ba15ac8b931cdbe;p=vpp.git diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py index 64f023b9217..46f60dea843 100644 --- a/src/tools/vppapigen/vppapigen_c.py +++ b/src/tools/vppapigen/vppapigen_c.py @@ -136,10 +136,9 @@ class Printfun(): if o.modern_vla: write(' if (vl_api_string_len(&a->{f}) > 0) {{\n' .format(f=o.fieldname)) - write(' s = format(s, "\\n%U{f}: %.*s", ' + write(' s = format(s, "\\n%U{f}: %U", ' 'format_white_space, indent, ' - 'vl_api_string_len(&a->{f}) - 1, ' - 'vl_api_from_api_string(&a->{f}));\n'.format(f=o.fieldname)) + 'vl_api_format_string, (&a->{f}));\n'.format(f=o.fieldname)) write(' } else {\n') write(' s = format(s, "\\n%U{f}:", ' 'format_white_space, indent);\n'.format(f=o.fieldname)) @@ -458,7 +457,6 @@ static inline void vl_api_{name}_t_endian (vl_api_{name}_t *a) output += "/***** manual: vl_api_%s_t_endian *****/\n\n" % t.name continue - if t.__class__.__name__ == 'Using': output += signature.format(name=t.name) if ('length' in t.alias and t.alias['length'] and @@ -513,6 +511,7 @@ def generate_include_enum(s, module, stream): write(' VL_MSG_FIRST_AVAILABLE\n') write('}} vl_api_{}_enum_t;\n'.format(module)) + # # Generate separate API _types file. # @@ -586,6 +585,10 @@ def generate_include_types(s, module, stream): write('} vl_api_%s_t;\n' % o.name) + for t in s['Define']: + write('#define VL_API_{ID}_CRC "{n}_{crc:08x}"\n' + .format(n=t.name, ID=t.name.upper(), crc=t.crc)) + write("\n#endif\n") @@ -608,7 +611,7 @@ def generate_c_boilerplate(services, defines, file_crc, module, stream): write(hdr.format(module=module)) write('static u16\n') write('setup_message_id_table (void) {\n') - write(' api_main_t *am = &api_main;\n') + write(' api_main_t *am = my_api_main;\n') write(' u16 msg_id_base = vl_msg_api_get_msg_ids ("{}_{crc:08x}", VL_MSG_FIRST_AVAILABLE);\n' .format(module, crc=file_crc)) @@ -654,14 +657,14 @@ def generate_c_test_plugin_boilerplate(services, defines, file_crc, module, stre except: continue if d.manual_print: - write('/* Manual definition requested for: vl_api_{n}_t_hander() */\n' + write('/* Manual definition requested for: vl_api_{n}_t_handler() */\n' .format(n=s.reply)) continue if not define_hash[s.caller].autoreply: - write('/* Only autoreply is supported (vl_api_{n}_t_hander()) */\n' + write('/* Only autoreply is supported (vl_api_{n}_t_handler()) */\n' .format(n=s.reply)) continue - write('#ifndef VL_API_{n}_T_HANLDER\n'.format(n=s.reply.upper())) + write('#ifndef VL_API_{n}_T_HANDLER\n'.format(n=s.reply.upper())) write('static void\n') write('vl_api_{n}_t_handler (vl_api_{n}_t * mp) {{\n'.format(n=s.reply)) write(' vat_main_t * vam = {}_test_main.vat_main;\n'.format(module))