Lines Matching refs:write

120         self.write('#include "Python.h"')
121 self.write('#include "internal/pycore_gc.h"')
122 self.write('#include "internal/pycore_code.h"')
123 self.write('#include "internal/pycore_long.h"')
124 self.write("")
135 def write(self, arg: str) -> None:
140 self.write(prefix + " {")
143 self.write("}" + suffix)
147 self.write(f".ob_refcnt = 999999999,")
148 self.write(f".ob_type = &{typename},")
153 self.write(f".ob_size = {size},")
156 self.write(f".{name} = {getattr(obj, name)},")
163 self.write("static")
166 self.write("PyObject_VAR_HEAD")
167 self.write("Py_hash_t ob_shash;")
168 self.write(f"char ob_sval[{len(b) + 1}];")
171 self.write(".ob_shash = -1,")
172 self.write(f".ob_sval = {make_string_literal(b)},")
189 self.write("static")
193 self.write("PyASCIIObject _ascii;")
195 self.write("PyCompactUnicodeObject _compact;")
196 self.write(f"{datatype} _data[{len(s)+1}];")
202 self.write(f".length = {len(s)},")
203 self.write(".hash = -1,")
205 self.write(".kind = 1,")
206 self.write(".compact = 1,")
207 self.write(".ascii = 1,")
208 self.write(".ready = 1,")
209 self.write(f"._data = {make_string_literal(s.encode('ascii'))},")
215 self.write(f".length = {len(s)},")
216 self.write(".hash = -1,")
218 self.write(f".kind = {kind},")
219 self.write(".compact = 1,")
220 self.write(".ascii = 0,")
221 self.write(".ready = 1,")
225 self.write(", ".join(map(str, map(ord, data))) + ",")
257 self.write("static")
259 self.write(f"struct _PyCode_DEF({len(code.co_code)})")
265 self.write(f".co_consts = {co_consts},")
266 self.write(f".co_names = {co_names},")
267 self.write(f".co_exceptiontable = {co_exceptiontable},")
269 self.write(".co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,")
270 self.write("._co_linearray_entry_size = 0,")
276 self.write(f".co_nlocalsplus = {len(localsplusnames)},")
278 self.write(f".co_nplaincellvars = {nplaincellvars},")
279 self.write(f".co_ncellvars = {ncellvars},")
280 self.write(f".co_nfreevars = {nfreevars},")
281 self.write(f".co_localsplusnames = {co_localsplusnames},")
282 self.write(f".co_localspluskinds = {co_localspluskinds},")
283 self.write(f".co_filename = {co_filename},")
284 self.write(f".co_name = {co_name},")
285 self.write(f".co_qualname = {co_qualname},")
286 self.write(f".co_linetable = {co_linetable},")
287 self.write(f"._co_code = NULL,")
288 self.write("._co_linearray = NULL,")
289 self.write(f".co_code_adaptive = {co_code_adaptive},")
292 self.write(f"._co_firsttraceable = {i},")
303 self.write("static")
306 self.write("PyGC_Head _gc_head;")
308 self.write("PyObject_VAR_HEAD")
310 self.write(f"PyObject *ob_item[{len(t)}];")
317 self.write(item + ",")
327 self.write("static")
330 self.write("PyObject_VAR_HEAD")
331 self.write(f"digit ob_digit[{max(1, len(digits))}];")
336 self.write(f".ob_digit = {{ {ds} }},")
350 self.write(f"#{connective} PYLONG_BITS_IN_DIGIT == {bits_in_digit}")
353 self.write("#else")
354 self.write('#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"')
355 self.write("#endif")
362 self.write(f".ob_fval = {x},")
368 self.write(f".cval = {{ {z.real}, {z.imag} }},")
378 self.write("// TODO: The above tuple should be a frozenset")
386 self.write(p)
388 self.write(EPILOGUE.replace("%%NAME%%", module))
473 printer.write(p)
477 printer.write("return -1;")
478 printer.write("return 0;")