From: Paul Brossier Date: Sun, 24 Apr 2016 22:35:53 +0000 (+0200) Subject: python/lib/gen_{external,code}.py: prepare for double precision X-Git-Tag: 0.4.4~300^2~219 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=fbcee4fde322612474a48791b3b7f00dcb6d4888;p=aubio.git python/lib/gen_{external,code}.py: prepare for double precision --- diff --git a/python/lib/gen_code.py b/python/lib/gen_code.py index 7c8bc062..d2107a93 100644 --- a/python/lib/gen_code.py +++ b/python/lib/gen_code.py @@ -68,7 +68,7 @@ param_init = { } pyargparse_chars = { - 'smpl_t': 'f', + 'smpl_t': 'f', # if not usedouble else 'd', 'uint_t': 'I', 'sint_t': 'I', 'char_t*': 's', @@ -153,7 +153,9 @@ def get_params_types_names(proto): class MappedObject(object): - def __init__(self, prototypes): + def __init__(self, prototypes, usedouble = False): + if usedouble: + pyargparse_chars['smpl_t'] = 'd' self.prototypes = prototypes self.shortname = prototypes['shortname'] diff --git a/python/lib/gen_external.py b/python/lib/gen_external.py index ce7f11bb..51100922 100644 --- a/python/lib/gen_external.py +++ b/python/lib/gen_external.py @@ -66,8 +66,8 @@ def get_cpp_objects(): return cpp_output, cpp_objects -def generate_external(output_path): - os.mkdir(output_path) +def generate_external(output_path, usedouble = False): + if not os.path.isdir(output_path): os.mkdir(output_path) sources_list = [] cpp_output, cpp_objects = get_cpp_objects() lib = {} @@ -123,7 +123,7 @@ def generate_external(output_path): from .gen_code import MappedObject for o in lib: out = header - mapped = MappedObject(lib[o]) + mapped = MappedObject(lib[o], usedouble = usedouble) out += mapped.gen_code() output_file = os.path.join(output_path, 'gen-%s.c' % o) with open(output_file, 'w') as f: