MCPcopy Create free account
hub / github.com/numpy/numpy / check_funcs_once

Method check_funcs_once

numpy/distutils/command/config.py:349–408  ·  view source on GitHub ↗

Check a list of functions at once. This is useful to speed up things, since all the functions in the funcs list will be put in one compilation unit. Arguments --------- funcs : seq list of functions to test include_dirs : seq

(self, funcs,
                   headers=None, include_dirs=None,
                   libraries=None, library_dirs=None,
                   decl=False, call=False, call_args=None)

Source from the content-addressed store, hash-verified

347 libraries, library_dirs)
348
349 def check_funcs_once(self, funcs,
350 headers=None, include_dirs=None,
351 libraries=None, library_dirs=None,
352 decl=False, call=False, call_args=None):
353 """Check a list of functions at once.
354
355 This is useful to speed up things, since all the functions in the funcs
356 list will be put in one compilation unit.
357
358 Arguments
359 ---------
360 funcs : seq
361 list of functions to test
362 include_dirs : seq
363 list of header paths
364 libraries : seq
365 list of libraries to link the code snippet to
366 library_dirs : seq
367 list of library paths
368 decl : dict
369 for every (key, value), the declaration in the value will be
370 used for function in key. If a function is not in the
371 dictionary, no declaration will be used.
372 call : dict
373 for every item (f, value), if the value is True, a call will be
374 done to the function f.
375 """
376 self._check_compiler()
377 body = []
378 if decl:
379 for f, v in decl.items():
380 if v:
381 body.append("int %s (void);" % f)
382
383 # Handle MS intrinsics. See check_func for more info.
384 body.append("#ifdef _MSC_VER")
385 for func in funcs:
386 body.append("#pragma function(%s)" % func)
387 body.append("#endif")
388
389 body.append("int main (void) {")
390 if call:
391 for f in funcs:
392 if f in call and call[f]:
393 if not (call_args and f in call_args and call_args[f]):
394 args = ''
395 else:
396 args = call_args[f]
397 body.append(" %s(%s);" % (f, args))
398 else:
399 body.append(" %s;" % f)
400 else:
401 for f in funcs:
402 body.append(" %s;" % f)
403 body.append(" return 0;")
404 body.append("}")
405 body = '\n'.join(body) + "\n"
406

Callers 2

check_funcs_onceFunction · 0.80
check_precFunction · 0.80

Calls 2

_check_compilerMethod · 0.95
joinMethod · 0.45

Tested by

no test coverage detected