Lines Matching refs:fp
228 fp = open(FILE, "w")
229 print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
230 print >>fp
231 print >>fp, '#define UNIDATA_VERSION "%s"' % UNIDATA_VERSION
232 print >>fp, "/* a list of unique database records */"
233 print >>fp, \
236 print >>fp, " {%d, %d, %d, %d, %d, %d}," % item
237 print >>fp, "};"
238 print >>fp
240 print >>fp, "/* Reindexing of NFC first characters. */"
241 print >>fp, "#define TOTAL_FIRST",total_first
242 print >>fp, "#define TOTAL_LAST",total_last
243 print >>fp, "struct reindex{int start;short count,index;};"
244 print >>fp, "static struct reindex nfc_first[] = {"
246 print >>fp," { %d, %d, %d}," % (start,end-start,comp_first[start])
247 print >>fp," {0,0,0}"
248 print >>fp,"};\n"
249 print >>fp, "static struct reindex nfc_last[] = {"
251 print >>fp," { %d, %d, %d}," % (start,end-start,comp_last[start])
252 print >>fp," {0,0,0}"
253 print >>fp,"};\n"
258 print >>fp, "/* string literals */"
259 print >>fp, "const char *_PyUnicode_CategoryNames[] = {"
261 print >>fp, " \"%s\"," % name
262 print >>fp, " NULL"
263 print >>fp, "};"
265 print >>fp, "const char *_PyUnicode_BidirectionalNames[] = {"
267 print >>fp, " \"%s\"," % name
268 print >>fp, " NULL"
269 print >>fp, "};"
271 print >>fp, "const char *_PyUnicode_EastAsianWidthNames[] = {"
273 print >>fp, " \"%s\"," % name
274 print >>fp, " NULL"
275 print >>fp, "};"
277 print >>fp, "static const char *decomp_prefix[] = {"
279 print >>fp, " \"%s\"," % name
280 print >>fp, " NULL"
281 print >>fp, "};"
286 print >>fp, "/* index tables for the database records */"
287 print >>fp, "#define SHIFT", shift
288 Array("index1", index1).dump(fp, trace)
289 Array("index2", index2).dump(fp, trace)
294 print >>fp, "/* decomposition data */"
295 Array("decomp_data", decomp_data).dump(fp, trace)
297 print >>fp, "/* index tables for the decomposition data */"
298 print >>fp, "#define DECOMP_SHIFT", shift
299 Array("decomp_index1", index1).dump(fp, trace)
300 Array("decomp_index2", index2).dump(fp, trace)
303 print >>fp, "/* NFC pairs */"
304 print >>fp, "#define COMP_SHIFT", shift
305 Array("comp_index", index).dump(fp, trace)
306 Array("comp_data", index2).dump(fp, trace)
321 print >>fp, "static const change_record change_records_%s[] = {" % cversion
323 print >>fp, "\t{ %s }," % ", ".join(map(str,record))
324 print >>fp, "};"
325 Array("changes_%s_index" % cversion, index1).dump(fp, trace)
326 Array("changes_%s_data" % cversion, index2).dump(fp, trace)
327 print >>fp, "static const change_record* get_change_%s(Py_UCS4 n)" % cversion
328 print >>fp, "{"
329 print >>fp, "\tint index;"
330 print >>fp, "\tif (n >= 0x110000) index = 0;"
331 print >>fp, "\telse {"
332 print >>fp, "\t\tindex = changes_%s_index[n>>%d];" % (cversion, shift)
333 print >>fp, "\t\tindex = changes_%s_data[(index<<%d)+(n & %d)];" % \
335 print >>fp, "\t}"
336 print >>fp, "\treturn change_records_%s+index;" % cversion
337 print >>fp, "}\n"
338 print >>fp, "static Py_UCS4 normalization_%s(Py_UCS4 n)" % cversion
339 print >>fp, "{"
340 print >>fp, "\tswitch(n) {"
342 print >>fp, "\tcase %s: return 0x%s;" % (hex(k), v)
343 print >>fp, "\tdefault: return 0;"
344 print >>fp, "\t}\n}\n"
346 fp.close()
447 fp = open(FILE, "w")
448 print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
449 print >>fp
450 print >>fp, "/* a list of unique character type descriptors */"
451 print >>fp, "const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {"
453 print >>fp, " {%d, %d, %d, %d, %d, %d}," % item
454 print >>fp, "};"
455 print >>fp
460 print >>fp, "/* type indexes */"
461 print >>fp, "#define SHIFT", shift
462 Array("index1", index1).dump(fp, trace)
463 Array("index2", index2).dump(fp, trace)
467 print >>fp, '/* Returns the numeric value as double for Unicode characters'
468 print >>fp, ' * having this property, -1.0 otherwise.'
469 print >>fp, ' */'
470 print >>fp, 'double _PyUnicode_ToNumeric(Py_UNICODE ch)'
471 print >>fp, '{'
472 print >>fp, ' switch (ch) {'
486 print >>fp, '#ifdef Py_UNICODE_WIDE'
488 print >>fp, ' case 0x%04X:' % (codepoint,)
490 print >>fp, '#endif'
491 print >>fp, ' return (double) %s;' % (value,)
493 print >>fp, '#endif'
494 print >>fp,' }'
495 print >>fp,' return -1.0;'
496 print >>fp,'}'
497 print >>fp
500 print >>fp, "/* Returns 1 for Unicode characters having the bidirectional"
501 print >>fp, " * type 'WS', 'B' or 'S' or the category 'Zs', 0 otherwise."
502 print >>fp, " */"
503 print >>fp, 'int _PyUnicode_IsWhitespace(register const Py_UNICODE ch)'
504 print >>fp, '{'
505 print >>fp, '#ifdef WANT_WCTYPE_FUNCTIONS'
506 print >>fp, ' return iswspace(ch);'
507 print >>fp, '#else'
508 print >>fp, ' switch (ch) {'
516 print >>fp, '#ifdef Py_UNICODE_WIDE'
518 print >>fp, ' case 0x%04X:' % (codepoint,)
520 print >>fp, '#endif'
521 print >>fp, ' return 1;'
523 print >>fp, '#endif'
525 print >>fp,' }'
526 print >>fp,' return 0;'
527 print >>fp, '#endif'
528 print >>fp,'}'
529 print >>fp
532 print >>fp, "/* Returns 1 for Unicode characters having the line break"
533 print >>fp, " * property 'BK', 'CR', 'LF' or 'NL' or having bidirectional"
534 print >>fp, " * type 'B', 0 otherwise."
535 print >>fp, " */"
536 print >>fp, 'int _PyUnicode_IsLinebreak(register const Py_UNICODE ch)'
537 print >>fp, '{'
538 print >>fp, ' switch (ch) {'
545 print >>fp, '#ifdef Py_UNICODE_WIDE'
547 print >>fp, ' case 0x%04X:' % (codepoint,)
549 print >>fp, '#endif'
550 print >>fp, ' return 1;'
552 print >>fp, '#endif'
554 print >>fp,' }'
555 print >>fp,' return 0;'
556 print >>fp,'}'
557 print >>fp
559 fp.close()
698 fp = open(FILE, "w")
699 print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
700 print >>fp
701 print >>fp, "#define NAME_MAXLEN", 256
702 print >>fp
703 print >>fp, "/* lexicon */"
704 Array("lexicon", lexicon).dump(fp, trace)
705 Array("lexicon_offset", lexicon_offset).dump(fp, trace)
710 print >>fp, "/* code->name phrasebook */"
711 print >>fp, "#define phrasebook_shift", shift
712 print >>fp, "#define phrasebook_short", short
714 Array("phrasebook", phrasebook).dump(fp, trace)
715 Array("phrasebook_offset1", offset1).dump(fp, trace)
716 Array("phrasebook_offset2", offset2).dump(fp, trace)
718 print >>fp, "/* name->code dictionary */"
719 codehash.dump(fp, trace)
721 fp.close()