Showing the changes to python (2 of 2 files). Show all
Unified · Split
| @@ -68,7 +68,7 @@ param_init = { · 67 unmodified lines | ||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | pyargparse_chars = { |
| 71 | − 'smpl_t': 'f', | |
| 71 | + 'smpl_t': 'f', # if not usedouble else 'd', | |
| 72 | 72 | 'uint_t': 'I', |
| 73 | 73 | 'sint_t': 'I', |
| 74 | 74 | 'char_t*': 's', |
| @@ -153,7 +153,9 @@ def get_params_types_names(proto): · 78 unmodified lines | ||
| 153 | 153 | |
| 154 | 154 | class MappedObject(object): |
| 155 | 155 | |
| 156 | − def __init__(self, prototypes): | |
| 156 | + def __init__(self, prototypes, usedouble = False): | |
| 157 | + if usedouble: | |
| 158 | + pyargparse_chars['smpl_t'] = 'd' | |
| 157 | 159 | self.prototypes = prototypes |
| 158 | 160 | |
| 159 | 161 | self.shortname = prototypes['shortname'] |
| @@ -66,8 +66,8 @@ def get_cpp_objects(): · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | return cpp_output, cpp_objects |
| 68 | 68 | |
| 69 | −def generate_external(output_path): | |
| 70 | − os.mkdir(output_path) | |
| 69 | +def generate_external(output_path, usedouble = False): | |
| 70 | + if not os.path.isdir(output_path): os.mkdir(output_path) | |
| 71 | 71 | sources_list = [] |
| 72 | 72 | cpp_output, cpp_objects = get_cpp_objects() |
| 73 | 73 | lib = {} |
| @@ -123,7 +123,7 @@ def generate_external(output_path): · 49 unmodified lines | ||
| 123 | 123 | from .gen_code import MappedObject |
| 124 | 124 | for o in lib: |
| 125 | 125 | out = header |
| 126 | − mapped = MappedObject(lib[o]) | |
| 126 | + mapped = MappedObject(lib[o], usedouble = usedouble) | |
| 127 | 127 | out += mapped.gen_code() |
| 128 | 128 | output_file = os.path.join(output_path, 'gen-%s.c' % o) |
| 129 | 129 | with open(output_file, 'w') as f: |