Changeset 6cbf34b
- Timestamp:
- May 30, 2017, 12:28:40 AM (7 years ago)
- 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:
- 541ea280
- Parents:
- b1f93c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_external.py
rb1f93c4 r6cbf34b 136 136 return cpp_objects 137 137 138 def analyze_c_declarations(cpp_objects, c_declarations): 138 139 def get_all_func_names_from_lib(lib, depth=0): 140 ''' return flat string of all function used in lib 141 ''' 142 res = [] 143 indent = " " * depth 144 for k, v in lib.items(): 145 if isinstance(v, dict): 146 res += get_all_func_names_from_lib(v, depth + 1) 147 elif isinstance(v, list): 148 for elem in v: 149 e = elem.split('(') 150 if len(e) < 2: 151 continue # not a function 152 fname_part = e[0].strip().split(' ') 153 fname = fname_part[-1] 154 if fname: 155 res += [fname] 156 else: 157 raise NameError('gen_lib : weird function: ' + str(e)) 158 159 return res 160 161 162 def generate_lib_from_c_declarations(cpp_objects, c_declarations): 163 ''' returns a lib from given cpp_object names 164 165 a lib is a dict grouping functions by family (onset,pitch...) 166 each eement is itself a dict of functions grouped by puposes as : 167 struct, new, del, do, get, set and other 168 ''' 139 169 lib = {} 140 170 … … 206 236 cpp_objects = get_cpp_objects_from_c_declarations(c_declarations) 207 237 208 lib = analyze_c_declarations(cpp_objects, c_declarations)238 lib = generate_lib_from_c_declarations(cpp_objects, c_declarations) 209 239 # print_c_declarations_results(lib, c_declarations) 210 240
Note: See TracChangeset
for help on using the changeset viewer.