Changeset 150ec2d


Ignore:
Timestamp:
May 29, 2017, 10:03:15 PM (7 years ago)
Author:
Martin Hermant <martin.hermant@gmail.com>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
341585b
Parents:
5674833
Message:

gen_external.py :

rename cpp_output to c_declarations
make pre processing parsing part of get_cpp_objects a distinct function get_c_declarations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_external.py

    r5674833 r150ec2d  
    7676    return cpp_cmd
    7777
    78 def get_cpp_objects(header=header, usedouble=False):
     78
     79def get_c_declarations(header=header, usedouble=False):
     80    ''' return a dense and preprocessed  string of all c declarations implied by aubio.h
     81    '''
    7982    cpp_cmd = get_preprocessor()
    8083
     
    119122            i += 1
    120123
    121     typedefs = filter(lambda y: y.startswith ('typedef struct _aubio'), cpp_output)
    122 
     124    return cpp_output
     125
     126def get_cpp_objects_from_c_declarations(c_declarations):
     127    typedefs = filter(lambda y: y.startswith ('typedef struct _aubio'), c_declarations)
    123128    cpp_objects = [a.split()[3][:-1] for a in typedefs]
    124 
    125     return cpp_output, cpp_objects
    126 
    127 
    128 def analyze_cpp_output(cpp_objects, cpp_output):
     129    return cpp_objects
     130
     131def analyze_c_declarations(cpp_objects, c_declarations):
    129132    lib = {}
    130133
     
    145148        valid_funcname_part = ['_'+longname,longname+'_']
    146149
    147         for fn in cpp_output:
     150        for fn in c_declarations:
    148151            func_name = fn.split('(')[0].strip().split(' ')[1:]
    149152            if func_name:
     
    170173    return lib
    171174
    172 def print_cpp_output_results(lib, cpp_output):
    173     for fn in cpp_output:
     175def print_c_declarations_results(lib, c_declarations):
     176    for fn in c_declarations:
    174177        found = 0
    175178        for o in lib:
     
    194197    elif not overwrite: return sorted(glob.glob(os.path.join(output_path, '*.c')))
    195198
    196     cpp_output, cpp_objects = get_cpp_objects(header, usedouble=usedouble)
    197 
    198     lib = analyze_cpp_output(cpp_objects, cpp_output)
    199     # print_cpp_output_results(lib, cpp_output)
     199    c_declarations = get_c_declarations(header, usedouble=usedouble)
     200    cpp_objects = get_cpp_objects_from_c_declarations(c_declarations)
     201
     202    lib = analyze_c_declarations(cpp_objects, c_declarations)
     203    # print_c_declarations_results(lib, c_declarations)
    200204
    201205    sources_list = []
Note: See TracChangeset for help on using the changeset viewer.