コード例 #1
0
ファイル: jvpp_gen.py プロジェクト: Kryndex/vpp-1
def get_definitions(defs):
    # Pass 1
    func_list = []
    func_name = {}
    for a in defs:
        java_name = util.underscore_to_camelcase(a[0])

        # For replies include all the arguments except message_id
        if util.is_reply(java_name):
            types, lengths, crc = get_types(a[1:], is_response_field)
            args = get_args(a[1:], is_response_field)
            func_name[a[0]] = dict([('name', a[0]), ('java_name', java_name),
                                    ('args', args[1]), ('arg_types', args[0]),
                                    ('types', types), ('lengths', lengths),
                                    crc])
        # For requests skip message_id, client_id and context
        else:
            types, lengths, crc = get_types(a[1:], is_request_field)
            args = get_args(a[1:], is_request_field)
            func_name[a[0]] = dict([('name', a[0]), ('java_name', java_name),
                                    ('args', args[1]), ('arg_types', args[0]),
                                    ('types', types), ('lengths', lengths),
                                    crc])

        # Indexed by name
        func_list.append(func_name[a[0]])
    return func_list, func_name
コード例 #2
0
ファイル: jvpp_gen.py プロジェクト: schevalier/vpp
def get_definitions():
    # Pass 1
    func_list = []
    func_name = {}
    for a in cfg.messages:
        if not is_supported(a[0]):
            continue

        java_name = util.underscore_to_camelcase(a[0])

        # For replies include all the arguments except message_id
        if util.is_reply(java_name):
            types, c_types, lengths = get_types(a[1:], is_response_field)
            func_name[a[0]] = dict([('name', a[0]), ('java_name', java_name),
                                    ('args', get_args(a[1:],
                                                      is_response_field)),
                                    ('full_args',
                                     get_args(a[1:], lambda x: True)),
                                    ('types', types), ('c_types', c_types),
                                    ('lengths', lengths)])
        # For requests skip message_id, client_id and context
        else:
            types, c_types, lengths = get_types(a[1:], is_request_field)
            func_name[a[0]] = dict([('name', a[0]), ('java_name', java_name),
                                    ('args', get_args(a[1:],
                                                      is_request_field)),
                                    ('full_args',
                                     get_args(a[1:], lambda x: True)),
                                    ('types', types), ('c_types', c_types),
                                    ('lengths', lengths)])

        # Indexed by name
        func_list.append(func_name[a[0]])
    return func_list, func_name