Lines Matching refs:fp

261     fp = open(FILE, "w")
262 print("/* this file was generated by %s %s */" % (SCRIPT, VERSION), file=fp)
263 print(file=fp)
264 print('#define UNIDATA_VERSION "%s"' % UNIDATA_VERSION, file=fp)
265 print("/* a list of unique database records */", file=fp)
266 print("const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {", file=fp)
268 print(" {%d, %d, %d, %d, %d, %d}," % item, file=fp)
269 print("};", file=fp)
270 print(file=fp)
272 print("/* Reindexing of NFC first characters. */", file=fp)
273 print("#define TOTAL_FIRST",total_first, file=fp)
274 print("#define TOTAL_LAST",total_last, file=fp)
275 print("struct reindex{int start;short count,index;};", file=fp)
276 print("static struct reindex nfc_first[] = {", file=fp)
278 print(" { %d, %d, %d}," % (start,end-start,comp_first[start]), file=fp)
279 print(" {0,0,0}", file=fp)
280 print("};\n", file=fp)
281 print("static struct reindex nfc_last[] = {", file=fp)
283 print(" { %d, %d, %d}," % (start,end-start,comp_last[start]), file=fp)
284 print(" {0,0,0}", file=fp)
285 print("};\n", file=fp)
290 print("/* string literals */", file=fp)
291 print("const char *_PyUnicode_CategoryNames[] = {", file=fp)
293 print(" \"%s\"," % name, file=fp)
294 print(" NULL", file=fp)
295 print("};", file=fp)
297 print("const char *_PyUnicode_BidirectionalNames[] = {", file=fp)
299 print(" \"%s\"," % name, file=fp)
300 print(" NULL", file=fp)
301 print("};", file=fp)
303 print("const char *_PyUnicode_EastAsianWidthNames[] = {", file=fp)
305 print(" \"%s\"," % name, file=fp)
306 print(" NULL", file=fp)
307 print("};", file=fp)
309 print("static const char *decomp_prefix[] = {", file=fp)
311 print(" \"%s\"," % name, file=fp)
312 print(" NULL", file=fp)
313 print("};", file=fp)
318 print("/* index tables for the database records */", file=fp)
319 print("#define SHIFT", shift, file=fp)
320 Array("index1", index1).dump(fp, trace)
321 Array("index2", index2).dump(fp, trace)
326 print("/* decomposition data */", file=fp)
327 Array("decomp_data", decomp_data).dump(fp, trace)
329 print("/* index tables for the decomposition data */", file=fp)
330 print("#define DECOMP_SHIFT", shift, file=fp)
331 Array("decomp_index1", index1).dump(fp, trace)
332 Array("decomp_index2", index2).dump(fp, trace)
335 print("/* NFC pairs */", file=fp)
336 print("#define COMP_SHIFT", shift, file=fp)
337 Array("comp_index", index).dump(fp, trace)
338 Array("comp_data", index2).dump(fp, trace)
353 print("static const change_record change_records_%s[] = {" % cversion, file=fp)
355 print(" { %s }," % ", ".join(map(str,record)), file=fp)
356 print("};", file=fp)
357 Array("changes_%s_index" % cversion, index1).dump(fp, trace)
358 Array("changes_%s_data" % cversion, index2).dump(fp, trace)
359 print("static const change_record* get_change_%s(Py_UCS4 n)" % cversion, file=fp)
360 print("{", file=fp)
361 print(" int index;", file=fp)
362 print(" if (n >= 0x110000) index = 0;", file=fp)
363 print(" else {", file=fp)
364 print(" index = changes_%s_index[n>>%d];" % (cversion, shift), file=fp)
366 (cversion, shift, ((1<<shift)-1)), file=fp)
367 print(" }", file=fp)
368 print(" return change_records_%s+index;" % cversion, file=fp)
369 print("}\n", file=fp)
370 print("static Py_UCS4 normalization_%s(Py_UCS4 n)" % cversion, file=fp)
371 print("{", file=fp)
372 print(" switch(n) {", file=fp)
374 print(" case %s: return 0x%s;" % (hex(k), v), file=fp)
375 print(" default: return 0;", file=fp)
376 print(" }\n}\n", file=fp)
378 fp.close()
508 fp = open(FILE, "w")
509 print("/* this file was generated by %s %s */" % (SCRIPT, VERSION), file=fp)
510 print(file=fp)
511 print("/* a list of unique character type descriptors */", file=fp)
512 print("const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {", file=fp)
514 print(" {%d, %d, %d, %d, %d, %d}," % item, file=fp)
515 print("};", file=fp)
516 print(file=fp)
518 print("/* extended case mappings */", file=fp)
519 print(file=fp)
520 print("const Py_UCS4 _PyUnicode_ExtendedCase[] = {", file=fp)
522 print(" %d," % c, file=fp)
523 print("};", file=fp)
524 print(file=fp)
529 print("/* type indexes */", file=fp)
530 print("#define SHIFT", shift, file=fp)
531 Array("index1", index1).dump(fp, trace)
532 Array("index2", index2).dump(fp, trace)
536 print('/* Returns the numeric value as double for Unicode characters', file=fp)
537 print(' * having this property, -1.0 otherwise.', file=fp)
538 print(' */', file=fp)
539 print('double _PyUnicode_ToNumeric(Py_UCS4 ch)', file=fp)
540 print('{', file=fp)
541 print(' switch (ch) {', file=fp)
550 print(' case 0x%04X:' % (codepoint,), file=fp)
551 print(' return (double) %s;' % (value,), file=fp)
552 print(' }', file=fp)
553 print(' return -1.0;', file=fp)
554 print('}', file=fp)
555 print(file=fp)
558 print("/* Returns 1 for Unicode characters having the bidirectional", file=fp)
559 print(" * type 'WS', 'B' or 'S' or the category 'Zs', 0 otherwise.", file=fp)
560 print(" */", file=fp)
561 print('int _PyUnicode_IsWhitespace(const Py_UCS4 ch)', file=fp)
562 print('{', file=fp)
563 print(' switch (ch) {', file=fp)
566 print(' case 0x%04X:' % (codepoint,), file=fp)
567 print(' return 1;', file=fp)
569 print(' }', file=fp)
570 print(' return 0;', file=fp)
571 print('}', file=fp)
572 print(file=fp)
575 print("/* Returns 1 for Unicode characters having the line break", file=fp)
576 print(" * property 'BK', 'CR', 'LF' or 'NL' or having bidirectional", file=fp)
577 print(" * type 'B', 0 otherwise.", file=fp)
578 print(" */", file=fp)
579 print('int _PyUnicode_IsLinebreak(const Py_UCS4 ch)', file=fp)
580 print('{', file=fp)
581 print(' switch (ch) {', file=fp)
583 print(' case 0x%04X:' % (codepoint,), file=fp)
584 print(' return 1;', file=fp)
586 print(' }', file=fp)
587 print(' return 0;', file=fp)
588 print('}', file=fp)
589 print(file=fp)
591 fp.close()
730 fp = open(FILE, "w")
731 print("/* this file was generated by %s %s */" % (SCRIPT, VERSION), file=fp)
732 print(file=fp)
733 print("#define NAME_MAXLEN", 256, file=fp)
734 print(file=fp)
735 print("/* lexicon */", file=fp)
736 Array("lexicon", lexicon).dump(fp, trace)
737 Array("lexicon_offset", lexicon_offset).dump(fp, trace)
742 print("/* code->name phrasebook */", file=fp)
743 print("#define phrasebook_shift", shift, file=fp)
744 print("#define phrasebook_short", short, file=fp)
746 Array("phrasebook", phrasebook).dump(fp, trace)
747 Array("phrasebook_offset1", offset1).dump(fp, trace)
748 Array("phrasebook_offset2", offset2).dump(fp, trace)
750 print("/* name->code dictionary */", file=fp)
751 codehash.dump(fp, trace)
753 print(file=fp)
755 NAME_ALIASES_START, file=fp)
757 (NAME_ALIASES_START + len(unicode.aliases)), file=fp)
759 print('static const unsigned int name_aliases[] = {', file=fp)
761 print(' 0x%04X,' % codepoint, file=fp)
762 print('};', file=fp)
773 """), file=fp)
776 NAMED_SEQUENCES_START, file=fp)
778 (NAMED_SEQUENCES_START + len(unicode.named_sequences)), file=fp)
780 print('static const named_sequence named_sequences[] = {', file=fp)
783 print(' {%d, {%s}},' % (len(sequence), seq_str), file=fp)
784 print('};', file=fp)
786 fp.close()