Changeset 93acd9f
- Timestamp:
- Mar 9, 2013, 2:27:10 AM (12 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:
- 5810ed4
- Parents:
- 1e7a8f9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/generator.py
r1e7a8f9 r93acd9f 143 143 """ 144 144 145 for each in generated_objects:146 s += "extern PyTypeObject Py_%sType;\n" % \147 each.replace('aubio_','').replace('_t','')148 149 145 types_ready = [] 150 146 for each in generated_objects: … … 152 148 each.replace('aubio_','').replace('_t','') ) 153 149 150 s = """// generated list of objects created with generator.py 151 152 #include "aubio-generated.h" 153 """ 154 154 155 s += """ 155 int 156 generated_types_ready (void) 157 { 158 return ( 159 """ 156 int generated_types_ready (void) 157 { 158 return ( 159 """ 160 160 s += ('\n ||').join(types_ready) 161 161 s += """); 162 163 162 } 163 """ 164 164 165 165 s += """ 166 void 167 add_generated_objects ( PyObject *m ) 168 {""" 166 void add_generated_objects ( PyObject *m ) 167 {""" 169 168 for each in generated_objects: 170 s += """ Py_INCREF (&Py_%(name)sType); 171 PyModule_AddObject (m, "%(name)s", (PyObject *) & Py_%(name)sType);""" % \ 172 { 'name': ( each.replace('aubio_','').replace('_t','') ) } 169 s += """ 170 Py_INCREF (&Py_%(name)sType); 171 PyModule_AddObject (m, "%(name)s", (PyObject *) & Py_%(name)sType);""" % \ 172 { 'name': ( each.replace('aubio_','').replace('_t','') ) } 173 173 174 174 s += """ 175 }""" 175 }""" 176 177 fd = open(os.path.join(output_path,'aubio-generated.c'), 'w') 178 fd.write(s) 179 180 s = """// generated list of objects created with generator.py 181 182 #include "Python.h" 183 184 """ 185 186 for each in generated_objects: 187 s += "extern PyTypeObject Py_%sType;\n" % \ 188 each.replace('aubio_','').replace('_t','') 189 190 s+= "int generated_objects ( void );\n" 191 s+= "void add_generated_objects( PyObject *m );\n" 176 192 177 193 fd = open(os.path.join(output_path,'aubio-generated.h'), 'w')
Note: See TracChangeset
for help on using the changeset viewer.