Changeset 569b363 for python/lib/gen_code.py
- Timestamp:
- Apr 24, 2016, 6:23:14 PM (8 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 51b9c83
- Parents:
- a35db12
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_code.py
ra35db12 r569b363 203 203 }} Py_{shortname}; 204 204 """ 205 return out.format(do_inputs_list = "; ".join(get_input_params(self.do_proto)), **self.__dict__) 205 # fmat_t* / fvec_t* / cvec_t* inputs -> full fvec_t /.. struct in Py_{shortname} 206 do_inputs_list = "; ".join(get_input_params(self.do_proto)).replace('fvec_t *','fvec_t').replace('fmat_t *', 'fmat_t').replace('cvec_t *', 'cvec_t') 207 return out.format(do_inputs_list = do_inputs_list, **self.__dict__) 206 208 207 209 def gen_doc(self): … … 311 313 // TODO get internal params after actual object creation? 312 314 """ 313 for input_param in self.do_inputs:314 out += """315 self->{0} = ({1})malloc(sizeof({2}));""".format(input_param['name'], input_param['type'], input_param['type'][:-1])316 315 out += """ 317 316 // create outputs{output_create} … … 343 342 {{""".format(**self.__dict__) 344 343 for input_param in self.do_inputs: 345 out += """ 346 free(self->{0[name]});""".format(input_param) 344 if input_param['type'] == 'fmat_t *': 345 out += """ 346 free(self->{0[name]}.data);""".format(input_param) 347 347 for o in self.outputs: 348 348 name = o['name'] … … 380 380 for p in input_params: 381 381 out += """ 382 if (!{pytoaubio}(py_{0[name]}, self->{0[name]})) {{382 if (!{pytoaubio}(py_{0[name]}, &(self->{0[name]}))) {{ 383 383 return NULL; 384 384 }}""".format(input_param, pytoaubio = pytoaubio_fn[input_param['type']]) 385 385 do_fn = get_name(self.do_proto) 386 inputs = ", ".join([' self->'+p['name']for p in input_params])386 inputs = ", ".join(['&(self->'+p['name']+')' for p in input_params]) 387 387 outputs = ", ".join(["self->%s" % p['name'] for p in self.do_outputs]) 388 388 out += """
Note: See TracChangeset
for help on using the changeset viewer.