(output_dir)
| 286 | raise SystemExit(name + ' not found') |
| 287 | |
| 288 | def create_name_header(output_dir): |
| 289 | routine_re = re.compile(r'^ (subroutine|.* function)\s+(\w+)\(.*$', |
| 290 | re.I) |
| 291 | extern_re = re.compile(r'^extern [a-z]+ ([a-z0-9_]+)\(.*$') |
| 292 | |
| 293 | # BLAS/LAPACK symbols |
| 294 | symbols = {'xerbla'} |
| 295 | for fn in os.listdir(output_dir): |
| 296 | fn = os.path.join(output_dir, fn) |
| 297 | |
| 298 | if not fn.endswith('.f'): |
| 299 | continue |
| 300 | |
| 301 | with open(fn) as f: |
| 302 | for line in f: |
| 303 | m = routine_re.match(line) |
| 304 | if m: |
| 305 | symbols.add(m.group(2).lower()) |
| 306 | |
| 307 | # f2c symbols |
| 308 | f2c_symbols = set() |
| 309 | with open('f2c.h') as f: |
| 310 | for line in f: |
| 311 | m = extern_re.match(line) |
| 312 | if m: |
| 313 | f2c_symbols.add(m.group(1)) |
| 314 | |
| 315 | with open(os.path.join(output_dir, 'lapack_lite_names.h'), 'w') as f: |
| 316 | f.write(HEADER_BLURB) |
| 317 | f.write( |
| 318 | "/*\n" |
| 319 | " * This file renames all BLAS/LAPACK and f2c symbols to avoid\n" |
| 320 | " * dynamic symbol name conflicts, in cases where e.g.\n" |
| 321 | " * integer sizes do not match with 'standard' ABI.\n" |
| 322 | " */\n") |
| 323 | |
| 324 | # Rename BLAS/LAPACK symbols |
| 325 | for name in sorted(symbols): |
| 326 | f.write(f"#define {name}_ BLAS_FUNC({name})\n") |
| 327 | |
| 328 | # Rename also symbols that f2c exports itself |
| 329 | f.write("\n" |
| 330 | "/* Symbols exported by f2c.c */\n") |
| 331 | for name in sorted(f2c_symbols): |
| 332 | f.write(f"#define {name} numpy_lapack_lite_{name}\n") |
| 333 | |
| 334 | def main(): |
| 335 | if len(sys.argv) != 3: |
no test coverage detected
searching dependent graphs…