Commit 8111070a authored by Fred Drake's avatar Fred Drake

Remove bogus stdout redirection and use of sys.__stdout__; use

augmented print statement instead.
parent 67ebb66a
...@@ -91,56 +91,54 @@ def maketables(): ...@@ -91,56 +91,54 @@ def maketables():
FILE = "Modules/unicodedata_db.h" FILE = "Modules/unicodedata_db.h"
sys.stdout = open(FILE, "w") fp = open(FILE, "w")
print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
print "/* this file was generated by %s %s */" % (SCRIPT, VERSION) print >>fp
print print >>fp, "/* a list of unique database records */"
print "/* a list of unique database records */" print >>fp, \
print "const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {" "const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {"
for item in table: for item in table:
print " {%d, %d, %d, %d}," % item print >>fp, " {%d, %d, %d, %d}," % item
print "};" print >>fp, "};"
print print >>fp
# FIXME: the following tables should be made static, and # FIXME: the following tables should be made static, and
# the support code moved into unicodedatabase.c # the support code moved into unicodedatabase.c
print "/* string literals */" print >>fp, "/* string literals */"
print "const char *_PyUnicode_CategoryNames[] = {" print >>fp, "const char *_PyUnicode_CategoryNames[] = {"
for name in CATEGORY_NAMES: for name in CATEGORY_NAMES:
print " \"%s\"," % name print >>fp, " \"%s\"," % name
print " NULL" print >>fp, " NULL"
print "};" print >>fp, "};"
print "const char *_PyUnicode_BidirectionalNames[] = {" print >>fp, "const char *_PyUnicode_BidirectionalNames[] = {"
for name in BIDIRECTIONAL_NAMES: for name in BIDIRECTIONAL_NAMES:
print " \"%s\"," % name print >>fp, " \"%s\"," % name
print " NULL" print >>fp, " NULL"
print "};" print >>fp, "};"
print "static const char *decomp_data[] = {" print >>fp, "static const char *decomp_data[] = {"
for name in decomp_data: for name in decomp_data:
print " \"%s\"," % name print >>fp, " \"%s\"," % name
print " NULL" print >>fp, " NULL"
print "};" print >>fp, "};"
# split record index table # split record index table
index1, index2, shift = splitbins(index) index1, index2, shift = splitbins(index)
print "/* index tables for the database records */" print >>fp, "/* index tables for the database records */"
print "#define SHIFT", shift print >>fp, "#define SHIFT", shift
Array("index1", index1).dump(sys.stdout) Array("index1", index1).dump(fp)
Array("index2", index2).dump(sys.stdout) Array("index2", index2).dump(fp)
# split decomposition index table # split decomposition index table
index1, index2, shift = splitbins(decomp_index) index1, index2, shift = splitbins(decomp_index)
print "/* index tables for the decomposition data */" print >>fp, "/* index tables for the decomposition data */"
print "#define DECOMP_SHIFT", shift print >>fp, "#define DECOMP_SHIFT", shift
Array("decomp_index1", index1).dump(sys.stdout) Array("decomp_index1", index1).dump(fp)
Array("decomp_index2", index2).dump(sys.stdout) Array("decomp_index2", index2).dump(fp)
sys.stdout = sys.__stdout__
# #
# 3) unicode type data # 3) unicode type data
...@@ -206,26 +204,24 @@ def maketables(): ...@@ -206,26 +204,24 @@ def maketables():
FILE = "Objects/unicodetype_db.h" FILE = "Objects/unicodetype_db.h"
sys.stdout = open(FILE, "w") fp = open(FILE, "w")
print "/* this file was generated by %s %s */" % (SCRIPT, VERSION) print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
print print >>fp
print "/* a list of unique character type descriptors */" print >>fp, "/* a list of unique character type descriptors */"
print "const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {" print >>fp, "const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {"
for item in table: for item in table:
print " {%d, %d, %d, %d, %d, %d}," % item print >>fp, " {%d, %d, %d, %d, %d, %d}," % item
print "};" print >>fp, "};"
print print >>fp
# split decomposition index table # split decomposition index table
index1, index2, shift = splitbins(index) index1, index2, shift = splitbins(index)
print "/* type indexes */" print >>fp, "/* type indexes */"
print "#define SHIFT", shift print >>fp, "#define SHIFT", shift
Array("index1", index1).dump(sys.stdout) Array("index1", index1).dump(fp)
Array("index2", index2).dump(sys.stdout) Array("index2", index2).dump(fp)
sys.stdout = sys.__stdout__
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# the following support code is taken from the unidb utilities # the following support code is taken from the unidb utilities
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment