History

python/lib/gen_{external,code}.py: prepare for double precision

Paul Brossier committed 10 years ago

Commit fbcee4f1 parent c6388f42 files · +7 −5Browse files

Showing the changes to python (2 of 2 files). Show all

Unified · Split

2 files
  1. python/lib/gen_code.py +4 −2
  2. python/lib/gen_external.py +3 −3
python/lib/gen_code.py+4−2
@@ -68,7 +68,7 @@ param_init = { · 67 unmodified lines
6868 }
6969
7070 pyargparse_chars = {
71− 'smpl_t': 'f',
71+ 'smpl_t': 'f', # if not usedouble else 'd',
7272 'uint_t': 'I',
7373 'sint_t': 'I',
7474 'char_t*': 's',
@@ -153,7 +153,9 @@ def get_params_types_names(proto): · 78 unmodified lines
153153
154154 class MappedObject(object):
155155
156− def __init__(self, prototypes):
156+ def __init__(self, prototypes, usedouble = False):
157+ if usedouble:
158+ pyargparse_chars['smpl_t'] = 'd'
157159 self.prototypes = prototypes
158160
159161 self.shortname = prototypes['shortname']
python/lib/gen_external.py+3−3
@@ -66,8 +66,8 @@ def get_cpp_objects(): · 65 unmodified lines
6666
6767 return cpp_output, cpp_objects
6868
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)
7171 sources_list = []
7272 cpp_output, cpp_objects = get_cpp_objects()
7373 lib = {}
@@ -123,7 +123,7 @@ def generate_external(output_path): · 49 unmodified lines
123123 from .gen_code import MappedObject
124124 for o in lib:
125125 out = header
126− mapped = MappedObject(lib[o])
126+ mapped = MappedObject(lib[o], usedouble = usedouble)
127127 out += mapped.gen_code()
128128 output_file = os.path.join(output_path, 'gen-%s.c' % o)
129129 with open(output_file, 'w') as f:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t